How to use check_scenario method in avocado

Best Python code snippet using avocado_python

tests.py

Source:tests.py Github

copy

Full Screen

...201 return202 for char in str_:203 self_._replxx.send( char )204 time.sleep( intraKeyDelay_ )205 def check_scenario(206 self_, seq_, expected_,207 history = "one\ntwo\nthree\n",208 term = "xterm",209 command = _cxxSample_,210 dimensions = ( 25, 80 ),211 prompt = _prompt_,212 end = _prompt_ + _end_,213 encoding = "utf-8",214 pause = 0.25,215 intraKeyDelay = 0.002216 ):217 with open( "replxx_history.txt", "wb" ) as f:218 f.write( history.encode( encoding ) )219 f.close()220 os.environ["TERM"] = term221 if isinstance( command, str ):222 command = command.replace( "\n", "~" )223 if verbosity >= 2:224 print( "\nTERM: {}, SIZE: {}, CMD: {}".format( term, dimensions, command ) )225 prompt = prompt.replace( "\n", "\r\n" ).replace( "\r\r", "\r" )226 end = end.replace( "\n", "\r\n" ).replace( "\r\r", "\r" )227 if isinstance( command, str ):228 self_._replxx = pexpect.spawn( command, maxread = 1, encoding = encoding, dimensions = dimensions )229 else:230 self_._replxx = pexpect.spawn( command[0], args = command[1:], maxread = 1, encoding = encoding, dimensions = dimensions )231 self_._replxx.expect( prompt )232 self_.maxDiff = None233 if isinstance( seq_, str ):234 if isinstance( seq_, Rapid ):235 seqs = rapid( seq_.split( "<c-z>" ) )236 else:237 seqs = seq_.split( "<c-z>" )238 for seq in seqs:239 last = seq is seqs[-1]240 if not last:241 seq += "<c-z>"242 self_.send_str( sym_to_raw( seq ), intraKeyDelay )243 if not last:244 time.sleep( pause )245 self_._replxx.kill( signal.SIGCONT )246 else:247 for seq in seq_:248 last = seq is seq_[-1]249 self_.send_str( sym_to_raw( seq ), intraKeyDelay )250 if not last:251 time.sleep( pause )252 self_._replxx.expect( end )253 if isinstance( expected_, str ):254 self_.assertSequenceEqual( seq_to_sym( self_._replxx.before ), expected_ )255 else:256 try:257 self_.assertIn( seq_to_sym( self_._replxx.before ), expected_ )258 except:259 self_.assertSequenceEqual( seq_to_sym( self_._replxx.before ), "" )260 def test_unicode( self_ ):261 self_.check_scenario(262 "<up><cr><c-d>",263 "<c9>aóą Ϩ 𓢀 󃔀 <rst><ceos><c21>"264 "<c9>aóą Ϩ 𓢀 󃔀 <rst><ceos><c21>\r\n"265 "aóą Ϩ 𓢀 󃔀 \r\n",266 "aóą Ϩ 𓢀 󃔀 \n"267 )268 self_.check_scenario(269 "aóą Ϩ 𓢀 󃔀 <cr><c-d>",270 "<c9>a<rst><ceos><c10><c9>aó<rst><ceos><c11><c9>aóą<rst><ceos><c12><c9>aóą "271 "<rst><ceos><c13><c9>aóą Ϩ<rst><ceos><c14><c9>aóą Ϩ "272 "<rst><ceos><c15><c9>aóą Ϩ 𓢀<rst><ceos><c16><c9>aóą Ϩ 𓢀 "273 "<rst><ceos><c17><c9>aóą Ϩ 𓢀 "274 "<rst><ceos><c18><c9>aóą Ϩ 𓢀 󃔀<rst><ceos><c19><c9>aóą Ϩ 𓢀 󃔀 "275 "<rst><ceos><c20><c9>aóą Ϩ 𓢀 󃔀 "276 "<rst><ceos><c21><c9>aóą Ϩ 𓢀 󃔀 <rst><ceos><c21>\r\n"277 "aóą Ϩ 𓢀 󃔀 \r\n"278 )279 @unittest.skipIf( skip( "8bit_encoding" ), "broken platform" )280 def test_8bit_encoding( self_ ):281 LC_CTYPE = "LC_CTYPE"282 exists = LC_CTYPE in os.environ283 lcCtype = None284 if exists:285 lcCtype = os.environ[LC_CTYPE]286 os.environ[LC_CTYPE] = "pl_PL.ISO-8859-2"287 self_.check_scenario(288 "<aup><cr><c-d>",289 "<c9>text ~ó~<rst><ceos><c17><c9>text ~ó~<rst><ceos><c17>\r\ntext ~ó~\r\n",290 "text ~ó~\n",291 encoding = "iso-8859-2"292 )293 if exists:294 os.environ[LC_CTYPE] = lcCtype295 else:296 del os.environ[LC_CTYPE]297 def test_bad_term( self_ ):298 self_.check_scenario(299 "a line of text<cr><c-d>",300 "a line of text\r\na line of text\r\n",301 term = "dumb"302 )303 def test_ctrl_c( self_ ):304 self_.check_scenario(305 "abc<c-c><c-d>",306 "<c9>a<rst><ceos><c10><c9>ab<rst><ceos><c11><c9>abc<rst><ceos><c12><c9>abc<rst><ceos><c12>^C\r"307 "\r\n"308 )309 def test_ctrl_z( self_ ):310 self_.check_scenario(311 "<up><c-z><cr><c-d>",312 "<c9>three<rst><ceos><c14><brightgreen>replxx<rst>> "313 "<c9>three<rst><ceos><c14><c9>three<rst><ceos><c14>\r\n"314 "three\r\n"315 )316 self_.check_scenario(317 "<c-r>w<c-z><cr><c-d>",318 "<c1><ceos><c1><ceos>(reverse-i-search)`': "319 "<c23><c1><ceos>(reverse-i-search)`w': "320 "two<c25><c1><ceos>(reverse-i-search)`w': "321 "two<c25><c1><ceos><brightgreen>replxx<rst>> "322 "two<c10><c9><ceos><c12>\r\n"323 "two\r\n"324 )325 def test_ctrl_l( self_ ):326 self_.check_scenario(327 "<cr><cr><cr><c-l><c-d>",328 "<c9><ceos><c9>\r\n"329 "<brightgreen>replxx<rst>> <c9><ceos><c9>\r\n"330 "<brightgreen>replxx<rst>> <c9><ceos><c9>\r\n"331 "<brightgreen>replxx<rst>> <RIS><mvhm><clr><rst><brightgreen>replxx<rst>> "332 "<c9><rst><ceos><c9>",333 end = "\r\nExiting Replxx\r\n"334 )335 self_.check_scenario(336 "<cr><up><c-left><c-l><cr><c-d>",337 "<c9><ceos><c9>\r\n"338 "<brightgreen>replxx<rst>> <c9>first "339 "second<rst><ceos><c21><c9>first "340 "second<rst><ceos><c15><RIS><mvhm><clr><rst><brightgreen>replxx<rst>> "341 "<c9>first second<rst><ceos><c15><c9>first second<rst><ceos><c21>\r\n"342 "first second\r\n",343 "first second\n"344 )345 def test_backspace( self_ ):346 self_.check_scenario(347 "<up><c-a><m-f><c-right><backspace><backspace><backspace><backspace><cr><c-d>",348 "<c9>one two three<rst><ceos><c22><c9>one two "349 "three<rst><ceos><c9><c9>one two three<rst><ceos><c12><c9>one two "350 "three<rst><ceos><c16><c9>one tw three<rst><ceos><c15><c9>one t "351 "three<rst><ceos><c14><c9>one three<rst><ceos><c13><c9>one "352 "three<rst><ceos><c12><c9>one three<rst><ceos><c18>\r\n"353 "one three\r\n",354 "one two three\n"355 )356 def test_delete( self_ ):357 self_.check_scenario(358 "<up><m-b><c-left><del><c-d><del><c-d><cr><c-d>",359 "<c9>one two three<rst><ceos><c22><c9>one two "360 "three<rst><ceos><c17><c9>one two three<rst><ceos><c13><c9>one wo "361 "three<rst><ceos><c13><c9>one o three<rst><ceos><c13><c9>one "362 "three<rst><ceos><c13><c9>one three<rst><ceos><c13><c9>one three<rst><ceos><c18>\r\n"363 "one three\r\n",364 "one two three\n"365 )366 def test_home_key( self_ ):367 self_.check_scenario(368 "abc<home>z<cr><c-d>",369 "<c9>a<rst><ceos><c10><c9>ab<rst><ceos><c11><c9>abc<rst><ceos><c12><c9>abc<rst><ceos><c9><c9>zabc<rst><ceos><c10><c9>zabc<rst><ceos><c13>\r\n"370 "zabc\r\n"371 )372 def test_end_key( self_ ):373 self_.check_scenario(374 "abc<home>z<end>q<cr><c-d>",375 "<c9>a<rst><ceos><c10><c9>ab<rst><ceos><c11><c9>abc<rst><ceos><c12><c9>abc<rst><ceos><c9><c9>zabc<rst><ceos><c10><c9>zabc<rst><ceos><c13><c9>zabcq<rst><ceos><c14><c9>zabcq<rst><ceos><c14>\r\n"376 "zabcq\r\n"377 )378 def test_left_key( self_ ):379 self_.check_scenario(380 "abc<left>x<aleft><left>y<cr><c-d>",381 "<c9>a<rst><ceos><c10><c9>ab<rst><ceos><c11><c9>abc<rst><ceos><c12><c9>abc<rst><ceos><c11><c9>abxc<rst><ceos><c12><c9>abxc<rst><ceos><c11><c9>abxc<rst><ceos><c10><c9>aybxc<rst><ceos><c11><c9>aybxc<rst><ceos><c14>\r\n"382 "aybxc\r\n"383 )384 def test_right_key( self_ ):385 self_.check_scenario(386 "abc<home><right>x<aright>y<cr><c-d>",387 "<c9>a<rst><ceos><c10><c9>ab<rst><ceos><c11><c9>abc<rst><ceos><c12><c9>abc<rst><ceos><c9><c9>abc<rst><ceos><c10><c9>axbc<rst><ceos><c11><c9>axbc<rst><ceos><c12><c9>axbyc<rst><ceos><c13><c9>axbyc<rst><ceos><c14>\r\n"388 "axbyc\r\n"389 )390 def test_prev_word_key( self_ ):391 self_.check_scenario(392 "abc def ghi<c-left><m-left>x<cr><c-d>",393 "<c9>a<rst><ceos><c10><c9>ab<rst><ceos><c11><c9>abc<rst><ceos><c12><c9>abc "394 "<rst><ceos><c13><c9>abc d<rst><ceos><c14><c9>abc "395 "de<rst><ceos><c15><c9>abc def<rst><ceos><c16><c9>abc "396 "def <rst><ceos><c17><c9>abc def "397 "g<rst><ceos><c18><c9>abc def gh<rst><ceos><c19><c9>abc "398 "def ghi<rst><ceos><c20><c9>abc def ghi<rst><ceos><c17><c9>abc def "399 "ghi<rst><ceos><c13><c9>abc xdef ghi<rst><ceos><c14><c9>abc xdef "400 "ghi<rst><ceos><c21>\r\n"401 "abc xdef ghi\r\n"402 )403 def test_next_word_key( self_ ):404 self_.check_scenario(405 "abc def ghi<home><c-right><m-right>x<cr><c-d>",406 "<c9>a<rst><ceos><c10><c9>ab<rst><ceos><c11><c9>abc<rst><ceos><c12><c9>abc "407 "<rst><ceos><c13><c9>abc d<rst><ceos><c14><c9>abc "408 "de<rst><ceos><c15><c9>abc def<rst><ceos><c16><c9>abc "409 "def <rst><ceos><c17><c9>abc def "410 "g<rst><ceos><c18><c9>abc def gh<rst><ceos><c19><c9>abc "411 "def ghi<rst><ceos><c20><c9>abc def ghi<rst><ceos><c9><c9>abc def "412 "ghi<rst><ceos><c12><c9>abc def ghi<rst><ceos><c16><c9>abc defx "413 "ghi<rst><ceos><c17><c9>abc defx ghi<rst><ceos><c21>\r\n"414 "abc defx ghi\r\n"415 )416 def test_hint_show( self_ ):417 self_.check_scenario(418 "co\r<c-d>",419 "<c9>c<rst><ceos><c10><c9>co<rst><ceos>\r\n"420 " <gray>color_black<rst>\r\n"421 " <gray>color_red<rst>\r\n"422 " <gray>color_green<rst><u3><c11><c9>co<rst><ceos><c11>\r\n"423 "co\r\n"424 )425 self_.check_scenario(426 "<up><cr><c-d>",427 "<c9>zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz "428 "<brightgreen>color_brightgreen<rst><ceos><c15><u3><c9>zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz "429 "<brightgreen>color_brightgreen<rst><ceos><c15>\r\n"430 "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz color_brightgreen\r\n",431 "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz color_brightgreen\n",432 dimensions = ( 64, 16 )433 )434 def test_hint_scroll_down( self_ ):435 self_.check_scenario(436 "co<c-down><c-down><tab><cr><c-d>",437 "<c9>c<rst><ceos><c10><c9>co<rst><ceos>\r\n"438 " <gray>color_black<rst>\r\n"439 " <gray>color_red<rst>\r\n"440 " "441 "<gray>color_green<rst><u3><c11><c9>co<rst><ceos><gray>lor_black<rst>\r\n"442 " <gray>color_red<rst>\r\n"443 " <gray>color_green<rst>\r\n"444 " "445 "<gray>color_brown<rst><u3><c11><c9>co<rst><ceos><gray>lor_red<rst>\r\n"446 " <gray>color_green<rst>\r\n"447 " <gray>color_brown<rst>\r\n"448 " "449 "<gray>color_blue<rst><u3><c11><c9><red>color_red<rst><ceos><c18><c9><red>color_red<rst><ceos><c18>\r\n"450 "color_red\r\n"451 )452 def test_hint_scroll_up( self_ ):453 self_.check_scenario(454 "co<c-up><c-up><tab><cr><c-d>",455 "<c9>c<rst><ceos><c10><c9>co<rst><ceos>\r\n"456 " <gray>color_black<rst>\r\n"457 " <gray>color_red<rst>\r\n"458 " "459 "<gray>color_green<rst><u3><c11><c9>co<rst><ceos><gray>lor_normal<rst>\r\n"460 " <gray>co\r\n"461 " <gray>color_black<rst>\r\n"462 " "463 "<gray>color_red<rst><u3><c11><c9>co<rst><ceos><gray>lor_white<rst>\r\n"464 " <gray>color_normal<rst>\r\n"465 " <gray>co\r\n"466 " "467 "<gray>color_black<rst><u3><c11><c9><white>color_white<rst><ceos><c20><c9><white>color_white<rst><ceos><c20>\r\n"468 "color_white\r\n"469 )470 def test_history( self_ ):471 self_.check_scenario(472 "<up><up><up><up><down><down><down><down>four<cr><c-d>",473 "<c9>three<rst><ceos><c14><c9>two<rst><ceos><c12><c9>one<rst><ceos><c12><c9>two<rst><ceos><c12><c9>three<rst><ceos><c14><c9><rst><ceos><c9><c9>f<rst><ceos><c10><c9>fo<rst><ceos><c11><c9>fou<rst><ceos><c12><c9>four<rst><ceos><c13><c9>four<rst><ceos><c13>\r\n"474 "four\r\n"475 )476 with open( "replxx_history.txt", "rb" ) as f:477 data = f.read().decode()478 self_.assertSequenceEqual( data[:-33], "### 0000-00-00 00:00:00.000\none\n### 0000-00-00 00:00:00.000\ntwo\n### 0000-00-00 00:00:00.000\nthree\n" )479 self_.assertSequenceEqual( data[-5:], "four\n" )480 def test_paren_matching( self_ ):481 self_.check_scenario(482 "ab(cd)ef<left><left><left><left><left><left><left><cr><c-d>",483 "<c9>a<rst><ceos><c10><c9>ab<rst><ceos><c11><c9>ab<brightmagenta>(<rst><ceos><c12><c9>ab<brightmagenta>(<rst>c<rst><ceos><c13><c9>ab<brightmagenta>(<rst>cd<rst><ceos><c14><c9>ab<brightmagenta>(<rst>cd<brightmagenta>)<rst><ceos><c15><c9>ab<brightmagenta>(<rst>cd<brightmagenta>)<rst>e<rst><ceos><c16><c9>ab<brightmagenta>(<rst>cd<brightmagenta>)<rst>ef<rst><ceos><c17><c9>ab<brightmagenta>(<rst>cd<brightmagenta>)<rst>ef<rst><ceos><c16><c9>ab<brightmagenta>(<rst>cd<brightmagenta>)<rst>ef<rst><ceos><c15><c9>ab<brightred>(<rst>cd<brightmagenta>)<rst>ef<rst><ceos><c14><c9>ab<brightmagenta>(<rst>cd<brightmagenta>)<rst>ef<rst><ceos><c13><c9>ab<brightmagenta>(<rst>cd<brightmagenta>)<rst>ef<rst><ceos><c12><c9>ab<brightmagenta>(<rst>cd<brightred>)<rst>ef<rst><ceos><c11><c9>ab<brightmagenta>(<rst>cd<brightmagenta>)<rst>ef<rst><ceos><c10><c9>ab<brightmagenta>(<rst>cd<brightmagenta>)<rst>ef<rst><ceos><c17>\r\n"484 "ab(cd)ef\r\n"485 )486 def test_paren_not_matched( self_ ):487 self_.check_scenario(488 "a(b[c)d<left><left><left><left><left><left><left><cr><c-d>",489 "<c9>a<rst><ceos><c10><c9>a<brightmagenta>(<rst><ceos><c11><c9>a<brightmagenta>(<rst>b<rst><ceos><c12><c9>a<brightmagenta>(<rst>b<brightmagenta>[<rst><ceos><c13><c9>a<brightmagenta>(<rst>b<brightmagenta>[<rst>c<rst><ceos><c14><c9>a<brightmagenta>(<rst>b<brightmagenta>[<rst>c<brightmagenta>)<rst><ceos><c15><c9>a<brightmagenta>(<rst>b<brightmagenta>[<rst>c<brightmagenta>)<rst>d<rst><ceos><c16><c9>a<brightmagenta>(<rst>b<brightmagenta>[<rst>c<brightmagenta>)<rst>d<rst><ceos><c15><c9>a<err>(<rst>b<brightmagenta>[<rst>c<brightmagenta>)<rst>d<rst><ceos><c14><c9>a<brightmagenta>(<rst>b<brightmagenta>[<rst>c<brightmagenta>)<rst>d<rst><ceos><c13><c9>a<brightmagenta>(<rst>b<brightmagenta>[<rst>c<brightmagenta>)<rst>d<rst><ceos><c12><c9>a<brightmagenta>(<rst>b<brightmagenta>[<rst>c<brightmagenta>)<rst>d<rst><ceos><c11><c9>a<brightmagenta>(<rst>b<brightmagenta>[<rst>c<err>)<rst>d<rst><ceos><c10><c9>a<brightmagenta>(<rst>b<brightmagenta>[<rst>c<brightmagenta>)<rst>d<rst><ceos><c9><c9>a<brightmagenta>(<rst>b<brightmagenta>[<rst>c<brightmagenta>)<rst>d<rst><ceos><c16>\r\n"490 "a(b[c)d\r\n"491 )492 def test_tab_completion( self_ ):493 self_.check_scenario(494 "co<tab><tab>bri<tab>b<tab><cr><c-d>",495 "<c9>c<rst><ceos><c10><c9>co<rst><ceos>\r\n"496 " <gray>color_black<rst>\r\n"497 " <gray>color_red<rst>\r\n"498 " <gray>color_green<rst><u3><c11><c9>color_<rst><ceos>\r\n"499 " <gray>color_black<rst>\r\n"500 " <gray>color_red<rst>\r\n"501 " <gray>color_green<rst><u3><c15><c9>color_<rst><ceos><c15>\r\n"502 "<brightmagenta>color_<rst>black "503 "<brightmagenta>color_<rst>cyan "504 "<brightmagenta>color_<rst>brightblue\r\n"505 "<brightmagenta>color_<rst><red>red<rst> "506 "<brightmagenta>color_<rst>lightgray "507 "<brightmagenta>color_<rst>brightmagenta\r\n"508 "<brightmagenta>color_<rst>green "509 "<brightmagenta>color_<rst>gray "510 "<brightmagenta>color_<rst>brightcyan\r\n"511 "<brightmagenta>color_<rst>brown "512 "<brightmagenta>color_<rst><brightred>brightred<rst> <brightmagenta>color_<rst>white\r\n"513 "<brightmagenta>color_<rst>blue "514 "<brightmagenta>color_<rst>brightgreen <brightmagenta>color_<rst>normal\r\n"515 "<brightmagenta>color_<rst>magenta <brightmagenta>color_<rst>yellow\r\n"516 "<brightgreen>replxx<rst>> <c9>color_<rst><ceos>\r\n"517 " <gray>color_black<rst>\r\n"518 " <gray>color_red<rst>\r\n"519 " <gray>color_green<rst><u3><c15><c9>color_b<rst><ceos>\r\n"520 " <gray>color_black<rst>\r\n"521 " <gray>color_brown<rst>\r\n"522 " <gray>color_blue<rst><u3><c16><c9>color_br<rst><ceos>\r\n"523 " <gray>color_brown<rst>\r\n"524 " <gray>color_brightred<rst>\r\n"525 " "526 "<gray>color_brightgreen<rst><u3><c17><c9>color_bri<rst><ceos>\r\n"527 " <gray>color_brightred<rst>\r\n"528 " <gray>color_brightgreen<rst>\r\n"529 " "530 "<gray>color_brightblue<rst><u3><c18><c9>color_bright<rst><ceos>\r\n"531 " <gray>color_brightred<rst>\r\n"532 " <gray>color_brightgreen<rst>\r\n"533 " "534 "<gray>color_brightblue<rst><u3><c21><c9>color_brightb<rst><ceos><green>lue<rst><c22><c9><brightblue>color_brightblue<rst><ceos><c25><c9><brightblue>color_brightblue<rst><ceos><c25>\r\n"535 "color_brightblue\r\n"536 )537 self_.check_scenario(538 "<tab><tab>n<cr><c-d>",539 "<bell><bell><c9>n<rst><ceos><c10><c9>n<rst><ceos><c10>\r\nn\r\n",540 dimensions = ( 4, 32 ),541 command = [ ReplxxTests._cSample_, "q1", "e0" ]542 )543 self_.check_scenario(544 "<tab><tab>n<cr><c-d>",545 "<c9><ceos><c9>\r\n"546 "db\r\n"547 "hello\r\n"548 "hallo\r\n"549 "--More--<bell>\r"550 "\t\t\t\t\r"551 "<brightgreen>replxx<rst>> "552 "<c9><rst><ceos><c9><c9><rst><ceos><c9>\r\n",553 dimensions = ( 4, 24 ),554 command = ReplxxTests._cSample_ + " q1 e1"555 )556 self_.check_scenario(557 "<up><home>co<tab><cr><c-d>",558 "<c9>abcd<brightmagenta>()<rst><ceos><c15>"559 "<c9>abcd<brightmagenta>()<rst><ceos><c9>"560 "<c9>cabcd<brightmagenta>()<rst><ceos><c10>"561 "<c9>coabcd<brightmagenta>()<rst><ceos><c11>"562 "<c9>color_abcd<brightmagenta>()<rst><ceos><c15>"563 "<c9>color_abcd<brightmagenta>()<rst><ceos><c21>\r\n"564 "color_abcd()\r\n",565 "abcd()\n"566 )567 def test_completion_shorter_result( self_ ):568 self_.check_scenario(569 "<up><tab><cr><c-d>",570 "<c9>\\pi<rst><ceos><c12><c9>π<rst><ceos><c10><c9>π<rst><ceos><c10>\r\n"571 "π\r\n",572 "\\pi\n"573 )574 def test_completion_pager( self_ ):575 cmd = ReplxxTests._cSample_ + " q1 x" + ",".join( _words_ )576 self_.check_scenario(577 "<tab>py<cr><c-d>",578 "<c9><ceos><c9>\r\n"579 "ada groovy perl\r\n"580 "algolbash haskell php\r\n"581 "basic huginn prolog\r\n"582 "clojure java python\r\n"583 "cobol javascript rebol\r\n"584 "csharp julia ruby\r\n"585 "eiffel kotlin rust\r\n"586 "erlang lisp scala\r\n"587 "forth lua scheme\r\n"588 "--More--<bell>\r"589 "\t\t\t\t\r"590 "fortran modula sql\r\n"591 "fsharp nemerle swift\r\n"592 "go ocaml typescript\r\n"593 "<brightgreen>replxx<rst>> "594 "<c9><rst><ceos><c9><c9><rst><ceos><c9>\r\n",595 dimensions = ( 10, 40 ),596 command = cmd597 )598 self_.check_scenario(599 "<tab><cr><cr><cr><cr><c-d>",600 "<c9><ceos><c9>\r\n"601 "ada groovy perl\r\n"602 "algolbash haskell php\r\n"603 "basic huginn prolog\r\n"604 "clojure java python\r\n"605 "cobol javascript rebol\r\n"606 "csharp julia ruby\r\n"607 "eiffel kotlin rust\r\n"608 "erlang lisp scala\r\n"609 "forth lua scheme\r\n"610 "--More--\r"611 "\t\t\t\t\r"612 "fortran modula sql\r\n"613 "--More--\r"614 "\t\t\t\t\r"615 "fsharp nemerle swift\r\n"616 "--More--\r"617 "\t\t\t\t\r"618 "go ocaml typescript\r\n"619 "<brightgreen>replxx<rst>> "620 "<c9><rst><ceos><c9><c9><rst><ceos><c9>\r\n",621 dimensions = ( 10, 40 ),622 command = cmd623 )624 self_.check_scenario(625 "<tab><c-c><cr><c-d>",626 "<c9><ceos><c9>\r\n"627 "ada kotlin\r\n"628 "algolbash lisp\r\n"629 "basic lua\r\n"630 "clojure modula\r\n"631 "cobol nemerle\r\n"632 "csharp ocaml\r\n"633 "eiffel perl\r\n"634 "--More--^C\r\n"635 "<brightgreen>replxx<rst>> "636 "<c9><rst><ceos><c9><c9><rst><ceos><c9>\r\n",637 dimensions = ( 8, 32 ),638 command = cmd639 )640 self_.check_scenario(641 "<tab>q<cr><c-d>",642 "<c9><ceos><c9>\r\n"643 "ada kotlin\r\n"644 "algolbash lisp\r\n"645 "basic lua\r\n"646 "clojure modula\r\n"647 "cobol nemerle\r\n"648 "csharp ocaml\r\n"649 "eiffel perl\r\n"650 "--More--\r"651 "\t\t\t\t\r"652 "<brightgreen>replxx<rst>> "653 "<c9><rst><ceos><c9><c9><rst><ceos><c9>\r\n",654 dimensions = ( 8, 32 ),655 command = cmd656 )657 def test_double_tab_completion( self_ ):658 cmd = ReplxxTests._cSample_ + " d1 q1 x" + ",".join( _words_ )659 self_.check_scenario(660 "fo<tab><tab>r<tab><cr><c-d>",661 "<c9>f<rst><ceos>\r\n"662 " <gray>forth<rst>\r\n"663 " <gray>fortran<rst>\r\n"664 " <gray>fsharp<rst><u3><c10><c9>fo<rst><ceos>\r\n"665 " <gray>forth<rst>\r\n"666 " <gray>fortran<rst><u2><c11><c9>fort<rst><ceos>\r\n"667 " <gray>forth<rst>\r\n"668 " "669 "<gray>fortran<rst><u2><c13><c9>fortr<rst><ceos><gray>an<rst><c14><c9>fortran<rst><ceos><c16><c9>fortran<rst><ceos><c16>\r\n"670 "fortran\r\n",671 command = cmd672 )673 def test_beep_on_ambiguous_completion( self_ ):674 cmd = ReplxxTests._cSample_ + " b1 d1 q1 x" + ",".join( _words_ )675 self_.check_scenario(676 "fo<tab><tab>r<tab><cr><c-d>",677 "<c9>f<rst><ceos>\r\n"678 " <gray>forth<rst>\r\n"679 " <gray>fortran<rst>\r\n"680 " <gray>fsharp<rst><u3><c10><c9>fo<rst><ceos>\r\n"681 " <gray>forth<rst>\r\n"682 " <gray>fortran<rst><u2><c11><bell><c9>fort<rst><ceos>\r\n"683 " <gray>forth<rst>\r\n"684 " "685 "<gray>fortran<rst><u2><c13><bell><c9>fortr<rst><ceos><gray>an<rst><c14><c9>fortran<rst><ceos><c16><c9>fortran<rst><ceos><c16>\r\n"686 "fortran\r\n",687 command = cmd688 )689 def test_history_search_backward( self_ ):690 self_.check_scenario(691 "<c-r>repl<c-r><cr><c-d>",692 "<c1><ceos><c1><ceos>(reverse-i-search)`': "693 "<c23><c1><ceos>(reverse-i-search)`r': echo repl "694 "golf<c29><c1><ceos>(reverse-i-search)`re': echo repl "695 "golf<c30><c1><ceos>(reverse-i-search)`rep': echo repl "696 "golf<c31><c1><ceos>(reverse-i-search)`repl': echo repl "697 "golf<c32><c1><ceos>(reverse-i-search)`repl': charlie repl "698 "delta<c35><c1><ceos><brightgreen>replxx<rst>> charlie repl "699 "delta<c17><c9><ceos><c27>\r\n"700 "charlie repl delta\r\n",701 "some command\n"702 "alfa repl bravo\n"703 "other request\n"704 "charlie repl delta\n"705 "misc input\n"706 "echo repl golf\n"707 "final thoughts\n"708 )709 self_.check_scenario(710 "<c-r>for<backspace><backspace>s<cr><c-d>",711 "<c1><ceos><c1><ceos>(reverse-i-search)`': "712 "<c23><c1><ceos>(reverse-i-search)`f': "713 "swift<c27><c1><ceos>(reverse-i-search)`fo': "714 "fortran<c25><c1><ceos>(reverse-i-search)`for': "715 "fortran<c26><c1><ceos>(reverse-i-search)`fo': "716 "fortran<c25><c1><ceos>(reverse-i-search)`f': "717 "swift<c27><c1><ceos>(reverse-i-search)`fs': "718 "fsharp<c25><c1><ceos><brightgreen>replxx<rst>> "719 "fsharp<c9><c9><ceos><c15>\r\n"720 "fsharp\r\n",721 "\n".join( _words_ ) + "\n"722 )723 self_.check_scenario(724 "<c-r>mod<c-l><cr><c-d>",725 "<c1><ceos><c1><ceos>(reverse-i-search)`': "726 "<c23><c1><ceos>(reverse-i-search)`m': "727 "scheme<c28><c1><ceos>(reverse-i-search)`mo': "728 "modula<c25><c1><ceos>(reverse-i-search)`mod': "729 "modula<c26><c1><ceos><brightgreen>replxx<rst>> "730 "<c9><RIS><mvhm><clr><rst><brightgreen>replxx<rst>> "731 "<c9><rst><ceos><c9><c9><rst><ceos><c9>\r\n",732 "\n".join( _words_ ) + "\n"733 )734 def test_history_search_forward( self_ ):735 self_.check_scenario(736 "<c-s>repl<c-s><cr><c-d>",737 "<c1><ceos><c1><ceos>(i-search)`': <c15><bell><c1><ceos>(i-search)`r': "738 "<c16><bell><c1><ceos>(i-search)`re': <c17><bell><c1><ceos>(i-search)`rep': "739 "<c18><bell><c1><ceos>(i-search)`repl': "740 "<c19><bell><c1><ceos>(i-search)`repl': "741 "<c19><c1><ceos><brightgreen>replxx<rst>> <c9><c9><ceos><c9>\r\n",742 "charlie repl delta\r\n",743 "some command\n"744 "alfa repl bravo\n"745 "other request\n"746 "charlie repl delta\n"747 "misc input\n"748 "echo repl golf\n"749 "final thoughts\n"750 )751 self_.check_scenario(752 "<pgup><c-s>repl<c-s><cr><c-d>",753 "<c9>final thoughts<rst><ceos><c23><c1><ceos><c1><ceos>(i-search)`': final "754 "thoughts<c29><c1><ceos>(i-search)`r': echo repl "755 "golf<c21><c1><ceos>(i-search)`re': echo repl "756 "golf<c22><c1><ceos>(i-search)`rep': echo repl "757 "golf<c23><c1><ceos>(i-search)`repl': echo repl "758 "golf<c24><c1><ceos>(i-search)`repl': alfa repl "759 "bravo<c24><c1><ceos><brightgreen>replxx<rst>> alfa repl bravo<c14><c9>final "760 "thoughts<rst><ceos><c24>\r\n"761 "alfa repl bravo\r\n",762 "final thoughts\n"763 "echo repl golf\n"764 "misc input\n"765 "charlie repl delta\n"766 "other request\n"767 "alfa repl bravo\n"768 "some command\n"769 "charlie repl delta\r\n",770 )771 self_.check_scenario(772 "<c-s>for<backspace><backspace>s<cr><c-d>",773 "<c1><ceos><c1><ceos>(i-search)`': <c15><bell><c1><ceos>(i-search)`f': "774 "<c16><bell><c1><ceos>(i-search)`fo': <c17><bell><c1><ceos>(i-search)`for': "775 "<c18><bell><c1><ceos>(i-search)`fo': <c17><bell><c1><ceos>(i-search)`f': "776 "<c16><bell><c1><ceos>(i-search)`fs': "777 "<c17><c1><ceos><brightgreen>replxx<rst>> <c9><c9><ceos><c9>\r\n",778 "\n".join( _words_[::-1] ) + "\n"779 )780 self_.check_scenario(781 "<pgup><c-s>for<backspace><backspace>s<cr><c-d>",782 "<c9>typescript<rst><ceos><c19><c1><ceos><c1><ceos>(i-search)`': "783 "typescript<c25><c1><ceos>(i-search)`f': swift<c19><c1><ceos>(i-search)`fo': "784 "fortran<c17><c1><ceos>(i-search)`for': fortran<c18><c1><ceos>(i-search)`fo': "785 "fortran<c17><c1><ceos>(i-search)`f': swift<c19><c1><ceos>(i-search)`fs': "786 "fsharp<c17><c1><ceos><brightgreen>replxx<rst>> "787 "fsharp<c9><c9>typescript<rst><ceos><c15>\r\n"788 "fsharp\r\n",789 "\n".join( _words_[::-1] ) + "\n"790 )791 self_.check_scenario(792 "<c-s>mod<c-l><cr><c-d>",793 "<c1><ceos><c1><ceos>(i-search)`': <c15><bell><c1><ceos>(i-search)`m': "794 "<c16><bell><c1><ceos>(i-search)`mo': <c17><bell><c1><ceos>(i-search)`mod': "795 "<c18><c1><ceos><brightgreen>replxx<rst>> "796 "<c9><RIS><mvhm><clr><rst><brightgreen>replxx<rst>> "797 "<c9><rst><ceos><c9><c9><rst><ceos><c9>\r\n",798 "\n".join( _words_[::-1] ) + "\n"799 )800 self_.check_scenario(801 "<pgup><c-s>mod<c-l><cr><c-d>",802 "<c9>typescript<rst><ceos><c19><c1><ceos><c1><ceos>(i-search)`': "803 "typescript<c25><c1><ceos>(i-search)`m': scheme<c20><c1><ceos>(i-search)`mo': "804 "modula<c17><c1><ceos>(i-search)`mod': "805 "modula<c18><c1><ceos><brightgreen>replxx<rst>> "806 "typescript<c19><RIS><mvhm><clr><rst><brightgreen>replxx<rst>> "807 "<c9>typescript<rst><ceos><c19><c9>typescript<rst><ceos><c19>\r\n"808 "typescript\r\n",809 "\n".join( _words_[::-1] ) + "\n"810 )811 def test_history_search_backward_position( self_ ):812 self_.check_scenario(813 "<c-r>req<up><cr><c-d>",814 "<c1><ceos><c1><ceos>(reverse-i-search)`': "815 "<c23><c1><ceos>(reverse-i-search)`r': echo repl "816 "golf<c29><c1><ceos>(reverse-i-search)`re': echo repl "817 "golf<c30><c1><ceos>(reverse-i-search)`req': other "818 "request<c32><c1><ceos><brightgreen>replxx<rst>> other request<c15><c9>alfa "819 "repl bravo<rst><ceos><c24><c9>alfa repl bravo<rst><ceos><c24>\r\n"820 "alfa repl bravo\r\n",821 "some command\n"822 "alfa repl bravo\n"823 "other request\n"824 "charlie repl delta\n"825 "misc input\n"826 "echo repl golf\n"827 "final thoughts\n"828 )829 def test_history_search_overlong_line( self_ ):830 self_.check_scenario(831 "<c-r>lo<cr><c-d>",832 "<c1><ceos><c1><ceos>(reverse-i-search)`': "833 "<c23><c1><ceos>(reverse-i-search)`l': some very long line of text, much "834 "longer then a witdth of a terminal, "835 "seriously<c37><u1><c1><ceos>(reverse-i-search)`lo': some very long line of "836 "text, much longer then a witdth of a terminal, "837 "seriously<u1><c59><c1><ceos><brightgreen>replxx<rst>> some very long line of "838 "text, much longer then a witdth of a terminal, "839 "seriously<u1><c43><c9><ceos><c24>\r\n"840 "some very long line of text, much longer then a witdth of a terminal, "841 "seriously\r\n",842 "fake\nsome very long line of text, much longer then a witdth of a terminal, seriously\nanother fake",843 dimensions = ( 24, 64 )844 )845 def test_history_prefix_search_backward( self_ ):846 self_.check_scenario(847 "repl<m-p><m-p><cr><c-d>",848 "<c9>r<rst><ceos><c10><c9>re<rst><ceos><c11><c9>rep<rst><ceos><c12><c9>repl<rst><ceos><c13><c9>repl_echo "849 "golf<rst><ceos><c23><c9>repl_charlie "850 "delta<rst><ceos><c27><c9>repl_charlie delta<rst><ceos><c27>\r\n"851 "repl_charlie delta\r\n",852 "some command\n"853 "repl_alfa bravo\n"854 "other request\n"855 "repl_charlie delta\n"856 "misc input\n"857 "repl_echo golf\n"858 "final thoughts\n"859 )860 def test_history_prefix_search_backward_position( self_ ):861 self_.check_scenario(862 "repl<m-p><up><cr><c-d>",863 "<c9>r<rst><ceos><c10><c9>re<rst><ceos><c11><c9>rep<rst><ceos><c12><c9>repl<rst><ceos><c13><c9>repl_echo "864 "golf<rst><ceos><c23><c9>misc input<rst><ceos><c19><c9>misc "865 "input<rst><ceos><c19>\r\n"866 "misc input\r\n",867 "some command\n"868 "repl_alfa bravo\n"869 "other request\n"870 "repl_charlie delta\n"871 "misc input\n"872 "repl_echo golf\n"873 "final thoughts\n"874 )875 def test_history_listing( self_ ):876 self_.check_scenario(877 "<up><cr><c-d>",878 "<c9><brightmagenta>.history<rst><ceos><c17><c9><brightmagenta>.history<rst><ceos><c17>\r\n"879 " 0: some command\r\n"880 " 1: repl_alfa bravo\r\n"881 " 2: other request\r\n"882 " 3: repl_charlie delta\r\n"883 " 4: misc input\r\n"884 " 5: repl_echo golf\r\n"885 " 6: .history\r\n",886 "some command\n"887 "repl_alfa bravo\n"888 "other request\n"889 "repl_charlie delta\n"890 "misc input\n"891 "repl_echo golf\n"892 ".history\n"893 )894 self_.check_scenario(895 "<up><cr><c-d>",896 "<c9>/history<rst><ceos><c17><c9>/history<rst><ceos><c17>\r\n"897 " 0: some command\r\n"898 " 1: repl_alfa bravo\r\n"899 " 2: other request\r\n"900 " 3: repl_charlie delta\r\n"901 " 4: misc input\r\n"902 " 5: repl_echo golf\r\n"903 " 6: /history\r\n"904 "/history\r\n",905 "some command\n"906 "repl_alfa bravo\n"907 "other request\n"908 "repl_charlie delta\n"909 "misc input\n"910 "repl_echo golf\n"911 "/history\n",912 command = ReplxxTests._cSample_ + " q1"913 )914 def test_history_browse( self_ ):915 self_.check_scenario(916 "<up><aup><pgup><down><up><up><adown><pgdown><up><down><down><up><cr><c-d>",917 "<c9>twelve<rst><ceos><c15>"918 "<c9>eleven<rst><ceos><c15>"919 "<c9>one<rst><ceos><c12>"920 "<c9>two<rst><ceos><c12>"921 "<c9>one<rst><ceos><c12>"922 "<c9>two<rst><ceos><c12>"923 "<c9><rst><ceos><c9>"924 "<c9>twelve<rst><ceos><c15>"925 "<c9><rst><ceos><c9>"926 "<c9>twelve<rst><ceos><c15>"927 "<c9>twelve<rst><ceos><c15>\r\n"928 "twelve\r\n",929 "one\n"930 "two\n"931 "three\n"932 "four\n"933 "five\n"934 "six\n"935 "seven\n"936 "eight\n"937 "nine\n"938 "ten\n"939 "eleven\n"940 "twelve\n"941 )942 def test_history_max_size( self_ ):943 self_.check_scenario(944 "<pgup><pgdown>a<cr><pgup><cr><c-d>",945 "<c9>three<rst><ceos><c14><c9><rst><ceos><c9><c9>a<rst><ceos><c10><c9>a<rst><ceos><c10>\r\n"946 "a\r\n"947 "<brightgreen>replxx<rst>> "948 "<c9>four<rst><ceos><c13><c9>four<rst><ceos><c13>\r\n"949 "four\r\n",950 "one\n"951 "two\n"952 "three\n"953 "four\n"954 "five\n",955 command = ReplxxTests._cSample_ + " q1 s3"956 )957 def test_history_unique( self_ ):958 self_.check_scenario(959 "a<cr>b<cr>a<cr>b<cr><up><up><up><cr><c-d>",960 "<c9>a<rst><ceos><c10><c9>a<rst><ceos><c10>\r\n"961 "a\r\n"962 "<brightgreen>replxx<rst>> <c9>b<rst><ceos><c10><c9>b<rst><ceos><c10>\r\n"963 "b\r\n"964 "<brightgreen>replxx<rst>> <c9>a<rst><ceos><c10><c9>a<rst><ceos><c10>\r\n"965 "a\r\n"966 "<brightgreen>replxx<rst>> <c9>b<rst><ceos><c10><c9>b<rst><ceos><c10>\r\n"967 "b\r\n"968 "<brightgreen>replxx<rst>> "969 "<c9>b<rst><ceos><c10><c9>a<rst><ceos><c10><c9>c<rst><ceos><c10><c9>c<rst><ceos><c10>\r\n"970 "c\r\n",971 "a\nb\nc\n",972 command = ReplxxTests._cSample_ + " u1 q1"973 )974 self_.check_scenario(975 "a<cr>b<cr>a<cr>b<cr><up><up><up><cr><c-d>",976 "<c9>a<rst><ceos><c10><c9>a<rst><ceos><c10>\r\n"977 "a\r\n"978 "<brightgreen>replxx<rst>> <c9>b<rst><ceos><c10><c9>b<rst><ceos><c10>\r\n"979 "b\r\n"980 "<brightgreen>replxx<rst>> <c9>a<rst><ceos><c10><c9>a<rst><ceos><c10>\r\n"981 "a\r\n"982 "<brightgreen>replxx<rst>> <c9>b<rst><ceos><c10><c9>b<rst><ceos><c10>\r\n"983 "b\r\n"984 "<brightgreen>replxx<rst>> "985 "<c9>b<rst><ceos><c10><c9>a<rst><ceos><c10><c9>b<rst><ceos><c10><c9>b<rst><ceos><c10>\r\n"986 "b\r\n",987 "a\nb\nc\n",988 command = ReplxxTests._cSample_ + " u0 q1"989 )990 self_.check_scenario(991 rapid( "/history\n/unique\n/history\n<c-d>" ),992 "<c9>/<rst><ceos><c10><c9>/history<rst><ceos><c17>\r\n"993 " 0: a\r\n"994 " 1: b\r\n"995 " 2: c\r\n"996 " 3: b\r\n"997 " 4: c\r\n"998 " 5: d\r\n"999 " 6: a\r\n"1000 " 7: c\r\n"1001 " 8: c\r\n"1002 " 9: a\r\n"1003 "/history\r\n"1004 "<brightgreen>replxx<rst>> <c9>/unique<rst><ceos><c16>\r\n"1005 "/unique\r\n"1006 "<brightgreen>replxx<rst>> <c9>/history<rst><ceos><c17>\r\n"1007 " 0: b\r\n"1008 " 1: d\r\n"1009 " 2: c\r\n"1010 " 3: a\r\n"1011 " 4: /history\r\n"1012 " 5: /unique\r\n"1013 "/history\r\n",1014 "a\nb\nc\nb\nc\nd\na\nc\nc\na\n",1015 command = ReplxxTests._cSample_ + " u0 q1"1016 )1017 def test_history_recall_most_recent( self_ ):1018 self_.check_scenario(1019 "<pgup><down><cr><down><cr><c-d>",1020 "<c9>aaaa<rst><ceos><c13><c9>bbbb<rst><ceos><c13><c9>bbbb<rst><ceos><c13>\r\n"1021 "bbbb\r\n"1022 "<brightgreen>replxx<rst>> "1023 "<c9>cccc<rst><ceos><c13><c9>cccc<rst><ceos><c13>\r\n"1024 "cccc\r\n",1025 "aaaa\nbbbb\ncccc\ndddd\n"1026 )1027 def test_history_abort_incremental_history_search_position( self_ ):1028 self_.check_scenario(1029 "<up><up><c-r>cc<c-c><up><cr><c-d>",1030 "<c9>hhhh<rst><ceos><c13><c9>gggg<rst><ceos><c13><c1><ceos><c1><ceos>(reverse-i-search)`': "1031 "gggg<c27><c1><ceos>(reverse-i-search)`c': "1032 "cccc<c27><c1><ceos>(reverse-i-search)`cc': "1033 "cccc<c27><c1><ceos><brightgreen>replxx<rst>> "1034 "gggg<c13><c9>gggg<rst><ceos><c13><c9>ffff<rst><ceos><c13><c9>ffff<rst><ceos><c13>\r\n"1035 "ffff\r\n",1036 "aaaa\nbbbb\ncccc\ndddd\neeee\nffff\ngggg\nhhhh\n"1037 )1038 def test_capitalize( self_ ):1039 self_.check_scenario(1040 "<up><home><right><m-c><m-c><right><right><m-c><m-c><m-c><cr><c-d>",1041 "<c9>abc defg ijklmn zzxq<rst><ceos><c29><c9>abc defg ijklmn "1042 "zzxq<rst><ceos><c9><c9>abc defg ijklmn zzxq<rst><ceos><c10><c9>aBc defg "1043 "ijklmn zzxq<rst><ceos><c12><c9>aBc Defg ijklmn zzxq<rst><ceos><c17><c9>aBc "1044 "Defg ijklmn zzxq<rst><ceos><c18><c9>aBc Defg ijklmn "1045 "zzxq<rst><ceos><c19><c9>aBc Defg iJklmn zzxq<rst><ceos><c24><c9>aBc Defg "1046 "iJklmn Zzxq<rst><ceos><c29><c9>aBc Defg iJklmn Zzxq<rst><ceos><c29>\r\n"1047 "aBc Defg iJklmn Zzxq\r\n",1048 "abc defg ijklmn zzxq\n"1049 )1050 def test_make_upper_case( self_ ):1051 self_.check_scenario(1052 "<up><home><right><right><right><m-u><m-u><right><m-u><cr><c-d>",1053 "<c9>abcdefg hijklmno pqrstuvw<rst><ceos><c34><c9>abcdefg "1054 "hijklmno pqrstuvw<rst><ceos><c9><c9>abcdefg hijklmno "1055 "pqrstuvw<rst><ceos><c10><c9>abcdefg hijklmno "1056 "pqrstuvw<rst><ceos><c11><c9>abcdefg hijklmno "1057 "pqrstuvw<rst><ceos><c12><c9>abcDEFG hijklmno "1058 "pqrstuvw<rst><ceos><c16><c9>abcDEFG HIJKLMNO "1059 "pqrstuvw<rst><ceos><c25><c9>abcDEFG HIJKLMNO "1060 "pqrstuvw<rst><ceos><c26><c9>abcDEFG HIJKLMNO "1061 "PQRSTUVW<rst><ceos><c34><c9>abcDEFG HIJKLMNO "1062 "PQRSTUVW<rst><ceos><c34>\r\n"1063 "abcDEFG HIJKLMNO PQRSTUVW\r\n",1064 "abcdefg hijklmno pqrstuvw\n"1065 )1066 def test_make_lower_case( self_ ):1067 self_.check_scenario(1068 "<up><home><right><right><right><m-l><m-l><right><m-l><cr><c-d>",1069 "<c9>ABCDEFG HIJKLMNO PQRSTUVW<rst><ceos><c34><c9>ABCDEFG "1070 "HIJKLMNO PQRSTUVW<rst><ceos><c9><c9>ABCDEFG HIJKLMNO "1071 "PQRSTUVW<rst><ceos><c10><c9>ABCDEFG HIJKLMNO "1072 "PQRSTUVW<rst><ceos><c11><c9>ABCDEFG HIJKLMNO "1073 "PQRSTUVW<rst><ceos><c12><c9>ABCdefg HIJKLMNO "1074 "PQRSTUVW<rst><ceos><c16><c9>ABCdefg hijklmno "1075 "PQRSTUVW<rst><ceos><c25><c9>ABCdefg hijklmno "1076 "PQRSTUVW<rst><ceos><c26><c9>ABCdefg hijklmno "1077 "pqrstuvw<rst><ceos><c34><c9>ABCdefg hijklmno "1078 "pqrstuvw<rst><ceos><c34>\r\n"1079 "ABCdefg hijklmno pqrstuvw\r\n",1080 "ABCDEFG HIJKLMNO PQRSTUVW\n"1081 )1082 def test_transpose( self_ ):1083 self_.check_scenario(1084 "<up><home><c-t><right><c-t><c-t><c-t><c-t><c-t><cr><c-d>",1085 "<c9>abcd<rst><ceos><c13>"1086 "<c9>abcd<rst><ceos><c9>"1087 "<c9>abcd<rst><ceos><c10>"1088 "<c9>bacd<rst><ceos><c11>"1089 "<c9>bcad<rst><ceos><c12>"1090 "<c9>bcda<rst><ceos><c13>"1091 "<c9>bcad<rst><ceos><c13>"1092 "<c9>bcda<rst><ceos><c13>"1093 "<c9>bcda<rst><ceos><c13>\r\n"1094 "bcda\r\n",1095 "abcd\n"1096 )1097 def test_kill_to_beginning_of_line( self_ ):1098 self_.check_scenario(1099 "<up><home><c-right><c-right><right><c-u><end><c-y><cr><c-d>",1100 "<c9><brightblue>+<rst>abc defg<brightblue>--<rst>ijklmn "1101 "zzxq<brightblue>+<rst><ceos><c32><c9><brightblue>+<rst>abc "1102 "defg<brightblue>--<rst>ijklmn "1103 "zzxq<brightblue>+<rst><ceos><c9><c9><brightblue>+<rst>abc "1104 "defg<brightblue>--<rst>ijklmn "1105 "zzxq<brightblue>+<rst><ceos><c13><c9><brightblue>+<rst>abc "1106 "defg<brightblue>--<rst>ijklmn "1107 "zzxq<brightblue>+<rst><ceos><c18><c9><brightblue>+<rst>abc "1108 "defg<brightblue>--<rst>ijklmn "1109 "zzxq<brightblue>+<rst><ceos><c19><c9><brightblue>-<rst>ijklmn "1110 "zzxq<brightblue>+<rst><ceos><c9><c9><brightblue>-<rst>ijklmn "1111 "zzxq<brightblue>+<rst><ceos><c22><c9><brightblue>-<rst>ijklmn "1112 "zzxq<brightblue>++<rst>abc "1113 "defg<brightblue>-<rst><ceos><c32><c9><brightblue>-<rst>ijklmn "1114 "zzxq<brightblue>++<rst>abc defg<brightblue>-<rst><ceos><c32>\r\n"1115 "-ijklmn zzxq++abc defg-\r\n",1116 "+abc defg--ijklmn zzxq+\n"1117 )1118 def test_kill_to_end_of_line( self_ ):1119 self_.check_scenario(1120 "<up><home><c-right><c-right><right><c-k><home><c-y><cr><c-d>",1121 "<c9><brightblue>+<rst>abc defg<brightblue>--<rst>ijklmn "1122 "zzxq<brightblue>+<rst><ceos><c32><c9><brightblue>+<rst>abc "1123 "defg<brightblue>--<rst>ijklmn "1124 "zzxq<brightblue>+<rst><ceos><c9><c9><brightblue>+<rst>abc "1125 "defg<brightblue>--<rst>ijklmn "1126 "zzxq<brightblue>+<rst><ceos><c13><c9><brightblue>+<rst>abc "1127 "defg<brightblue>--<rst>ijklmn "1128 "zzxq<brightblue>+<rst><ceos><c18><c9><brightblue>+<rst>abc "1129 "defg<brightblue>--<rst>ijklmn "1130 "zzxq<brightblue>+<rst><ceos><c19><c9><brightblue>+<rst>abc "1131 "defg<brightblue>-<rst><ceos><c19><c9><brightblue>+<rst>abc "1132 "defg<brightblue>-<rst><ceos><c9><c9><brightblue>-<rst>ijklmn "1133 "zzxq<brightblue>++<rst>abc "1134 "defg<brightblue>-<rst><ceos><c22><c9><brightblue>-<rst>ijklmn "1135 "zzxq<brightblue>++<rst>abc defg<brightblue>-<rst><ceos><c32>\r\n"1136 "-ijklmn zzxq++abc defg-\r\n",1137 "+abc defg--ijklmn zzxq+\n"1138 )1139 def test_kill_next_word( self_ ):1140 self_.check_scenario(1141 "<up><home><c-right><m-d><c-right><c-y><cr><c-d>",1142 "<c9>alpha charlie bravo delta<rst><ceos><c34><c9>alpha "1143 "charlie bravo delta<rst><ceos><c9><c9>alpha charlie bravo "1144 "delta<rst><ceos><c14><c9>alpha bravo delta<rst><ceos><c14><c9>alpha bravo "1145 "delta<rst><ceos><c20><c9>alpha bravo charlie delta<rst><ceos><c28><c9>alpha "1146 "bravo charlie delta<rst><ceos><c34>\r\n"1147 "alpha bravo charlie delta\r\n",1148 "alpha charlie bravo delta\n"1149 )1150 def test_kill_prev_word_to_white_space( self_ ):1151 self_.check_scenario(1152 "<up><c-left><c-w><c-left><c-y><cr><c-d>",1153 "<c9>alpha charlie bravo delta<rst><ceos><c34><c9>alpha "1154 "charlie bravo delta<rst><ceos><c29><c9>alpha charlie "1155 "delta<rst><ceos><c23><c9>alpha charlie delta<rst><ceos><c15><c9>alpha bravo "1156 "charlie delta<rst><ceos><c21><c9>alpha bravo charlie delta<rst><ceos><c34>\r\n"1157 "alpha bravo charlie delta\r\n",1158 "alpha charlie bravo delta\n"1159 )1160 def test_kill_prev_word( self_ ):1161 self_.check_scenario(1162 "<up><c-left><m-backspace><c-left><c-y><cr><c-d>",1163 "<c9>alpha<brightmagenta>.<rst>charlie "1164 "bravo<brightmagenta>.<rst>delta<rst><ceos><c34><c9>alpha<brightmagenta>.<rst>charlie "1165 "bravo<brightmagenta>.<rst>delta<rst><ceos><c29><c9>alpha<brightmagenta>.<rst>charlie "1166 "delta<rst><ceos><c23><c9>alpha<brightmagenta>.<rst>charlie "1167 "delta<rst><ceos><c15><c9>alpha<brightmagenta>.<rst>bravo<brightmagenta>.<rst>charlie "1168 "delta<rst><ceos><c21><c9>alpha<brightmagenta>.<rst>bravo<brightmagenta>.<rst>charlie "1169 "delta<rst><ceos><c34>\r\n"1170 "alpha.bravo.charlie delta\r\n",1171 "alpha.charlie bravo.delta\n"1172 )1173 def test_kill_ring( self_ ):1174 self_.check_scenario(1175 "<up><c-w><backspace><c-w><backspace><c-w><backspace><c-u><c-y><m-y><m-y><m-y> <c-y><m-y><m-y><m-y> <c-y><m-y><m-y><m-y> <c-y><m-y><m-y><m-y><cr><c-d>",1176 "<c9>delta charlie bravo alpha<rst><ceos><c34><c9>delta "1177 "charlie bravo <rst><ceos><c29><c9>delta charlie "1178 "bravo<rst><ceos><c28><c9>delta charlie "1179 "<rst><ceos><c23><c9>delta "1180 "charlie<rst><ceos><c22><c9>delta "1181 "<rst><ceos><c15>"1182 "<c9>delta<rst><ceos><c14>"1183 "<c9><rst><ceos><c9>"1184 "<c9>delta<rst><ceos><c14>"1185 "<c9>charlie<rst><ceos><c16>"1186 "<c9>bravo<rst><ceos><c14>"1187 "<c9>alpha<rst><ceos><c14>"1188 "<c9>alpha "1189 "<rst><ceos><c15><c9>alpha "1190 "alpha<rst><ceos><c20><c9>alpha "1191 "delta<rst><ceos><c20><c9>alpha "1192 "charlie<rst><ceos><c22><c9>alpha "1193 "bravo<rst><ceos><c20><c9>alpha bravo "1194 "<rst><ceos><c21><c9>alpha bravo "1195 "bravo<rst><ceos><c26><c9>alpha bravo "1196 "alpha<rst><ceos><c26><c9>alpha bravo "1197 "delta<rst><ceos><c26><c9>alpha bravo "1198 "charlie<rst><ceos><c28><c9>alpha bravo charlie "1199 "<rst><ceos><c29><c9>alpha bravo charlie "1200 "charlie<rst><ceos><c36><c9>alpha bravo charlie "1201 "bravo<rst><ceos><c34><c9>alpha bravo charlie "1202 "alpha<rst><ceos><c34><c9>alpha bravo charlie "1203 "delta<rst><ceos><c34><c9>alpha bravo charlie delta<rst><ceos><c34>\r\n"1204 "alpha bravo charlie delta\r\n",1205 "delta charlie bravo alpha\n"1206 )1207 self_.check_scenario(1208 "<up><c-w><c-w><backspace><c-a><c-y> <cr><c-d>",1209 "<c9>charlie delta alpha bravo<rst><ceos><c34><c9>charlie "1210 "delta alpha <rst><ceos><c29><c9>charlie delta "1211 "<rst><ceos><c23><c9>charlie "1212 "delta<rst><ceos><c22><c9>charlie delta<rst><ceos><c9><c9>alpha "1213 "bravocharlie delta<rst><ceos><c20><c9>alpha bravo charlie "1214 "delta<rst><ceos><c21><c9>alpha bravo charlie delta<rst><ceos><c34>\r\n"1215 "alpha bravo charlie delta\r\n",1216 "charlie delta alpha bravo\n"1217 )1218 self_.check_scenario(1219 "<up><home><m-d><m-d><del><c-e> <c-y><cr><c-d>",1220 "<c9>charlie delta alpha bravo<rst><ceos><c34><c9>charlie "1221 "delta alpha bravo<rst><ceos><c9><c9> delta alpha bravo<rst><ceos><c9><c9> "1222 "alpha bravo<rst><ceos><c9><c9>alpha bravo<rst><ceos><c9><c9>alpha "1223 "bravo<rst><ceos><c20><c9>alpha bravo "1224 "<rst><ceos><c21><c9>alpha bravo charlie "1225 "delta<rst><ceos><c34><c9>alpha bravo charlie delta<rst><ceos><c34>\r\n"1226 "alpha bravo charlie delta\r\n",1227 "charlie delta alpha bravo\n"1228 )1229 self_.check_scenario(1230 "<up><c-w><backspace><c-w><backspace><c-w><backspace><c-w><backspace><c-w><backspace>"1231 "<c-w><backspace><c-w><backspace><c-w><backspace><c-w><backspace><c-w><backspace>"1232 "<c-w><c-y><m-y><m-y><m-y><m-y><m-y><m-y><m-y><m-y><m-y><m-y><cr><c-d>",1233 "<c9>a b c d e f g h i j k<rst><ceos><c30><c9>a b c d e f g "1234 "h i j <rst><ceos><c29><c9>a b c d e f g h i "1235 "j<rst><ceos><c28><c9>a b c d e f g h i "1236 "<rst><ceos><c27><c9>a b c d e f g h "1237 "i<rst><ceos><c26><c9>a b c d e f g h "1238 "<rst><ceos><c25><c9>a b c d e f g "1239 "h<rst><ceos><c24><c9>a b c d e f g "1240 "<rst><ceos><c23><c9>a b c d e f g<rst><ceos><c22><c9>a "1241 "b c d e f <rst><ceos><c21><c9>a b c d e "1242 "f<rst><ceos><c20><c9>a b c d e <rst><ceos><c19><c9>a b "1243 "c d e<rst><ceos><c18><c9>a b c d <rst><ceos><c17><c9>a "1244 "b c d<rst><ceos><c16><c9>a b c <rst><ceos><c15><c9>a b "1245 "c<rst><ceos><c14><c9>a b <rst><ceos><c13><c9>a "1246 "b<rst><ceos><c12><c9>a "1247 "<rst><ceos><c11>"1248 "<c9>a<rst><ceos><c10>"1249 "<c9><rst><ceos><c9>"1250 "<c9>a<rst><ceos><c10>"1251 "<c9>b<rst><ceos><c10>"1252 "<c9>c<rst><ceos><c10>"1253 "<c9>d<rst><ceos><c10>"1254 "<c9>e<rst><ceos><c10>"1255 "<c9>f<rst><ceos><c10>"1256 "<c9>g<rst><ceos><c10>"1257 "<c9>h<rst><ceos><c10>"1258 "<c9>i<rst><ceos><c10>"1259 "<c9>j<rst><ceos><c10>"1260 "<c9>a<rst><ceos><c10>"1261 "<c9>a<rst><ceos><c10>\r\n"1262 "a\r\n",1263 "a b c d e f g h i j k\n"1264 )1265 def test_yank_last_arg( self_ ):1266 self_.check_scenario(1267 "0123<left><left><m-.><m-.><m-.><cr><c-d>",1268 "<c9><yellow>0<rst><ceos><c10>"1269 "<c9><yellow>01<rst><ceos><c11>"1270 "<c9><yellow>012<rst><ceos><c12>"1271 "<c9><yellow>0123<rst><ceos><c13>"1272 "<c9><yellow>0123<rst><ceos><c12>"1273 "<c9><yellow>0123<rst><ceos><c11>"1274 "<c9><yellow>01<rst>cat<yellow>23<rst><ceos><c14>"1275 "<c9><yellow>01<rst>trillion<yellow>23<rst><ceos><c19>"1276 "<c9><yellow>01<rst>twelve<yellow>23<rst><ceos><c17>"1277 "<c9><yellow>01<rst>twelve<yellow>23<rst><ceos><c19>\r\n"1278 "01twelve23\r\n",1279 "one two three\nten eleven twelve\nmillion trillion\ndog cat\n"1280 )1281 self_.check_scenario(1282 "<up><up><up> <m-.><m-.><cr><c-d>",1283 "<c9>dog cat<rst><ceos><c16><c9>million trillion<rst><ceos><c25><c9>ten "1284 "eleven twelve<rst><ceos><c26><c9>ten eleven twelve <rst><ceos><c27><c9>ten "1285 "eleven twelve cat<rst><ceos><c30><c9>ten eleven twelve "1286 "trillion<rst><ceos><c35><c9>ten eleven twelve trillion<rst><ceos><c35>\r\n"1287 "ten eleven twelve trillion\r\n",1288 "one two three\nten eleven twelve\nmillion trillion\ndog cat\n"1289 )1290 def test_tab_completion_cutoff( self_ ):1291 self_.check_scenario(1292 "<tab>n<tab>y<cr><c-d>",1293 "<c9><rst><ceos><c9>\r\n"1294 "Display all 9 possibilities? (y or n)\r\n"1295 "<brightgreen>replxx<rst>> "1296 "<c9><rst><ceos><c9><c9><rst><ceos><c9>\r\n"1297 "Display all 9 possibilities? (y or n)<ceos>\r\n"1298 "db hallo hansekogge quetzalcoatl power\r\n"1299 "hello hans seamann quit\r\n"1300 "<brightgreen>replxx<rst>> "1301 "<c9><rst><ceos><c9><c9><rst><ceos><c9>\r\n",1302 command = ReplxxTests._cSample_ + " q1 c3"1303 )1304 self_.check_scenario(1305 "<tab>n<cr><c-d>",1306 "<c9><rst><ceos><c9>\r\n"1307 "Display all 9 possibilities? (y or n)\r\n"1308 "<brightgreen>replxx<rst>> "1309 "<c9><rst><ceos><c9><c9><rst><ceos><c9>\r\n",1310 command = ReplxxTests._cSample_ + " q1 c3"1311 )1312 self_.check_scenario(1313 "<tab><c-c><cr><c-d>",1314 "<c9><rst><ceos><c9>\r\n"1315 "Display all 9 possibilities? (y or n)^C\r\n"1316 "<brightgreen>replxx<rst>> "1317 "<c9><rst><ceos><c9><c9><rst><ceos><c9>\r\n",1318 command = ReplxxTests._cSample_ + " q1 c3"1319 )1320 self_.check_scenario(1321 ["<tab>", "<c-c><cr><c-d>"],1322 "<c9><rst><ceos><c9>\r\n"1323 "Display all 9 possibilities? (y or n)^C\r\n"1324 "<brightgreen>replxx<rst>> "1325 "<c9><rst><ceos><c9><c9><rst><ceos><c9>\r\n",1326 command = ReplxxTests._cSample_ + " q1 c3 H200"1327 )1328 def test_preload( self_ ):1329 self_.check_scenario(1330 "<cr><c-d>",1331 "<c9>Alice has a cat.<rst><ceos><c25>"1332 "<c9>Alice has a cat.<rst><ceos><c25>\r\n"1333 "Alice has a cat.\r\n",1334 command = ReplxxTests._cSample_ + " q1 'iAlice has a cat.'"1335 )1336 self_.check_scenario(1337 "<cr><c-d>",1338 "<c9>Cat eats mice. "1339 "<rst><ceos><c26><c9>Cat eats mice. "1340 "<rst><ceos><c26>\r\n"1341 "Cat eats mice. "1342 "\r\n",1343 command = ReplxxTests._cSample_ + " q1 'iCat\teats\tmice.\r\n'"1344 )1345 self_.check_scenario(1346 "<cr><c-d>",1347 "<c9>Cat eats mice. "1348 "<rst><ceos><c26><c9>Cat eats mice. "1349 "<rst><ceos><c26>\r\n"1350 "Cat eats mice. "1351 "\r\n",1352 command = ReplxxTests._cSample_ + " q1 'iCat\teats\tmice.\r\n\r\n\n\n'"1353 )1354 self_.check_scenario(1355 "<cr><c-d>",1356 "<c9>M Alice has a cat.<rst><ceos><c27>"1357 "<c9>M Alice has a cat.<rst><ceos><c27>\r\n"1358 "M Alice has a cat.\r\n",1359 command = ReplxxTests._cSample_ + " q1 'iMAlice has a cat.'"1360 )1361 self_.check_scenario(1362 "<cr><c-d>",1363 "<c9>M Alice has a cat.<rst><ceos><c28>"1364 "<c9>M Alice has a cat.<rst><ceos><c28>\r\n"1365 "M Alice has a cat.\r\n",1366 command = ReplxxTests._cSample_ + " q1 'iM\t\t\t\tAlice has a cat.'"1367 )1368 def test_prompt( self_ ):1369 prompt = "date: now\nrepl> "1370 self_.check_scenario(1371 "<up><cr><up><up><cr><c-d>",1372 "<c7>three<rst><ceos><c12><c7>three<rst><ceos><c12>\r\n"1373 "three\r\n"1374 "date: now\r\n"1375 "repl> "1376 "<c7>three<rst><ceos><c12><c7>two<rst><ceos><c10><c7>two<rst><ceos><c10>\r\n"1377 "two\r\n",1378 command = ReplxxTests._cSample_ + " q1 'p{}'".format( prompt ),1379 prompt = prompt,1380 end = prompt + ReplxxTests._end_1381 )1382 prompt = "repl>\n"1383 self_.check_scenario(1384 "a<cr><c-d>",1385 "<c1>a<rst><ceos><c2><c1>a<rst><ceos><c2>\r\na\r\n",1386 command = ReplxxTests._cSample_ + " q1 'p{}'".format( prompt ),1387 prompt = prompt,1388 end = prompt + ReplxxTests._end_1389 )1390 def test_long_line( self_ ):1391 self_.check_scenario(1392 "<up><c-left>~<c-left>~<c-left>~<c-left>~<c-left>~<c-left>~<c-left>~<c-left>~<c-left>~<c-left>~<c-left>~<c-left>~<c-left><cr><c-d>",1393 "<c9>ada clojure eiffel fortran groovy java kotlin modula perl python "1394 "rust sql<rst><ceos><c2><u2><c9>ada clojure eiffel fortran groovy "1395 "java kotlin modula perl python rust sql<rst><ceos><u1><c39><u1><c9>ada "1396 "clojure eiffel fortran groovy java kotlin modula perl python rust "1397 "~sql<rst><ceos><u1><c40><u1><c9>ada clojure eiffel fortran groovy java "1398 "kotlin modula perl python rust ~sql<rst><ceos><u1><c34><u1><c9>ada clojure "1399 "eiffel fortran groovy java kotlin modula perl python ~rust "1400 "~sql<rst><ceos><u1><c35><u1><c9>ada clojure eiffel fortran groovy java "1401 "kotlin modula perl python ~rust ~sql<rst><ceos><u1><c27><u1><c9>ada clojure "1402 "eiffel fortran groovy java kotlin modula perl ~python ~rust "1403 "~sql<rst><ceos><u1><c28><u1><c9>ada clojure eiffel fortran groovy java "1404 "kotlin modula perl ~python ~rust ~sql<rst><ceos><u1><c22><u1><c9>ada clojure "1405 "eiffel fortran groovy java kotlin modula ~perl ~python ~rust "1406 "~sql<rst><ceos><u1><c23><u1><c9>ada clojure eiffel fortran groovy java "1407 "kotlin modula ~perl ~python ~rust ~sql<rst><ceos><u1><c15><u1><c9>ada "1408 "clojure eiffel fortran groovy java kotlin ~modula ~perl ~python ~rust "1409 "~sql<rst><ceos><u1><c16><u1><c9>ada clojure eiffel fortran groovy java "1410 "kotlin ~modula ~perl ~python ~rust ~sql<rst><ceos><u1><c8><u1><c9>ada "1411 "clojure eiffel fortran groovy java ~kotlin ~modula ~perl ~python ~rust "1412 "~sql<rst><ceos><u1><c9><u1><c9>ada clojure eiffel fortran groovy java "1413 "~kotlin ~modula ~perl ~python ~rust ~sql<rst><ceos><u1><c3><u1><c9>ada "1414 "clojure eiffel fortran groovy ~java ~kotlin ~modula ~perl ~python ~rust "1415 "~sql<rst><ceos><u1><c4><u1><c9>ada clojure eiffel fortran groovy ~java "1416 "~kotlin ~modula ~perl ~python ~rust ~sql<rst><ceos><u2><c36><c9>ada clojure "1417 "eiffel fortran ~groovy ~java ~kotlin ~modula ~perl ~python ~rust "1418 "~sql<rst><ceos><u2><c37><c9>ada clojure eiffel fortran ~groovy ~java ~kotlin "1419 "~modula ~perl ~python ~rust ~sql<rst><ceos><u2><c28><c9>ada clojure eiffel "1420 "~fortran ~groovy ~java ~kotlin ~modula ~perl ~python ~rust "1421 "~sql<rst><ceos><u2><c29><c9>ada clojure eiffel ~fortran ~groovy ~java "1422 "~kotlin ~modula ~perl ~python ~rust ~sql<rst><ceos><u2><c21><c9>ada clojure "1423 "~eiffel ~fortran ~groovy ~java ~kotlin ~modula ~perl ~python ~rust "1424 "~sql<rst><ceos><u2><c22><c9>ada clojure ~eiffel ~fortran ~groovy ~java "1425 "~kotlin ~modula ~perl ~python ~rust ~sql<rst><ceos><u2><c13><c9>ada ~clojure "1426 "~eiffel ~fortran ~groovy ~java ~kotlin ~modula ~perl ~python ~rust "1427 "~sql<rst><ceos><u2><c14><c9>ada ~clojure ~eiffel ~fortran ~groovy ~java "1428 "~kotlin ~modula ~perl ~python ~rust ~sql<rst><ceos><u2><c9><c9>~ada ~clojure "1429 "~eiffel ~fortran ~groovy ~java ~kotlin ~modula ~perl ~python ~rust "1430 "~sql<rst><ceos><u2><c10><c9>~ada ~clojure ~eiffel ~fortran ~groovy ~java "1431 "~kotlin ~modula ~perl ~python ~rust ~sql<rst><ceos><u2><c9><c9>~ada ~clojure "1432 "~eiffel ~fortran ~groovy ~java ~kotlin ~modula ~perl ~python ~rust "1433 "~sql<rst><ceos><c14>\r\n"1434 "~ada ~clojure ~eiffel ~fortran ~groovy ~java ~kotlin ~modula ~perl ~python "1435 "~rust ~sql\r\n",1436 " ".join( _words_[::3] ) + "\n",1437 dimensions = ( 10, 40 )1438 )1439 def test_colors( self_ ):1440 self_.check_scenario(1441 "<up><cr><c-d>",1442 "<c9><black>color_black<rst> <red>color_red<rst> "1443 "<green>color_green<rst> <brown>color_brown<rst> <blue>color_blue<rst> "1444 "<magenta>color_magenta<rst> <cyan>color_cyan<rst> "1445 "<lightgray>color_lightgray<rst> <gray>color_gray<rst> "1446 "<brightred>color_brightred<rst> <brightgreen>color_brightgreen<rst> "1447 "<yellow>color_yellow<rst> <brightblue>color_brightblue<rst> "1448 "<brightmagenta>color_brightmagenta<rst> <brightcyan>color_brightcyan<rst> "1449 "<white>color_white<rst><ceos><c70><u2><c9><black>color_black<rst> "1450 "<red>color_red<rst> <green>color_green<rst> <brown>color_brown<rst> "1451 "<blue>color_blue<rst> <magenta>color_magenta<rst> <cyan>color_cyan<rst> "1452 "<lightgray>color_lightgray<rst> <gray>color_gray<rst> "1453 "<brightred>color_brightred<rst> <brightgreen>color_brightgreen<rst> "1454 "<yellow>color_yellow<rst> <brightblue>color_brightblue<rst> "1455 "<brightmagenta>color_brightmagenta<rst> <brightcyan>color_brightcyan<rst> "1456 "<white>color_white<rst><ceos><c70>\r\n"1457 "color_black color_red color_green color_brown color_blue color_magenta "1458 "color_cyan color_lightgray color_gray color_brightred color_brightgreen "1459 "color_yellow color_brightblue color_brightmagenta color_brightcyan "1460 "color_white\r\n",1461 "color_black color_red color_green color_brown color_blue color_magenta color_cyan color_lightgray"1462 " color_gray color_brightred color_brightgreen color_yellow color_brightblue color_brightmagenta color_brightcyan color_white\n"1463 )1464 def test_word_break_characters( self_ ):1465 self_.check_scenario(1466 "<up><c-left>x<c-left><c-left>x<c-left><c-left>x<c-left><c-left>x<c-left><c-left>x<c-left><c-left>x<cr><c-d>",1467 "<c9>one_two three-four five_six "1468 "seven-eight<rst><ceos><c48><c9>one_two three-four five_six "1469 "seven-eight<rst><ceos><c43><c9>one_two three-four five_six "1470 "seven-xeight<rst><ceos><c44><c9>one_two three-four five_six "1471 "seven-xeight<rst><ceos><c43><c9>one_two three-four five_six "1472 "seven-xeight<rst><ceos><c37><c9>one_two three-four five_six "1473 "xseven-xeight<rst><ceos><c38><c9>one_two three-four five_six "1474 "xseven-xeight<rst><ceos><c37><c9>one_two three-four five_six "1475 "xseven-xeight<rst><ceos><c28><c9>one_two three-four xfive_six "1476 "xseven-xeight<rst><ceos><c29><c9>one_two three-four xfive_six "1477 "xseven-xeight<rst><ceos><c28><c9>one_two three-four xfive_six "1478 "xseven-xeight<rst><ceos><c23><c9>one_two three-xfour xfive_six "1479 "xseven-xeight<rst><ceos><c24><c9>one_two three-xfour xfive_six "1480 "xseven-xeight<rst><ceos><c23><c9>one_two three-xfour xfive_six "1481 "xseven-xeight<rst><ceos><c17><c9>one_two xthree-xfour xfive_six "1482 "xseven-xeight<rst><ceos><c18><c9>one_two xthree-xfour xfive_six "1483 "xseven-xeight<rst><ceos><c17><c9>one_two xthree-xfour xfive_six "1484 "xseven-xeight<rst><ceos><c9><c9>xone_two xthree-xfour xfive_six "1485 "xseven-xeight<rst><ceos><c10><c9>xone_two xthree-xfour xfive_six "1486 "xseven-xeight<rst><ceos><c54>\r\n"1487 "xone_two xthree-xfour xfive_six xseven-xeight\r\n",1488 "one_two three-four five_six seven-eight\n",1489 command = ReplxxTests._cSample_ + " q1 'w \t-'"1490 )1491 self_.check_scenario(1492 "<up><c-left>x<c-left><c-left>x<c-left><c-left>x<c-left><c-left>x<c-left><c-left>x<c-left><c-left>x<cr><c-d>",1493 "<c9>one_two three-four five_six "1494 "seven-eight<rst><ceos><c48><c9>one_two three-four five_six "1495 "seven-eight<rst><ceos><c37><c9>one_two three-four five_six "1496 "xseven-eight<rst><ceos><c38><c9>one_two three-four five_six "1497 "xseven-eight<rst><ceos><c37><c9>one_two three-four five_six "1498 "xseven-eight<rst><ceos><c33><c9>one_two three-four five_xsix "1499 "xseven-eight<rst><ceos><c34><c9>one_two three-four five_xsix "1500 "xseven-eight<rst><ceos><c33><c9>one_two three-four five_xsix "1501 "xseven-eight<rst><ceos><c28><c9>one_two three-four xfive_xsix "1502 "xseven-eight<rst><ceos><c29><c9>one_two three-four xfive_xsix "1503 "xseven-eight<rst><ceos><c28><c9>one_two three-four xfive_xsix "1504 "xseven-eight<rst><ceos><c17><c9>one_two xthree-four xfive_xsix "1505 "xseven-eight<rst><ceos><c18><c9>one_two xthree-four xfive_xsix "1506 "xseven-eight<rst><ceos><c17><c9>one_two xthree-four xfive_xsix "1507 "xseven-eight<rst><ceos><c13><c9>one_xtwo xthree-four xfive_xsix "1508 "xseven-eight<rst><ceos><c14><c9>one_xtwo xthree-four xfive_xsix "1509 "xseven-eight<rst><ceos><c13><c9>one_xtwo xthree-four xfive_xsix "1510 "xseven-eight<rst><ceos><c9><c9>xone_xtwo xthree-four xfive_xsix "1511 "xseven-eight<rst><ceos><c10><c9>xone_xtwo xthree-four xfive_xsix "1512 "xseven-eight<rst><ceos><c54>\r\n"1513 "xone_xtwo xthree-four xfive_xsix xseven-eight\r\n",1514 "one_two three-four five_six seven-eight\n",1515 command = ReplxxTests._cSample_ + " q1 'w \t_'"1516 )1517 def test_no_color( self_ ):1518 self_.check_scenario(1519 "<up> X<cr><c-d>",1520 "<c9>color_black color_red color_green color_brown color_blue "1521 "color_magenta color_cyan color_lightgray color_gray color_brightred "1522 "color_brightgreen color_yellow color_brightblue color_brightmagenta "1523 "color_brightcyan color_white<ceos><c70><u2><c9>color_black color_red "1524 "color_green color_brown color_blue color_magenta color_cyan color_lightgray "1525 "color_gray color_brightred color_brightgreen color_yellow color_brightblue "1526 "color_brightmagenta color_brightcyan color_white "1527 "<ceos><c71><u2><c9>color_black color_red color_green color_brown color_blue "1528 "color_magenta color_cyan color_lightgray color_gray color_brightred "1529 "color_brightgreen color_yellow color_brightblue color_brightmagenta "1530 "color_brightcyan color_white X<ceos><c72><u2><c9>color_black color_red "1531 "color_green color_brown color_blue color_magenta color_cyan color_lightgray "1532 "color_gray color_brightred color_brightgreen color_yellow color_brightblue "1533 "color_brightmagenta color_brightcyan color_white X<ceos><c72>\r\n"1534 "color_black color_red color_green color_brown color_blue color_magenta "1535 "color_cyan color_lightgray color_gray color_brightred color_brightgreen "1536 "color_yellow color_brightblue color_brightmagenta color_brightcyan "1537 "color_white X\r\n",1538 "color_black color_red color_green color_brown color_blue color_magenta color_cyan color_lightgray"1539 " color_gray color_brightred color_brightgreen color_yellow color_brightblue color_brightmagenta color_brightcyan color_white\n",1540 command = ReplxxTests._cSample_ + " q1 m1"1541 )1542 def test_backspace_long_line_on_small_term( self_ ):1543 self_.check_scenario(1544 "<cr><cr><cr><up><backspace><backspace><backspace><backspace><backspace><backspace><backspace><backspace><cr><c-d>",1545 "<c9><ceos><c9>\r\n"1546 "<brightgreen>replxx<rst>> <c9><ceos><c9>\r\n"1547 "<brightgreen>replxx<rst>> <c9><ceos><c9>\r\n"1548 "<brightgreen>replxx<rst>> "1549 "<c9>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa<rst><ceos><c14><u1><c9>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa<rst><ceos><c13><u1><c9>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa<rst><ceos><c12><u1><c9>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa<rst><ceos><c11><u1><c9>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa<rst><ceos><c10><u1><c9>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa<rst><ceos><c9><u1><c9>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa<rst><ceos><c8><u1><c9>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa<rst><ceos><c7><u1><c9>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa<rst><ceos><c6><u1><c9>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa<rst><ceos><c6>\r\n"1550 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\r\n",1551 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n",1552 dimensions = ( 10, 40 )1553 )1554 self_.check_scenario(1555 "<cr><cr><cr><up><backspace><backspace><backspace><backspace><backspace><backspace><cr><c-d>",1556 "<c9><ceos><c9>\r\n"1557 "<brightgreen>replxx<rst>> <c9><ceos><c9>\r\n"1558 "<brightgreen>replxx<rst>> <c9><ceos><c9>\r\n"1559 "<brightgreen>replxx<rst>> <c9>a qu ite lo ng li ne of sh ort wo rds wi "1560 "ll te st cu rs or mo ve me nt<rst><ceos><c39><u1><c9>a qu ite lo "1561 "ng li ne of sh ort wo rds wi ll te st cu rs or mo ve me "1562 "n<rst><ceos><c38><u1><c9>a qu ite lo ng li ne of sh ort wo rds wi "1563 "ll te st cu rs or mo ve me <rst><ceos><c37><u1><c9>a qu ite lo ng "1564 "li ne of sh ort wo rds wi ll te st cu rs or mo ve "1565 "me<rst><ceos><c36><u1><c9>a qu ite lo ng li ne of sh ort wo rds "1566 "wi ll te st cu rs or mo ve m<rst><ceos><c35><u1><c9>a qu ite lo "1567 "ng li ne of sh ort wo rds wi ll te st cu rs or mo ve "1568 "<rst><ceos><c34><u1><c9>a qu ite lo ng li ne of sh ort wo rds wi "1569 "ll te st cu rs or mo ve<rst><ceos><c33><u1><c9>a qu ite lo ng li "1570 "ne of sh ort wo rds wi ll te st cu rs or mo ve<rst><ceos><c33>\r\n"1571 "a qu ite lo ng li ne of sh ort wo rds wi ll te st cu rs or mo ve\r\n",1572 "a qu ite lo ng li ne of sh ort wo rds wi ll te st cu rs or mo ve me nt\n",1573 dimensions = ( 10, 40 )1574 )1575 def test_reverse_history_search_on_max_match( self_ ):1576 self_.check_scenario(1577 "<up><c-r><cr><c-d>",1578 "<c9>aaaaaaaaaaaaaaaaaaaaa<rst><ceos><c30><c1><ceos><c1><ceos>(reverse-i-search)`': "1579 "aaaaaaaaaaaaaaaaaaaaa<c44><c1><ceos><brightgreen>replxx<rst>> "1580 "aaaaaaaaaaaaaaaaaaaaa<c30><c9>aaaaaaaaaaaaaaaaaaaaa<rst><ceos><c30>\r\n"1581 "aaaaaaaaaaaaaaaaaaaaa\r\n",1582 "aaaaaaaaaaaaaaaaaaaaa\n"1583 )1584 def test_no_terminal( self_ ):1585 res = subprocess.run( [ ReplxxTests._cSample_, "q1" ], input = b"replxx FTW!\n", stdout = subprocess.PIPE, stderr = subprocess.PIPE )1586 self_.assertSequenceEqual( res.stdout, b"starting...\nreplxx FTW!\n\nExiting Replxx\n" )1587 def test_async_print( self_ ):1588 self_.check_scenario(1589 [ "a", "b", "c", "d", "e", "f<cr><c-d>" ], [1590 "<c1><ceos>0\r\n"1591 "<brightgreen>replxx<rst>> "1592 "<c9><ceos><c9><c9>a<rst><ceos><c10><c9>ab<rst><ceos><c11><c1><ceos>1\r\n"1593 "<brightgreen>replxx<rst>> "1594 "<c9>ab<rst><ceos><c11><c9>abc<rst><ceos><c12><c9>abcd<rst><ceos><c13><c1><ceos>2\r\n"1595 "<brightgreen>replxx<rst>> "1596 "<c9>abcd<rst><ceos><c13><c9>abcde<rst><ceos><c14><c9>abcdef<rst><ceos><c15><c9>abcdef<rst><ceos><c15>\r\n"1597 "abcdef\r\n",1598 "<c1><ceos>0\r\n"1599 "<brightgreen>replxx<rst>> "1600 "<c9>a<rst><ceos><c10><c9>ab<rst><ceos><c11><c1><ceos>1\r\n"1601 "<brightgreen>replxx<rst>> "1602 "<c9>ab<rst><ceos><c11><c9>abc<rst><ceos><c12><c9>abcd<rst><ceos><c13><c1><ceos>2\r\n"1603 "<brightgreen>replxx<rst>> "1604 "<c9>abcd<rst><ceos><c13><c9>abcde<rst><ceos><c14><c9>abcdef<rst><ceos><c15><c9>abcdef<rst><ceos><c15>\r\n"1605 "abcdef\r\n",1606 ],1607 command = [ ReplxxTests._cxxSample_, "" ],1608 pause = 0.51609 )1610 self_.check_scenario(1611 [ "<up>", "a", "b", "c", "d", "e", "f<cr><c-d>" ], [1612 "<c1><ceos>0\r\n"1613 "<brightgreen>replxx<rst>> <c9><ceos><c9><c9>a very long line of "1614 "user input, wider then current terminal, the line is wrapped: "1615 "<rst><ceos><c11><u2><c9>a very long line of user input, wider then current "1616 "terminal, the line is wrapped: a<rst><ceos><c12><u2><c1><ceos>1\r\n"1617 "<brightgreen>replxx<rst>> \r\n"1618 "\r\n"1619 "<u2><c9>a very long line of user input, wider then current terminal, "1620 "the line is wrapped: a<rst><ceos><c12><u2><c9>a very long line of user "1621 "input, wider then current terminal, the line is wrapped: "1622 "ab<rst><ceos><c13><u2><c9>a very long line of user input, wider then current "1623 "terminal, the line is wrapped: abc<rst><ceos><c14><u2><c1><ceos>2\r\n"1624 "<brightgreen>replxx<rst>> \r\n"1625 "\r\n"1626 "<u2><c9>a very long line of user input, wider then current terminal, "1627 "the line is wrapped: abc<rst><ceos><c14><u2><c9>a very long line of user "1628 "input, wider then current terminal, the line is wrapped: "1629 "abcd<rst><ceos><c15><u2><c9>a very long line of user input, wider then "1630 "current terminal, the line is wrapped: abcde<rst><ceos><c16><u2><c1><ceos>3\r\n"1631 "<brightgreen>replxx<rst>> \r\n"1632 "\r\n"1633 "<u2><c9>a very long line of user input, wider then current terminal, "1634 "the line is wrapped: abcde<rst><ceos><c16><u2><c9>a very long line of user "1635 "input, wider then current terminal, the line is wrapped: "1636 "abcdef<rst><ceos><c17><u2><c9>a very long line of user input, wider then "1637 "current terminal, the line is wrapped: abcdef<rst><ceos><c17>\r\n"1638 "a very long line of user input, wider then current terminal, the line is "1639 "wrapped: abcdef\r\n",1640 "<c1><ceos>0\r\n"1641 "<brightgreen>replxx<rst>> <c9><ceos><c9><c9>a very long line of user input, "1642 "wider then current terminal, the line is wrapped: <rst><ceos><c11><u2><c9>a "1643 "very long line of user input, wider then current terminal, the line is "1644 "wrapped: a<rst><ceos><c12><u2><c1><ceos>1\r\n"1645 "<brightgreen>replxx<rst>> \r\n"1646 "\r\n"1647 "<u2><c9>a very long line of user input, wider then current terminal, the "1648 "line is wrapped: a<rst><ceos><c12><u2><c9>a very long line of user input, "1649 "wider then current terminal, the line is wrapped: "1650 "ab<rst><ceos><c13><u2><c9>a very long line of user input, wider then current "1651 "terminal, the line is wrapped: abc<rst><ceos><c14><u2><c1><ceos>2\r\n"1652 "<brightgreen>replxx<rst>> \r\n"1653 "\r\n"1654 "<u2><c9>a very long line of user input, wider then current terminal, the "1655 "line is wrapped: abc<rst><ceos><c14><u2><c9>a very long line of user input, "1656 "wider then current terminal, the line is wrapped: "1657 "abcd<rst><ceos><c15><u2><c1><ceos>3\r\n"1658 "<brightgreen>replxx<rst>> \r\n"1659 "\r\n"1660 "<u2><c9>a very long line of user input, wider then current terminal, the "1661 "line is wrapped: abcd<rst><ceos><c15><u2><c9>a very long line of user input, "1662 "wider then current terminal, the line is wrapped: "1663 "abcde<rst><ceos><c16><u2><c9>a very long line of user input, wider then "1664 "current terminal, the line is wrapped: abcdef<rst><ceos><c17><u2><c9>a very "1665 "long line of user input, wider then current terminal, the line is wrapped: "1666 "abcdef<rst><ceos><c17>\r\n"1667 "a very long line of user input, wider then current terminal, the line is "1668 "wrapped: abcdef\r\n",1669 "<c1><ceos>0\r\n"1670 "<brightgreen>replxx<rst>> <c9>a very long line of user input, wider then "1671 "current terminal, the line is wrapped: <rst><ceos><c11><u2><c9>a very long "1672 "line of user input, wider then current terminal, the line is wrapped: "1673 "a<rst><ceos><c12><u2><c1><ceos>1\r\n"1674 "<brightgreen>replxx<rst>> \r\n"1675 "\r\n"1676 "<u2><c9>a very long line of user input, wider then current terminal, the "1677 "line is wrapped: a<rst><ceos><c12><u2><c9>a very long line of user input, "1678 "wider then current terminal, the line is wrapped: "1679 "ab<rst><ceos><c13><u2><c9>a very long line of user input, wider then current "1680 "terminal, the line is wrapped: abc<rst><ceos><c14><u2><c1><ceos>2\r\n"1681 "<brightgreen>replxx<rst>> \r\n"1682 "\r\n"1683 "<u2><c9>a very long line of user input, wider then current terminal, the "1684 "line is wrapped: abc<rst><ceos><c14><u2><c9>a very long line of user input, "1685 "wider then current terminal, the line is wrapped: "1686 "abcd<rst><ceos><c15><u2><c1><ceos>3\r\n"1687 "<brightgreen>replxx<rst>> \r\n"1688 "\r\n"1689 "<u2><c9>a very long line of user input, wider then current terminal, the "1690 "line is wrapped: abcd<rst><ceos><c15><u2><c9>a very long line of user input, "1691 "wider then current terminal, the line is wrapped: "1692 "abcde<rst><ceos><c16><u2><c9>a very long line of user input, wider then "1693 "current terminal, the line is wrapped: abcdef<rst><ceos><c17><u2><c9>a very "1694 "long line of user input, wider then current terminal, the line is wrapped: "1695 "abcdef<rst><ceos><c17>\r\n"1696 "a very long line of user input, wider then current terminal, the line is "1697 "wrapped: abcdef\r\n"1698 ],1699 "a very long line of user input, wider then current terminal, the line is wrapped: \n",1700 command = [ ReplxxTests._cxxSample_, "" ],1701 dimensions = ( 10, 40 ),1702 pause = 0.51703 )1704 def test_async_emulate_key_press( self_ ):1705 self_.check_scenario(1706 [ "a", "b", "c", "d", "e", "f<cr><c-d>" ], [1707 "<c9><yellow>1<rst><ceos><c10><c9><yellow>1<rst>a"1708 "<rst><ceos><c11><c9><yellow>1<rst>ab<rst><ceos><c12><c9><yellow>1<rst>ab"1709 "<yellow>2<rst><ceos><c13><c9><yellow>1<rst>ab<yellow>2"1710 "<rst>c<rst><ceos><c14><c9><yellow>1<rst>ab<yellow>2"1711 "<rst>cd<rst><ceos><c15><c9><yellow>1<rst>ab<yellow>2<rst>cd<yellow>3"1712 "<rst><ceos><c16><c9><yellow>1<rst>ab<yellow>2<rst>cd<yellow>3<rst>e"1713 "<rst><ceos><c17><c9><yellow>1<rst>ab<yellow>2<rst>cd<yellow>3<rst>ef"1714 "<rst><ceos><c18><c9><yellow>1<rst>ab<yellow>2<rst>cd<yellow>3<rst>ef<rst><ceos><c18>\r\n"1715 "1ab2cd3ef\r\n",1716 "<c9><yellow>1<rst>a<rst><ceos><c11><c9><yellow>1<rst>ab"1717 "<rst><ceos><c12><c9><yellow>1<rst>ab<yellow>2<rst><ceos><c13><c9><yellow>1<rst>ab"1718 "<yellow>2<rst>c<rst><ceos><c14><c9><yellow>1<rst>ab<yellow>2<rst>cd<rst><ceos><c15>"1719 "<c9><yellow>1<rst>ab<yellow>2<rst>cd<yellow>3<rst><ceos><c16><c9><yellow>1<rst>ab"1720 "<yellow>2<rst>cd<yellow>3<rst>e<rst><ceos><c17><c9><yellow>1<rst>ab<yellow>2<rst>cd"1721 "<yellow>3<rst>ef<rst><ceos><c18><c9><yellow>1<rst>ab<yellow>2<rst>cd<yellow>3<rst>ef<rst><ceos><c18>\r\n"1722 "1ab2cd3ef\r\n"1723 ],1724 command = [ ReplxxTests._cxxSample_, "123456" ],1725 pause = 0.51726 )1727 def test_special_keys( self_ ):1728 self_.check_scenario(1729 "<f1><f2><f3><f4><f5><f6><f7><f8><f9><f10><f11><f12>"1730 "<s-f1><s-f2><s-f3><s-f4><s-f5><s-f6><s-f7><s-f8><s-f9><s-f10><s-f11><s-f12>"1731 "<c-f1><c-f2><c-f3><c-f4><c-f5><c-f6><c-f7><c-f8><c-f9><c-f10><c-f11><c-f12>"1732 "<s-tab><s-left><s-right><s-up><s-down>"1733 "<s-home><s-end><c-home><c-end><c-pgup><c-pgdown>"1734 "<cr><c-d>",1735 "<c1><ceos><F1>\r\n"1736 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><F2>\r\n"1737 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><F3>\r\n"1738 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><F4>\r\n"1739 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><F5>\r\n"1740 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><F6>\r\n"1741 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><F7>\r\n"1742 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><F8>\r\n"1743 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><F9>\r\n"1744 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><F10>\r\n"1745 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><F11>\r\n"1746 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><F12>\r\n"1747 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><S-F1>\r\n"1748 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><S-F2>\r\n"1749 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><S-F3>\r\n"1750 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><S-F4>\r\n"1751 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><S-F5>\r\n"1752 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><S-F6>\r\n"1753 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><S-F7>\r\n"1754 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><S-F8>\r\n"1755 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><S-F9>\r\n"1756 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><S-F10>\r\n"1757 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><S-F11>\r\n"1758 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><S-F12>\r\n"1759 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><C-F1>\r\n"1760 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><C-F2>\r\n"1761 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><C-F3>\r\n"1762 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><C-F4>\r\n"1763 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><C-F5>\r\n"1764 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><C-F6>\r\n"1765 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><C-F7>\r\n"1766 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><C-F8>\r\n"1767 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><C-F9>\r\n"1768 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><C-F10>\r\n"1769 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><C-F11>\r\n"1770 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><C-F12>\r\n"1771 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><S-Tab>\r\n"1772 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><S-Left>\r\n"1773 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><S-Right>\r\n"1774 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><S-Up>\r\n"1775 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><S-Down>\r\n"1776 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><S-Home>\r\n"1777 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><S-End>\r\n"1778 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><C-Home>\r\n"1779 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><C-End>\r\n"1780 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><C-PgUp>\r\n"1781 "<brightgreen>replxx<rst>> <c9><ceos><c9><c1><ceos><C-PgDn>\r\n"1782 "<brightgreen>replxx<rst>> <c9><ceos><c9><c9><ceos><c9>\r\n"1783 )1784 def test_overwrite_mode( self_ ):1785 self_.check_scenario(1786 "<up><home><right><right>XYZ<ins>012<ins>345<cr><c-d>",1787 "<c9>abcdefgh<rst><ceos><c17><c9>abcdefgh<rst><ceos><c9>"1788 "<c9>abcdefgh<rst><ceos><c10><c9>abcdefgh<rst><ceos><c11>"1789 "<c9>abXcdefgh<rst><ceos><c12><c9>abXYcdefgh<rst><ceos><c13>"1790 "<c9>abXYZcdefgh<rst><ceos><c14><c9>abXYZ<yellow>0<rst>defgh<rst><ceos><c15>"1791 "<c9>abXYZ<yellow>01<rst>efgh<rst><ceos><c16><c9>abXYZ<yellow>012<rst>fgh<rst><ceos><c17>"1792 "<c9>abXYZ<yellow>0123<rst>fgh<rst><ceos><c18><c9>abXYZ<yellow>01234<rst>fgh<rst><ceos><c19>"1793 "<c9>abXYZ<yellow>012345<rst>fgh<rst><ceos><c20><c9>abXYZ<yellow>012345<rst>fgh<rst><ceos><c23>\r\n"1794 "abXYZ012345fgh\r\n",1795 "abcdefgh\n"1796 )1797 def test_verbatim_insert( self_ ):1798 self_.check_scenario(1799 ["<c-v>", rapid( "<ins>" ), "<cr><c-d>"],1800 "<c9>^[<brightmagenta>[<yellow>2<rst>~<rst><ceos><c14><c9>^[<brightmagenta>[<yellow>2<rst>~<rst><ceos><c14>\r\n"1801 "<ins-key>\r\n"1802 )1803 def test_hint_delay( self_ ):1804 self_.check_scenario(1805 ["han", "<cr><c-d>"],1806 "<c9>h<rst><ceos><c10><c9>ha<rst><ceos><c11><c9>han<rst><ceos><c12><c9>han<rst><ceos>\r\n"1807 " <gray>hans<rst>\r\n"1808 " <gray>hansekogge<rst><u2><c12><c9>han<rst><ceos><c12>\r\n"1809 "han\r\n",1810 command = [ ReplxxTests._cSample_, "q1", "H200" ]1811 )1812 def test_complete_next( self_ ):1813 self_.check_scenario(1814 "<up><c-n><c-n><c-p><c-p><c-p><cr><c-d>",1815 "<c9>color_<rst><ceos>\r\n"1816 " <gray>color_black<rst>\r\n"1817 " <gray>color_red<rst>\r\n"1818 " "1819 "<gray>color_green<rst><u3><c15><c9><black>color_black<rst><ceos><c20>"1820 "<c9><red>color_red<rst><ceos><c18><c9><black>color_black<rst><ceos><c20><c9>color_<rst><ceos>\r\n"1821 " <gray>color_black<rst>\r\n"1822 " <gray>color_red<rst>\r\n"1823 " "1824 "<gray>color_green<rst><u3><c15><c9><lightgray>color_normal<rst><ceos><c21><c9><lightgray>color_normal<rst><ceos><c21>\r\n"1825 "color_normal\r\n",1826 "color_\n"1827 )1828 self_.check_scenario(1829 "l<c-n><c-n><c-p><c-p><cr><c-d>",1830 "<c9>l<rst><ceos>\r\n"1831 " <gray>lc_ctype<rst>\r\n"1832 " <gray>lc_time<rst>\r\n"1833 " <gray>lc_messages<rst><u3><c10><c9>lc_<rst><ceos>\r\n"1834 " <gray>lc_ctype<rst>\r\n"1835 " <gray>lc_time<rst>\r\n"1836 " "1837 "<gray>lc_messages<rst><u3><c12><c9>lc_ctype<rst><ceos><c17><c9>lc_time<rst><ceos><c16><c9>lc_ctype<rst><ceos><c17><c9>lc_<rst><ceos>\r\n"1838 " <gray>lc_ctype<rst>\r\n"1839 " <gray>lc_time<rst>\r\n"1840 " <gray>lc_messages<rst><u3><c12><c9>lc_<rst><ceos><c12>\r\n"1841 "lc_\r\n",1842 command = [ ReplxxTests._cSample_, "xlc_ctype,lc_time,lc_messages,zoom", "I1", "q1" ]1843 )1844 self_.check_scenario(1845 "l<c-n><c-n><c-p><c-p><cr><c-d>",1846 "<c9>l<rst><ceos>\r\n"1847 " <gray>lc_ctype<rst>\r\n"1848 " <gray>lc_time<rst>\r\n"1849 " <gray>lc_messages<rst><u3><c10><c9>lc_<rst><ceos>\r\n"1850 " <gray>lc_ctype<rst>\r\n"1851 " <gray>lc_time<rst>\r\n"1852 " "1853 "<gray>lc_messages<rst><u3><c12><c9>lc_ctype<rst><ceos><c17><c9>lc_<rst><ceos>\r\n"1854 " <gray>lc_ctype<rst>\r\n"1855 " <gray>lc_time<rst>\r\n"1856 " "1857 "<gray>lc_messages<rst><u3><c12><c9>lc_messages<rst><ceos><c20><c9>lc_messages<rst><ceos><c20>\r\n"1858 "lc_messages\r\n",1859 command = [ ReplxxTests._cSample_, "xlc_ctype,lc_time,lc_messages,zoom", "I0", "q1" ]1860 )1861 def test_disabled_handlers( self_ ):1862 self_.check_scenario(1863 "<up><left><backspace>4<cr><c-d>",1864 "<c9>(+ 1 2)<rst><ceos><c16><c9><brightred>(<rst>+ 1 "1865 "2)<rst><ceos><c15><c9><brightred>(<rst>+ 1 "1866 ")<rst><ceos><c14><c9><brightred>(<rst>+ 1 "1867 "4)<rst><ceos><c15><c9><brightred>(<rst>+ 1 4)<rst><ceos><c16>\r\n"1868 "thanks for the input: (+ 1 4)\r\n",1869 "(+ 1 2)\r\n",1870 command = [ ReplxxTests._cSample_, "N", "S" ]1871 )1872 def test_state_manipulation( self_ ):1873 self_.check_scenario(1874 "<up><f2>~<cr><c-d>",1875 "<c9>replxx<rst><ceos><c15><c9>REPLXX<rst><ceos><c12><c9>REP~LXX<rst><ceos><c13><c9>REP~LXX<rst><ceos><c16>\r\n"1876 "REP~LXX\r\n",1877 "replxx\n",1878 command = [ ReplxxTests._cSample_, "q1" ]1879 )1880 def test_modify_callback( self_ ):1881 self_.check_scenario(1882 "<up><home><right><right>*<cr><c-d>",1883 "<c9>abcd<brightmagenta>12<rst><ceos><c15><c9>abcd<brightmagenta>12<rst><ceos><c9>"1884 "<c9>abcd<brightmagenta>12<rst><ceos><c10><c9>abcd<brightmagenta>12<rst><ceos><c11>"1885 "<c9>ababcd<brightmagenta>12<rst>cd<brightmagenta>12<rst><ceos><c15>"1886 "<c9>ababcd<brightmagenta>12<rst>cd<brightmagenta>12<rst><ceos><c21>\r\n"1887 "ababcd12cd12\r\n",1888 "abcd12\n",1889 command = [ ReplxxTests._cSample_, "q1", "M1" ]1890 )1891 def test_paste( self_ ):1892 self_.check_scenario(1893 rapid( "abcdef<cr><c-d>" ),1894 "<c9>a<rst><ceos><c10><c9>abcdef<rst><ceos><c15>\r\nabcdef\r\n"1895 )1896 def test_history_merge( self_ ):1897 with open( "replxx_history_alt.txt", "w" ) as f:1898 f.write(1899 "### 0000-00-00 00:00:00.001\n"1900 "one\n"1901 "### 0000-00-00 00:00:00.003\n"1902 "three\n"1903 "### 0000-00-00 00:00:00.005\n"1904 "other\n"1905 "### 0000-00-00 00:00:00.009\n"1906 "same\n"1907 "### 0000-00-00 00:00:00.017\n"1908 "seven\n"1909 )1910 f.close()1911 self_.check_scenario(1912 "<up><cr><c-d>",1913 "<c9><brightmagenta>.<rst>merge<rst><ceos><c15><c9><brightmagenta>.<rst>merge<rst><ceos><c15>\r\n",1914 "### 0000-00-00 00:00:00.002\n"1915 "two\n"1916 "### 0000-00-00 00:00:00.004\n"1917 "four\n"1918 "### 0000-00-00 00:00:00.006\n"1919 "same\n"1920 "### 0000-00-00 00:00:00.008\n"1921 "other\n"1922 "### 0000-00-00 00:00:00.018\n"1923 ".merge\n"1924 )1925 with open( "replxx_history_alt.txt", "r" ) as f:1926 data = f.read()1927 expected = (1928 "### 0000-00-00 00:00:00.001\n"1929 "one\n"1930 "### 0000-00-00 00:00:00.002\n"1931 "two\n"1932 "### 0000-00-00 00:00:00.003\n"1933 "three\n"1934 "### 0000-00-00 00:00:00.004\n"1935 "four\n"1936 "### 0000-00-00 00:00:00.008\n"1937 "other\n"1938 "### 0000-00-00 00:00:00.009\n"1939 "same\n"1940 "### 0000-00-00 00:00:00.017\n"1941 "seven\n"1942 "### "1943 )1944 self_.assertSequenceEqual( data[:-31], expected )1945 self_.assertSequenceEqual( data[-7:], ".merge\n" )1946 def test_history_save( self_ ):1947 with open( "replxx_history_alt.txt", "w" ) as f:1948 f.write(1949 "### 0000-00-00 00:00:00.001\n"1950 "one\n"1951 "### 0000-00-00 00:00:00.003\n"1952 "three\n"1953 "### 3000-00-00 00:00:00.005\n"1954 "other\n"1955 "### 3000-00-00 00:00:00.009\n"1956 "same\n"1957 "### 3000-00-00 00:00:00.017\n"1958 "seven\n"1959 )1960 f.close()1961 self_.check_scenario(1962 "zoom<cr>.save<cr><up><cr><c-d>",1963 "<c9>z<rst><ceos><c10><c9>zo<rst><ceos><c11><c9>zoo<rst><ceos><c12><c9>zoom<rst><ceos><c13><c9>zoom<rst><ceos><c13>\r\n"1964 "zoom\r\n"1965 "<brightgreen>replxx<rst>> "1966 "<c9><brightmagenta>.<rst><ceos><c10><c9><brightmagenta>.<rst>s<rst><ceos><c11><c9><brightmagenta>.<rst>sa<rst><ceos><c12><c9><brightmagenta>.<rst>sav<rst><ceos><c13><c9><brightmagenta>.<rst>save<rst><ceos><c14><c9><brightmagenta>.<rst>save<rst><ceos><c14>\r\n"1967 "<brightgreen>replxx<rst>> "1968 "<c9>zoom<rst><ceos><c13><c9>zoom<rst><ceos><c13>\r\n"1969 "zoom\r\n"1970 )1971 def test_bracketed_paste( self_ ):1972 self_.check_scenario(1973 "a0<paste-pfx>b1c2d3e<paste-sfx>4f<cr><c-d>",1974 "<c9>a<rst><ceos><c10>"1975 "<c9>a<brightmagenta>0<rst><ceos><c11>"1976 "<c9>a<brightmagenta>0<rst>b<brightmagenta>1<rst>c<brightmagenta>2<rst>d<brightmagenta>3<rst>e<rst><ceos><c18>"1977 "<c9>a<brightmagenta>0<rst>b<brightmagenta>1<rst>c<brightmagenta>2<rst>d<brightmagenta>3<rst>e<brightmagenta>4<rst><ceos><c19>"1978 "<c9>a<brightmagenta>0<rst>b<brightmagenta>1<rst>c<brightmagenta>2<rst>d<brightmagenta>3<rst>e<brightmagenta>4<rst>f<rst><ceos><c20>"1979 "<c9>a<brightmagenta>0<rst>b<brightmagenta>1<rst>c<brightmagenta>2<rst>d<brightmagenta>3<rst>e<brightmagenta>4<rst>f<rst><ceos><c20>\r\n"1980 "a0b1c2d3e4f\r\n",1981 command = [ ReplxxTests._cSample_, "q1" ]1982 )1983 self_.check_scenario(1984 "a0<paste-pfx>b1c2d3e<paste-sfx>4f<cr><c-d>",1985 "<c9>a<rst><ceos><c10>"1986 "<c9>a<brightmagenta>0<rst><ceos><c11>"1987 "<c9>a<brightmagenta>0<rst>b<brightmagenta>1<rst>c<brightmagenta>2<rst>d<brightmagenta>3<rst>e<rst><ceos><c18>"1988 "<c9>a<brightmagenta>0<rst>b<brightmagenta>1<rst>c<brightmagenta>2<rst>d<brightmagenta>3<rst>e<brightmagenta>4<rst><ceos><c19>"1989 "<c9>a<brightmagenta>0<rst>b<brightmagenta>1<rst>c<brightmagenta>2<rst>d<brightmagenta>3<rst>e<brightmagenta>4<rst>f<rst><ceos><c20>"1990 "<c9>a<brightmagenta>0<rst>b<brightmagenta>1<rst>c<brightmagenta>2<rst>d<brightmagenta>3<rst>e<brightmagenta>4<rst>f<rst><ceos><c20>\r\n"1991 "a0b1c2d3e4f\r\n",1992 command = [ ReplxxTests._cSample_, "q1", "B" ]1993 )1994 self_.check_scenario(1995 "a0<left><paste-pfx>/eb<paste-sfx><cr><paste-pfx>/db<paste-sfx><cr><paste-pfx>x<paste-sfx><cr><c-d>",1996 "<c9>a<rst><ceos><c10><c9>a<brightmagenta>0<rst><ceos><c11><c9>a<brightmagenta>0<rst><ceos><c10>"1997 "<c9>a/eb<brightmagenta>0<rst><ceos><c13><c9>a/eb<brightmagenta>0<rst><ceos><c14>\r\n"1998 "a/eb0\r\n"1999 "<brightgreen>replxx<rst>> <c9>/db<rst><ceos><c12><c9>/db<rst><ceos><c12>\r\n"2000 "/db\r\n"2001 "<brightgreen>replxx<rst>> <c9>x<rst><ceos><c10><c9>x<rst><ceos><c10>\r\n"2002 "x\r\n",2003 command = [ ReplxxTests._cSample_, "q1" ]2004 )2005def parseArgs( self, func, argv ):2006 global verbosity2007 res = func( self, argv )2008 verbosity = self.verbosity...

Full Screen

Full Screen

check_recordings.py

Source:check_recordings.py Github

copy

Full Screen

...46 print("small files:".rjust(25) + " ", end='')47 for sf in small_files:48 print(sf + ", ", end='')49 print()50def check_scenario(base: str, scenario: str):51 path = os.path.join(base, scenario + "runs/")52 if os.path.exists(path):53 num_files = len([f for f in os.listdir(path) if os.path.isfile(os.path.join(path, f))])54 expected_number = 1000 + 100 + 20 + 30 55 done = num_files / 4 / expected_number * 100.056 print(scenario[:-1].rjust(24) + ": ", end='')57 print(f"{done:.2f}%".rjust(7), end='')58 check_each_file(path)59 line = "-" * columns60 print(line)61if __name__ == '__main__':62 path = os.getcwd()63 while True:64 columns = int(os.popen('stty size', 'r').read().split()[1])65 os.system('clear')66 now = datetime.now() 67 print(f"--- Time: {now.strftime('%H:%M:%S')} ---")68 check_scenario(path, "Bruteforce_CWE-307/")69 check_scenario(path, "CVE-2012-2122/")70 check_scenario(path, "CVE-2014-0160/")71 check_scenario(path, "CVE-2017-12635_6/")72 check_scenario(path, "CVE-2017-7529/")73 check_scenario(path, "CVE-2018-3760/")74 check_scenario(path, "CVE-2019-5418/")75 check_scenario(path, "CVE-2020-13942/")76 check_scenario(path, "CVE-2020-23839/")77 check_scenario(path, "CVE-2020-9484/")78 check_scenario(path, "CWE-89-SQL-injection/")79 check_scenario(path, "EPS_CWE-434/")80 check_scenario(path, "Juice-Shop/")81 check_scenario(path, "PHP_CWE-434/")82 check_scenario(path, "ZipSlip/")...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run avocado automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful