diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 60cc2fa..00152a5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,7 @@ on: # Triggers the workflow on push or pull request events but only for the master branch push: branches: [ master ] + pull_request: # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -34,5 +35,5 @@ jobs: run: ./build-all.sh - name: Run regression tests - run: env SKIP=8bit_encoding ./tests.py + run: env SKIP=8bit_encoding,async ./tests.py -j 100 diff --git a/examples/cxx-api.cxx b/examples/cxx-api.cxx index fee8fa0..958d02c 100644 --- a/examples/cxx-api.cxx +++ b/examples/cxx-api.cxx @@ -12,6 +12,15 @@ #include #include +#ifndef _WIN32 +#include +#else +#include +#define STDIN_FILENO _fileno( stdin ) +#define STDOUT_FILENO _fileno( stdout ) +#define STDERR_FILENO _fileno( stderr ) +#endif + #include "replxx.hxx" #include "util.h" @@ -397,7 +406,7 @@ int main( int argc_, char** argv_ ) { } // init the repl - Replxx rx; + Replxx rx( std::cin, std::cout, STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO ); Tick tick( rx, keys, tickMessages, promptFan ); rx.install_window_change_handler(); @@ -419,7 +428,7 @@ int main( int argc_, char** argv_ ) { // set the callbacks using namespace std::placeholders; rx.set_completion_callback( std::bind( &hook_completion, _1, _2, cref( examples ), ignoreCase ) ); - rx.set_highlighter_callback( std::bind( &hook_color, _1, _2, cref( regex_color ), cref( word_color ) ) ); + rx.set_highlighter_callback( Replxx::highlighter_callback_t( std::bind( &hook_color, _1, _2, cref( regex_color ), cref( word_color ) ) ) ); rx.set_hint_callback( std::bind( &hook_hint, _1, _2, _3, cref( examples ), ignoreCase ) ); if ( promptInCallback ) { rx.set_modify_callback( std::bind( &hook_modify, _1, _2, &rx ) ); diff --git a/include/replxx.h b/include/replxx.h index fef0977..b02baa3 100644 --- a/include/replxx.h +++ b/include/replxx.h @@ -224,7 +224,7 @@ typedef struct ReplxxHistoryEntryTag { * * \return Replxx library resource holder. */ -// REPLXX_IMPEXP Replxx* replxx_init( void ); +REPLXX_IMPEXP Replxx* replxx_init( void ); /*! \brief Cleanup resources used by Replxx library. * diff --git a/src/replxx.cxx b/src/replxx.cxx index 3d5afe1..144587b 100644 --- a/src/replxx.cxx +++ b/src/replxx.cxx @@ -85,6 +85,7 @@ #include #include +#include #ifdef _WIN32 @@ -343,10 +344,10 @@ Replxx::Color rgb666( int red_, int green_, int blue_ ) { } -// ::Replxx* replxx_init() { -// typedef ::Replxx* replxx_data_t; -// return ( reinterpret_cast( new replxx::Replxx::ReplxxImpl( nullptr, nullptr, nullptr ) ) ); -// } +::Replxx* replxx_init() { + typedef ::Replxx* replxx_data_t; + return ( reinterpret_cast( new replxx::Replxx::ReplxxImpl( std::cin, std::cout, STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO ) ) ); +} void replxx_end( ::Replxx* replxx_ ) { delete reinterpret_cast( replxx_ ); diff --git a/tests.py b/tests.py index 4c65ab0..9fb83e1 100755 --- a/tests.py +++ b/tests.py @@ -6,8 +6,12 @@ import os import subprocess import signal +import sys +import tempfile import time +_TEST_BASE_CWD = os.path.abspath( os.path.dirname( __file__ ) or "." ) + keytab = { "": "\033[1~", "": "\033[1;2H", @@ -238,11 +242,35 @@ def rapid( item ): return r return list( map( Rapid, item ) ) +def _no_parallel( fn ): + """Mark a test as not safe to run inside the parallel pool. Such tests + depend on wall-clock scheduling (spinner ticks, async print interleaving) + and become unreliable when the host is saturated by other workers; the + parallel runner runs them sequentially after the pool drains.""" + fn._no_parallel = True + return fn + class ReplxxTests( unittest.TestCase ): _prompt_ = "\033\\[1;32mreplxx\033\\[0m> " - _cxxSample_ = "./build/debug/replxx-example-cxx-api" - _cSample_ = "./build/debug/replxx-example-c-api" - _end_ = "\r\nExiting Replxx\r\n" + _cxxSample_ = os.path.join( _TEST_BASE_CWD, "build/debug/replxx-example-cxx-api" ) + _cSample_ = os.path.join( _TEST_BASE_CWD, "build/debug/replxx-example-c-api" ) + # Allow any leftover CSI escape sequences (cursor moves, clear-to-EOS, + # color resets) that `replxx` may emit during shutdown between the + # final prompt redraw and the "Exiting Replxx" line - these appear or + # not depending on scheduling under heavy parallel load. + _end_ = "(?:\033\\[[0-9;]*[a-zA-Z])*\r\nExiting Replxx\r\n" + + def setUp( self_ ): + # Per-test tmpdir; binary uses it as cwd so each test has its own + # replxx_history.txt and friends. Required for parallel test runs. + self_._tmpdir = tempfile.mkdtemp( prefix = "replxx-test-" ) + self_._prev_cwd = os.getcwd() + os.chdir( self_._tmpdir ) + + def tearDown( self_ ): + os.chdir( self_._prev_cwd ) + import shutil + shutil.rmtree( self_._tmpdir, ignore_errors = True ) def send_str( self_, str_, intraKeyDelay_ ): if isinstance(str_, Rapid): self_._replxx.send( str_ ) @@ -311,21 +339,20 @@ def check_scenario( def test_unicode( self_ ): self_.check_scenario( "", - "a贸膮 熄 饟 髢攢 " + "replxx> a贸膮 熄 饟 髢攢 " "a贸膮 熄 饟 髢攢 \r\n" - "a贸膮 熄 饟 髢攢 \r\n", + "a贸膮 熄 饟 髢攢 \r\n", "a贸膮 熄 饟 髢攢 \n" ) self_.check_scenario( "a贸膮 熄 饟 髢攢 ", - "aa贸a贸膮a贸膮 " - "a贸膮 熄a贸膮 熄 " - "a贸膮 熄 饟a贸膮 熄 饟 " - "a贸膮 熄 饟 " - "a贸膮 熄 饟 髢攢a贸膮 熄 饟 髢攢 " - "a贸膮 熄 饟 髢攢 " - "a贸膮 熄 饟 髢攢 \r\n" + "aa贸a贸膮a贸膮 " + "a贸膮 熄a贸膮 熄 a贸膮 熄 饟" + "a贸膮 熄 饟 a贸膮 熄 饟 a贸膮 熄 饟 髢攢" + "a贸膮 熄 饟 髢攢 a贸膮 熄 饟 髢攢 " + "a贸膮 熄 饟 髢攢 \r\n" "a贸膮 熄 饟 髢攢 \r\n" + "" ) @unittest.skipIf( skip( "8bit_encoding" ), "broken platform" ) def test_8bit_encoding( self_ ): @@ -337,7 +364,7 @@ def test_8bit_encoding( self_ ): os.environ[LC_CTYPE] = "pl_PL.ISO-8859-2" self_.check_scenario( "", - "text ~贸~text ~贸~\r\ntext ~贸~\r\n", + "replxx> text ~贸~text ~贸~\r\ntext ~贸~\r\n", "text ~贸~\n", encoding = "iso-8859-2" ) @@ -348,217 +375,228 @@ def test_8bit_encoding( self_ ): def test_bad_term( self_ ): self_.check_scenario( "a line of text", - "a line of text\r\na line of text\r\n", + "a line of text\r\n" + "a line of text\r\n", term = "dumb" ) def test_ctrl_c( self_ ): self_.check_scenario( "abc", - "aababcabc^C\r" - "\r\n" + "aababcabc" + "^C\r\r\n" + "" ) def test_ctrl_z( self_ ): self_.check_scenario( "", - "threereplxx> " - "threethree\r\n" + "replxx> threereplxx> three" + "three\r\n" "three\r\n" + "" ) self_.check_scenario( "w", - "(reverse-i-search)`': " - "(reverse-i-search)`w': " - "two(reverse-i-search)`w': " - "tworeplxx> " - "twotwotwo\r\n" + "(reverse-i-search)`': (reverse-i-search)`w': two" + "(reverse-i-search)`w': tworeplxx> twotwo" + "two\r\n" "two\r\n" + "" ) def test_ctrl_l( self_ ): self_.check_scenario( "", "\r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> replxx> " - "", + "replxx> \r\n" + "replxx> \r\n" + "replxx> replxx> " + "", end = "\r\nExiting Replxx\r\n" ) self_.check_scenario( "", "\r\n" - "replxx> first " - "secondfirst " - "secondreplxx> " - "first secondfirst second\r\n" - "first second\r\n", + "replxx> replxx> first second" + "first secondreplxx> first second" + "first second\r\n" + "first second\r\n" + "", "first second\n" ) def test_backspace( self_ ): self_.check_scenario( "", - "one two threeone two " - "threeone tw threeone t " - "threeone threeone " - "threeone three\r\n" - "one three\r\n", + "replxx> one two threeone two three" + "one two threeone two threeone tw three" + "one t threeone threeone three" + "one three\r\n" + "one three\r\n" + "", "one two three\n" ) def test_delete( self_ ): self_.check_scenario( "", - "one two threeone two " - "threeone wo " - "threeone o threeone " - "threeone threeone three\r\n" - "one three\r\n", + "replxx> one two threeone two three" + "one two threeone wo threeone o three" + "one threeone threeone three\r\n" + "one three\r\n" + "", "one two three\n" ) def test_home_key( self_ ): self_.check_scenario( "abcz", - "aababcabczabczabc\r\n" + "aababcabc" + "zabczabc\r\n" "zabc\r\n" + "" ) def test_end_key( self_ ): self_.check_scenario( "abczq", - "aababcabczabczabczabcqzabcq\r\n" + "aababcabc" + "zabczabczabcq" + "zabcq\r\n" "zabcq\r\n" + "" ) def test_left_key( self_ ): self_.check_scenario( "abcxy", - "aababcabcabxcaybxcaybxc\r\n" + "aababcabc" + "abxcabxcabxcaybxc" + "aybxc\r\n" "aybxc\r\n" + "" ) def test_right_key( self_ ): self_.check_scenario( "abcxy", - "aababcabcaxbcaxbycaxbyc\r\n" + "aababcabc" + "abcaxbcaxbcaxbyc" + "axbyc\r\n" "axbyc\r\n" + "" ) def test_prev_word_key( self_ ): self_.check_scenario( "x", - "abc def ghiabc def ghiabc " - "xdef ghiabc xdef ghi\r\n" - "abc xdef ghi\r\n", + "replxx> abc def ghiabc def ghi" + "abc def ghiabc xdef ghiabc xdef ghi\r\n" + "abc xdef ghi\r\n" + "", "abc def ghi\n" ) self_.check_scenario( "xxxx", - "abc_def ghi_jkl mnl_opq rst_uvwabc_def ghi_jkl " - "mnl_opq rst_uvwabc_def ghi_jkl mnl_opq " - "rst_xuvw" - "abc_def ghi_jkl mnl_opq " - "xrst_xuvw" - "abc_def ghi_jkl xmnl_opq " - "xrst_xuvw" - "abc_def ghi_xjkl xmnl_opq " - "xrst_xuvwabc_def ghi_xjkl xmnl_opq " - "xrst_xuvw\r\n" - "abc_def ghi_xjkl xmnl_opq xrst_xuvw\r\n", - "abc_def ghi_jkl mnl_opq rst_uvw\r\n" + "replxx> abc_def ghi_jkl mnl_opq rst_uvw" + "abc_def ghi_jkl mnl_opq rst_uvwabc_def ghi_jkl mnl_opq rst_xuvw" + "abc_def ghi_jkl mnl_opq rst_xuvwabc_def ghi_jkl mnl_opq rst_xuvw" + "abc_def ghi_jkl mnl_opq xrst_xuvwabc_def ghi_jkl mnl_opq xrst_xuvw" + "abc_def ghi_jkl mnl_opq xrst_xuvw" + "abc_def ghi_jkl xmnl_opq xrst_xuvwabc_def ghi_jkl xmnl_opq xrst_xuvw" + "abc_def ghi_jkl xmnl_opq xrst_xuvw" + "abc_def ghi_xjkl xmnl_opq xrst_xuvwabc_def ghi_xjkl xmnl_opq xrst_xuvw" + "\r\n" + "abc_def ghi_xjkl xmnl_opq xrst_xuvw\r\n" + "", + "abc_def ghi_jkl mnl_opq rst_uvw\r\n" ) def test_next_word_key( self_ ): self_.check_scenario( "x", - "abc def ghiabc def " - "ghiabc defx ghiabc defx " - "ghi\r\n" - "abc defx ghi\r\n", + "replxx> abc def ghiabc def ghi" + "abc def ghiabc def ghiabc defx ghi" + "abc defx ghi\r\n" + "abc defx ghi\r\n" + "", "abc def ghi\n" ) self_.check_scenario( "xxxx", - "abc_def ghi_jkl mno_pqr stu_vwxabc_def ghi_jkl " - "mno_pqr stu_vwx" - "abcx_def ghi_jkl mno_pqr " - "stu_vwx" - "abcx_defx ghi_jkl mno_pqr " - "stu_vwx" - "abcx_defx ghi_jklx mno_pqr " - "stu_vwx" - "abcx_defx ghi_jklx mnox_pqr " - "stu_vwxabcx_defx ghi_jklx mnox_pqr " - "stu_vwx\r\n" - "abcx_defx ghi_jklx mnox_pqr stu_vwx\r\n", - "abc_def ghi_jkl mno_pqr stu_vwx\r\n" + "replxx> abc_def ghi_jkl mno_pqr stu_vwx" + "abc_def ghi_jkl mno_pqr stu_vwxabc_def ghi_jkl mno_pqr stu_vwx" + "abcx_def ghi_jkl mno_pqr stu_vwxabcx_def ghi_jkl mno_pqr stu_vwx" + "abcx_defx ghi_jkl mno_pqr stu_vwxabcx_defx ghi_jkl mno_pqr stu_vwx" + "abcx_defx ghi_jklx mno_pqr stu_vwx" + "abcx_defx ghi_jklx mno_pqr stu_vwxabcx_defx ghi_jklx mnox_pqr stu_vwx" + "abcx_defx ghi_jklx mnox_pqr stu_vwx\r\n" + "abcx_defx ghi_jklx mnox_pqr stu_vwx\r\n" + "", + "abc_def ghi_jkl mno_pqr stu_vwx\r\n" ) def test_hint_show( self_ ): self_.check_scenario( "co\r", - "cco\r\n" + "cco\r\n" " color_black\r\n" " color_red\r\n" - " color_greenco\r\n" + " color_greenco\r\n" "co\r\n" + "" ) self_.check_scenario( "", - "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz " - "color_brightgreenzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz " + "replxx> zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz " + "color_brightgreenzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz " "color_brightgreen\r\n" - "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz color_brightgreen\r\n", + "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz color_brightgreen\r\n", "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz color_brightgreen\n", dimensions = ( 16, 64 ) ) def test_hint_scroll_down( self_ ): self_.check_scenario( "co", - "cco\r\n" + "cco\r\n" " color_black\r\n" " color_red\r\n" - " " - "color_greencolor_black\r\n" + " color_greencolor_black\r\n" " color_red\r\n" " color_green\r\n" - " " - "color_browncolor_red\r\n" + " color_browncolor_red\r\n" " color_green\r\n" " color_brown\r\n" - " " - "color_bluecolor_redcolor_red\r\n" + " color_bluecolor_red" + "color_red\r\n" "color_red\r\n" + "" ) def test_hint_scroll_up( self_ ): self_.check_scenario( "co", - "cco\r\n" + "cco\r\n" " color_black\r\n" " color_red\r\n" - " " - "color_greencolor_white\r\n" + " color_greencolor_white\r\n" " co\r\n" " color_black\r\n" - " " - "color_redcolor_brightcyan\r\n" + " color_redcolor_brightcyan\r\n" " color_white\r\n" " co\r\n" - " " - "color_blackcolor_brightcyancolor_brightcyan\r\n" + " color_blackcolor_brightcyan" + "color_brightcyan\r\n" "color_brightcyan\r\n" + "" ) def test_overlong_hint( self_ ): self_.check_scenario( "", - "zzzzzzzzzzzzzzzzzzzzzzzzz color_br\r\n" + "replxx> zzzzzzzzzzzzzzzzzzzzzzzzz color_br\r\n" " color_brown\r\n" " color_brightre\r\n" - " color_brightgr\r\n" + " color_brightgr\r\n" "zzzzzzzzzzzzzzzzzzzzzzzzz color_brown\r\n" " color_brightre\r\n" " color_brightgr\r\n" - " color_brightbl\r\n" - "zzzzzzzzzzzzzzzzzzzzzzzzz " - "color_brightre\r\n" + " color_brightbl\r\n" + "zzzzzzzzzzzzzzzzzzzzzzzzz color_brightred\r\n" " color_brightgr\r\n" " color_brightbl\r\n" - " color_brightma\r\n" - "zzzzzzzzzzzzzzzzzzzzzzzzz " - "color_brightredzzzzzzzzzzzzzzzzzzzzzzzzz " - "color_brightred\r\n" - "zzzzzzzzzzzzzzzzzzzzzzzzz color_brightred\r\n", + " color_brightma\r\n" + "zzzzzzzzzzzzzzzzzzzzzzzzz color_brightred" + "zzzzzzzzzzzzzzzzzzzzzzzzz color_brightred\r\n" + "zzzzzzzzzzzzzzzzzzzzzzzzz color_brightred\r\n" + "", #replxx> # "zzzzzzzzzzzzzzzzzzzzzzzzz color_br\n",################### dimensions = ( 16, 48 ) @@ -566,8 +604,13 @@ def test_overlong_hint( self_ ): def test_history( self_ ): self_.check_scenario( "four", - "threetwoonetwothreeffofoufourfour\r\n" + "replxx> threereplxx> two" + "replxx> onereplxx" + "> tworeplxx> three" + "replxx> ffo" + "foufourfour\r\n" "four\r\n" + "" ) with open( "replxx_history.txt", "rb" ) as f: data = f.read().decode() @@ -576,63 +619,83 @@ def test_history( self_ ): def test_paren_matching( self_ ): self_.check_scenario( "ab(cd)ef", - "aabab(ab(cab(cdab(cd)ab(cd)eab(cd)efab(cd)efab(cd)efab(cd)efab(cd)efab(cd)efab(cd)ef\r\n" + "aabab(" + "ab(cab(cd" + "ab(cd)ab(" + "cd)eab(cd)" + "efab(cd)ef" + "ab(cd)efab(" + "cd)efab(cd)ef" + "ab(cd)ef" + "ab(cd)efab(" + "cd)efab(cd)ef" + "\r\n" "ab(cd)ef\r\n" + "" ) def test_paren_not_matched( self_ ): self_.check_scenario( "a(b[c)d", - "aa(a(ba(b[a(b[ca(b[c)a(b[c)da(b[c)da(b[c)da(b[c)da(b[c)da(b[c)da(b[c)da(b[c)da(b[c)d\r\n" + "aa(a(b" + "a(b[" + "a(b[ca(" + "b[c)a(" + "b[c)da(" + "b[c)da(" + "b[c)da(" + "b[c)da(" + "b[c)da(" + "b[c)da(" + "b[c)da(" + "b[c)da(" + "b[c)d\r\n" "a(b[c)d\r\n" + "" ) def test_tab_completion( self_ ): self_.check_scenario( "cobrib", - "cco\r\n" + "cco\r\n" " color_black\r\n" " color_red\r\n" - " color_greencolor_\r\n" + " color_greencolor_\r\n" " color_black\r\n" " color_red\r\n" - " color_greencolor_\r\n" - "color_black " - "color_cyan " - "color_brightblue\r\n" - "color_red " - "color_lightgray " - "color_brightmagenta\r\n" - "color_green " - "color_gray " - "color_brightcyan\r\n" - "color_brown " - "color_brightred color_white\r\n" - "color_blue " - "color_brightgreen\r\n" + " color_greencolor_\r\n" + "color_black color_" + "cyan color_brightblue\r\n" + "color_red color_" + "lightgray color_brightmagenta\r\n" + "color_green color_" + "gray color_brightcyan\r\n" + "color_brown color_brightred" + " color_white\r\n" + "color_blue color_brightgreen\r\n" "color_magenta color_yellow\r\n" "replxx> color_\r\n" " color_black\r\n" " color_red\r\n" - " color_greencolor_b\r\n" + " color_greencolor_b\r\n" " color_black\r\n" " color_brown\r\n" - " color_bluecolor_br\r\n" + " color_bluecolor_br\r\n" " color_brown\r\n" " color_brightred\r\n" - " " - "color_brightgreencolor_bri\r\n" + " color_brightgreencolor_bri\r\n" " color_brightred\r\n" " color_brightgreen\r\n" - " " - "color_brightbluecolor_bright\r\n" + " color_brightbluecolor_bright\r\n" " color_brightred\r\n" " color_brightgreen\r\n" - " " - "color_brightbluecolor_brightbluecolor_brightbluecolor_brightblue\r\n" + " color_brightbluecolor_brightblue" + "color_brightbluecolor_brightblue" + "\r\n" "color_brightblue\r\n" + "" ) self_.check_scenario( "n", - "nn\r\nn\r\n", + "nn\r\nn\r\n", dimensions = ( 4, 32 ), command = [ ReplxxTests._cSample_, "q1", "e0" ] ) @@ -642,29 +705,26 @@ def test_tab_completion( self_ ): "db\r\n" "hello\r\n" "hallo\r\n" - "--More--\r" - "\t\t\t\t\r" - "replxx> " - "\r\n", + "--More--\r\t\t\t\t\rreplxx> \r\n" + "", dimensions = ( 4, 24 ), command = ReplxxTests._cSample_ + " q1 e1" ) self_.check_scenario( "co", - "abcd()" - "abcd()" - "cabcd()" - "coabcd()" - "color_abcd()" - "color_abcd()\r\n" - "color_abcd()\r\n", + "replxx> abcd()" + "abcd()cabcd()" + "coabcd()color_abcd()" + "color_abcd()\r\n" + "color_abcd()\r\n" + "", "abcd()\n" ) def test_completion_shorter_result( self_ ): self_.check_scenario( "", - "\\pi蟺蟺\r\n" - "蟺\r\n", + "replxx> \\pi蟺蟺\r\n" + "蟺\r\n", "\\pi\n" ) def test_completion_pager( self_ ): @@ -681,13 +741,11 @@ def test_completion_pager( self_ ): "eiffel kotlin rust\r\n" "erlang lisp scala\r\n" "forth lua scheme\r\n" - "--More--\r" - "\t\t\t\t\r" - "fortran modula sql\r\n" + "--More--\r\t\t\t\t\rfortran modula sql\r\n" "fsharp nemerle swift\r\n" "go ocaml typescript\r\n" - "replxx> " - "\r\n", + "replxx> \r\n" + "", dimensions = ( 10, 40 ), command = cmd ) @@ -703,17 +761,11 @@ def test_completion_pager( self_ ): "eiffel kotlin rust\r\n" "erlang lisp scala\r\n" "forth lua scheme\r\n" - "--More--\r" - "\t\t\t\t\r" - "fortran modula sql\r\n" - "--More--\r" - "\t\t\t\t\r" - "fsharp nemerle swift\r\n" - "--More--\r" - "\t\t\t\t\r" - "go ocaml typescript\r\n" - "replxx> " - "\r\n", + "--More--\r\t\t\t\t\rfortran modula sql\r\n" + "--More--\r\t\t\t\t\rfsharp nemerle swift\r\n" + "--More--\r\t\t\t\t\rgo ocaml typescript\r\n" + "replxx> \r\n" + "", dimensions = ( 10, 40 ), command = cmd ) @@ -728,8 +780,8 @@ def test_completion_pager( self_ ): "csharp ocaml\r\n" "eiffel perl\r\n" "--More--^C\r\n" - "replxx> " - "\r\n", + "replxx> \r\n" + "", dimensions = ( 8, 32 ), command = cmd ) @@ -743,10 +795,8 @@ def test_completion_pager( self_ ): "cobol nemerle\r\n" "csharp ocaml\r\n" "eiffel perl\r\n" - "--More--\r" - "\t\t\t\t\r" - "replxx> " - "\r\n", + "--More--\r\t\t\t\t\rreplxx> \r\n" + "", dimensions = ( 8, 32 ), command = cmd ) @@ -757,13 +807,14 @@ def test_double_tab_completion( self_ ): "f\r\n" " forth\r\n" " fortran\r\n" - " fsharpfo\r\n" + " fsharpfo\r\n" " forth\r\n" - " fortranfort\r\n" + " fortranfort\r\n" " forth\r\n" - " " - "fortranfortranfortranfortran\r\n" - "fortran\r\n", + " fortranfortranfortran" + "fortran\r\n" + "fortran\r\n" + "", command = cmd ) def test_beep_on_ambiguous_completion( self_ ): @@ -773,28 +824,27 @@ def test_beep_on_ambiguous_completion( self_ ): "f\r\n" " forth\r\n" " fortran\r\n" - " fsharpfo\r\n" + " fsharpfo\r\n" " forth\r\n" - " fortranfort\r\n" + " fortranfort\r\n" " forth\r\n" - " " - "fortranfortranfortranfortran\r\n" - "fortran\r\n", + " fortranfortran" + "fortranfortran\r\n" + "fortran\r\n" + "", command = cmd ) def test_history_search_backward( self_ ): self_.check_scenario( "repl", - "(reverse-i-search)`': " - "(reverse-i-search)`r': echo repl " - "golf(reverse-i-search)`re': echo repl " - "golf(reverse-i-search)`rep': echo repl " - "golf(reverse-i-search)`repl': echo repl " - "golf(reverse-i-search)`repl': charlie repl " - "deltareplxx> charlie repl " - "deltacharlie repl deltacharlie repl " - "delta\r\n" - "charlie repl delta\r\n", + "(reverse-i-search)`': (reverse-i-search)`r': echo repl golf" + "(reverse-i-search)`re': echo repl golf" + "(reverse-i-search)`rep': echo repl golf(reverse-i-search)`repl': echo repl golf" + "(reverse-i-search)`repl': charlie repl deltareplxx" + "> charlie repl deltacharlie repl deltacharlie repl delta" + "\r\n" + "charlie repl delta\r\n" + "", "some command\n" "alfa repl bravo\n" "other request\n" @@ -805,38 +855,32 @@ def test_history_search_backward( self_ ): ) self_.check_scenario( "fors", - "(reverse-i-search)`': " - "(reverse-i-search)`f': " - "swift(reverse-i-search)`fo': " - "fortran(reverse-i-search)`for': " - "fortran(reverse-i-search)`fo': " - "fortran(reverse-i-search)`f': " - "swift(reverse-i-search)`fs': " - "fsharpreplxx> " - "fsharpfsharpfsharp\r\n" - "fsharp\r\n", + "(reverse-i-search)`': (reverse-i-search)`f': swift" + "(reverse-i-search)`fo': fortran(reverse-i-search)`for': fortran" + "(reverse-i-search)`fo': fortran(reverse-i-search)`f': swift" + "(reverse-i-search)`fs': fsharpreplxx> fsharpfsharp" + "fsharp\r\n" + "fsharp\r\n" + "", "\n".join( _words_ ) + "\n" ) self_.check_scenario( "mod", - "(reverse-i-search)`': " - "(reverse-i-search)`m': " - "scheme(reverse-i-search)`mo': " - "modula(reverse-i-search)`mod': " - "modulareplxx> " - "replxx> " - "\r\n", + "(reverse-i-search)`': (reverse-i-search)`m': scheme" + "(reverse-i-search)`mo': modula(reverse-i-search)`mod': modula" + "replxx> replxx> " + "\r\n" + "", "\n".join( _words_ ) + "\n" ) def test_history_search_forward( self_ ): self_.check_scenario( "repl", - "(i-search)`': (i-search)`r': " - "(i-search)`re': (i-search)`rep': " - "(i-search)`repl': " - "(i-search)`repl': " - "replxx> \r\n", - "charlie repl delta\r\n", + "(i-search)`': (i-search)`r': " + "(i-search)`re': (i-search)`rep': (i-search)`repl': " + "(i-search)`repl': replxx> \r\n" + "", + "charlie repl delta\r\n", "some command\n" "alfa repl bravo\n" "other request\n" @@ -847,15 +891,14 @@ def test_history_search_forward( self_ ): ) self_.check_scenario( "repl", - "final thoughts(i-search)`': final " - "thoughts(i-search)`r': echo repl " - "golf(i-search)`re': echo repl " - "golf(i-search)`rep': echo repl " - "golf(i-search)`repl': echo repl " - "golf(i-search)`repl': alfa repl " - "bravoreplxx> alfa repl bravoalfa " - "repl bravoalfa repl bravo\r\n" - "alfa repl bravo\r\n", + "replxx> final thoughts" + "(i-search)`': final thoughts(i-search)`r': echo repl golf" + "(i-search)`re': echo repl golf(i-search)`rep': echo repl golf" + "(i-search)`repl': echo repl golf(i-search)`repl': alfa repl bravo" + "replxx> alfa repl bravoalfa repl bravo" + "alfa repl bravo\r\n" + "alfa repl bravo\r\n" + "", "final thoughts\n" "echo repl golf\n" "misc input\n" @@ -863,59 +906,57 @@ def test_history_search_forward( self_ ): "other request\n" "alfa repl bravo\n" "some command\n" - "charlie repl delta\r\n", + "charlie repl delta\r\n", ) self_.check_scenario( "fors", - "(i-search)`': (i-search)`f': " - "(i-search)`fo': (i-search)`for': " - "(i-search)`fo': (i-search)`f': " - "(i-search)`fs': " - "replxx> \r\n", + "(i-search)`': (i-search)`f': " + "(i-search)`fo': (i-search)`for': (i-search)`fo': " + "(i-search)`f': (i-search)`fs': " + "replxx> \r\n" + "", "\n".join( _words_[::-1] ) + "\n" ) self_.check_scenario( "fors", - "typescript(i-search)`': " - "typescript(i-search)`f': swift(i-search)`fo': " - "fortran(i-search)`for': fortran(i-search)`fo': " - "fortran(i-search)`f': swift(i-search)`fs': " - "fsharpreplxx> " - "fsharpfsharpfsharp\r\n" - "fsharp\r\n", + "replxx> typescript" + "(i-search)`': typescript(i-search)`f': swift" + "(i-search)`fo': fortran(i-search)`for': fortran" + "(i-search)`fo': fortran(i-search)`f': swift(i-search)`fs': fsharp" + "replxx> fsharpfsharpfsharp\r\n" + "fsharp\r\n" + "", "\n".join( _words_[::-1] ) + "\n" ) self_.check_scenario( "mod", - "(i-search)`': (i-search)`m': " - "(i-search)`mo': (i-search)`mod': " - "replxx> " - "replxx> " - "\r\n", + "(i-search)`': (i-search)`m': " + "(i-search)`mo': (i-search)`mod': replxx> " + "replxx> \r\n" + "", "\n".join( _words_[::-1] ) + "\n" ) self_.check_scenario( "mod", - "typescript(i-search)`': " - "typescript(i-search)`m': scheme(i-search)`mo': " - "modula(i-search)`mod': " - "modulareplxx> " - "typescriptreplxx> " - "typescripttypescript\r\n" - "typescript\r\n", + "replxx> typescript" + "(i-search)`': typescript(i-search)`m': scheme" + "(i-search)`mo': modula(i-search)`mod': modulareplxx" + "> typescriptreplxx> typescript" + "typescript\r\n" + "typescript\r\n" + "", "\n".join( _words_[::-1] ) + "\n" ) def test_history_search_backward_position( self_ ): self_.check_scenario( "req", - "(reverse-i-search)`': " - "(reverse-i-search)`r': echo repl " - "golf(reverse-i-search)`re': echo repl " - "golf(reverse-i-search)`req': other " - "requestreplxx> other requestother " - "requestalfa repl bravoalfa repl " - "bravo\r\n" - "alfa repl bravo\r\n", + "(reverse-i-search)`': (reverse-i-search)`r': echo repl golf" + "(reverse-i-search)`re': echo repl golf" + "(reverse-i-search)`req': other requestreplxx> other request" + "other requestalfa repl bravoalfa repl bravo" + "\r\n" + "alfa repl bravo\r\n" + "", "some command\n" "alfa repl bravo\n" "other request\n" @@ -927,28 +968,27 @@ def test_history_search_backward_position( self_ ): def test_history_search_overlong_line( self_ ): self_.check_scenario( "lo", - "(reverse-i-search)`': " - "(reverse-i-search)`l': some very long line of text, much " - "longer then a witdth of a terminal, " - "seriously(reverse-i-search)`lo': some very long line of " - "text, much longer then a witdth of a terminal, " - "seriouslyreplxx> some very long line of " - "text, much longer then a witdth of a terminal, seriouslysome " - "very long line of text, much longer then a witdth of a terminal, " - "seriouslysome very long line of text, much longer " - "then a witdth of a terminal, seriously\r\n" - "some very long line of text, much longer then a witdth of a terminal, " - "seriously\r\n", + "(reverse-i-search)`': " + "(reverse-i-search)`l': some very long line of text, much longer then a witdth of a terminal, serious" + "ly(reverse-i-search)`lo': some very long line of text, much longer then a witdth " + "of a terminal, seriouslyreplxx" + "> some very long line of text, much longer then a witdth of a terminal, seriously" + "some very long line of text, much longer then a witdth of a terminal, seriously" + "some very long line of text, much longer then a witdth of a terminal, seriously" + "\r\n" + "some very long line of text, much longer then a witdth of a terminal, seriously\r\n" + "", "fake\nsome very long line of text, much longer then a witdth of a terminal, seriously\nanother fake", dimensions = ( 24, 64 ) ) def test_history_prefix_search_backward( self_ ): self_.check_scenario( "repl", - "rrerepreplrepl_echo " - "golfrepl_charlie " - "deltarepl_charlie delta\r\n" - "repl_charlie delta\r\n", + "rrereprepl" + "repl_echo golfrepl_charlie delta" + "repl_charlie delta\r\n" + "repl_charlie delta\r\n" + "", "some command\n" "repl_alfa bravo\n" "other request\n" @@ -960,10 +1000,11 @@ def test_history_prefix_search_backward( self_ ): def test_history_prefix_search_backward_position( self_ ): self_.check_scenario( "repl", - "rrerepreplrepl_echo " - "golfmisc inputmisc " - "input\r\n" - "misc input\r\n", + "rrereprepl" + "repl_echo golfreplxx> misc input" + "misc input\r\n" + "misc input\r\n" + "", "some command\n" "repl_alfa bravo\n" "other request\n" @@ -975,14 +1016,14 @@ def test_history_prefix_search_backward_position( self_ ): def test_history_listing( self_ ): self_.check_scenario( "", - ".history.history\r\n" + "replxx> .history.history\r\n" " 0: some command\r\n" " 1: repl_alfa bravo\r\n" " 2: other request\r\n" " 3: repl_charlie delta\r\n" " 4: misc input\r\n" " 5: repl_echo golf\r\n" - " 6: .history\r\n", + " 6: .history\r\n", "some command\n" "repl_alfa bravo\n" "other request\n" @@ -993,7 +1034,7 @@ def test_history_listing( self_ ): ) self_.check_scenario( "", - "/history/history\r\n" + "replxx> /history/history\r\n" " 0: some command\r\n" " 1: repl_alfa bravo\r\n" " 2: other request\r\n" @@ -1001,7 +1042,7 @@ def test_history_listing( self_ ): " 4: misc input\r\n" " 5: repl_echo golf\r\n" " 6: /history\r\n" - "/history\r\n", + "/history\r\n", "some command\n" "repl_alfa bravo\n" "other request\n" @@ -1014,18 +1055,14 @@ def test_history_listing( self_ ): def test_history_browse( self_ ): self_.check_scenario( "", - "twelve" - "eleven" - "one" - "two" - "one" - "two" - "" - "twelve" - "" - "twelve" - "twelve\r\n" - "twelve\r\n", + "replxx> twelvereplxx> eleven" + "replxx> onereplxx" + "> tworeplxx> one" + "replxx> tworeplxx> " + "replxx> twelvereplxx> " + "replxx> twelvetwelve\r\n" + "twelve\r\n" + "", "one\n" "two\n" "three\n" @@ -1042,11 +1079,13 @@ def test_history_browse( self_ ): def test_history_max_size( self_ ): self_.check_scenario( "a", - "threeaa\r\n" + "replxx> threereplxx> " + "aa\r\n" "a\r\n" - "replxx> " - "fourfour\r\n" - "four\r\n", + "replxx> replxx> fourfour" + "\r\n" + "four\r\n" + "", "one\n" "two\n" "three\n" @@ -1057,39 +1096,43 @@ def test_history_max_size( self_ ): def test_history_unique( self_ ): self_.check_scenario( "abab", - "aa\r\n" + "aa\r\n" "a\r\n" - "replxx> bb\r\n" + "replxx> bb\r\n" "b\r\n" - "replxx> aa\r\n" + "replxx> aa\r\n" "a\r\n" - "replxx> bb\r\n" + "replxx> bb\r\n" "b\r\n" - "replxx> " - "bacc\r\n" - "c\r\n", + "replxx> replxx> b" + "replxx> areplxx> c" + "c\r\n" + "c\r\n" + "", "a\nb\nc\n", command = ReplxxTests._cSample_ + " u1 q1" ) self_.check_scenario( "abab", - "aa\r\n" + "aa\r\n" "a\r\n" - "replxx> bb\r\n" + "replxx> bb\r\n" "b\r\n" - "replxx> aa\r\n" + "replxx> aa\r\n" "a\r\n" - "replxx> bb\r\n" + "replxx> bb\r\n" + "b\r\n" + "replxx> replxx> b" + "replxx> areplxx> b" + "b\r\n" "b\r\n" - "replxx> " - "babb\r\n" - "b\r\n", + "", "a\nb\nc\n", command = ReplxxTests._cSample_ + " u0 q1" ) self_.check_scenario( rapid( "/history/unique/history" ), - "//history\r\n" + "//history\r\n" " 0: a\r\n" " 1: b\r\n" " 2: c\r\n" @@ -1101,422 +1144,411 @@ def test_history_unique( self_ ): " 8: c\r\n" " 9: a\r\n" "/history\r\n" - "replxx> /unique\r\n" + "replxx> /unique\r\n" "/unique\r\n" - "replxx> /history\r\n" + "replxx> /history\r\n" " 0: b\r\n" " 1: d\r\n" " 2: c\r\n" " 3: a\r\n" " 4: /history\r\n" " 5: /unique\r\n" - "/history\r\n", + "/history\r\n" + "", "a\nb\nc\nb\nc\nd\na\nc\nc\na\n", command = ReplxxTests._cSample_ + " u0 q1" ) def test_history_recall_most_recent( self_ ): self_.check_scenario( "", - "aaaabbbbbbbb\r\n" + "replxx> aaaareplxx> bbbb" + "bbbb\r\n" "bbbb\r\n" - "replxx> " - "cccccccc\r\n" - "cccc\r\n", + "replxx> replxx> cccccccc" + "\r\n" + "cccc\r\n" + "", "aaaa\nbbbb\ncccc\ndddd\n" ) def test_history_abort_incremental_history_search_position( self_ ): self_.check_scenario( "cc", - "hhhhgggg(reverse-i-search)`': " - "gggg(reverse-i-search)`c': " - "cccc(reverse-i-search)`cc': " - "ccccreplxx> " - "ggggggggffffffff\r\n" - "ffff\r\n", + "replxx> hhhhreplxx> gggg" + "(reverse-i-search)`': gggg" + "(reverse-i-search)`c': cccc(reverse-i-search)`cc': cccc" + "replxx> ggggggggreplxx" + "> ffffffff\r\n" + "ffff\r\n" + "", "aaaa\nbbbb\ncccc\ndddd\neeee\nffff\ngggg\nhhhh\n" ) def test_capitalize( self_ ): self_.check_scenario( "", - "abc defg ijklmn zzxqabc defg ijklmn " - "zzxqaBc defg " - "ijklmn zzxqaBc Defg ijklmn zzxq" - "aBc Defg iJklmn zzxqaBc Defg " - "iJklmn ZzxqaBc Defg iJklmn Zzxq\r\n" - "aBc Defg iJklmn Zzxq\r\n", + "replxx> abc defg ijklmn zzxqabc defg ijklmn zzxq" + "abc defg ijklmn zzxqaBc defg ijklmn zzxq" + "aBc Defg ijklmn zzxqaBc Defg ijklmn zzxq" + "aBc Defg ijklmn zzxqaBc Defg iJklmn zzxq" + "aBc Defg iJklmn ZzxqaBc Defg iJklmn Zzxq\r\n" + "aBc Defg iJklmn Zzxq\r\n" + "", "abc defg ijklmn zzxq\n" ) self_.check_scenario( " ", - "abc_def ghj_jkl mno_pqr stu_vwxabc_def ghj_jkl " - "mno_pqr stu_vwx" - "aBc_def ghj_jkl mno_pqr " - "stu_vwxaBc_Def ghj_jkl mno_pqr " - "stu_vwxaBc_Def Ghj_jkl mno_pqr " - "stu_vwxaBc_Def Ghj_jkl Mno_pqr " - "stu_vwx" - "aBc_Def Ghj_jkl Mno_pQr " - "stu_vwxaBc_Def Ghj_jkl Mno_pQr " - "Stu_vwxaBc_Def Ghj_jkl Mno_pQr Stu " - "_vwxaBc_Def Ghj_jkl Mno_pQr Stu _vwx\r\n" - "aBc_Def Ghj_jkl Mno_pQr Stu _vwx\r\n", + "replxx> abc_def ghj_jkl mno_pqr stu_vwx" + "abc_def ghj_jkl mno_pqr stu_vwxabc_def ghj_jkl mno_pqr stu_vwx" + "aBc_def ghj_jkl mno_pqr stu_vwxaBc_Def ghj_jkl mno_pqr stu_vwx" + "aBc_Def Ghj_jkl mno_pqr stu_vwxaBc_Def Ghj_jkl Mno_pqr stu_vwx" + "aBc_Def Ghj_jkl Mno_pqr stu_vwx" + "aBc_Def Ghj_jkl Mno_pqr stu_vwxaBc_Def Ghj_jkl Mno_pQr stu_vwx" + "aBc_Def Ghj_jkl Mno_pQr Stu_vwxaBc_Def Ghj_jkl Mno_pQr Stu _vwx" + "aBc_Def Ghj_jkl Mno_pQr Stu _vwx\r\n" + "aBc_Def Ghj_jkl Mno_pQr Stu _vwx\r\n" + "", "abc_def ghj_jkl mno_pqr stu_vwx\n" ) def test_make_upper_case( self_ ): self_.check_scenario( "", - "abcdefg hijklmno pqrstuvwabcdefg " - "hijklmno pqrstuvw" - "abcDEFG hijklmno " - "pqrstuvwabcDEFG HIJKLMNO " - "pqrstuvw" - "abcDEFG HIJKLMNO " - "PQRSTUVWabcDEFG HIJKLMNO " - "PQRSTUVW\r\n" - "abcDEFG HIJKLMNO PQRSTUVW\r\n", + "replxx> abcdefg hijklmno pqrstuvw" + "abcdefg hijklmno pqrstuvwabcdefg hijklmno pqrstuvw" + "abcdefg hijklmno pqrstuvwabcdefg hijklmno pqrstuvw" + "abcDEFG hijklmno pqrstuvwabcDEFG HIJKLMNO pqrstuvw" + "abcDEFG HIJKLMNO pqrstuvwabcDEFG HIJKLMNO PQRSTUVW" + "abcDEFG HIJKLMNO PQRSTUVW\r\n" + "abcDEFG HIJKLMNO PQRSTUVW\r\n" + "", "abcdefg hijklmno pqrstuvw\n" ) self_.check_scenario( "", - "abc_def ghi_jkl mno_pqr stu_vwxabc_def ghi_jkl " - "mno_pqr stu_vwx" - "aBC_def ghi_jkl mno_pqr " - "stu_vwxaBC_DEF ghi_jkl mno_pqr " - "stu_vwx" - "aBC_DEF GHI_JKL mno_pqr " - "stu_vwx" - "aBC_DEF GHI_JKL mNO_pqr " - "stu_vwxaBC_DEF GHI_JKL mNO_pqr " - "stu_vwx\r\n" - "aBC_DEF GHI_JKL mNO_pqr stu_vwx\r\n", + "replxx> abc_def ghi_jkl mno_pqr stu_vwx" + "abc_def ghi_jkl mno_pqr stu_vwxabc_def ghi_jkl mno_pqr stu_vwx" + "aBC_def ghi_jkl mno_pqr stu_vwxaBC_DEF ghi_jkl mno_pqr stu_vwx" + "aBC_DEF ghi_jkl mno_pqr stu_vwxaBC_DEF GHI_JKL mno_pqr stu_vwx" + "aBC_DEF GHI_JKL mno_pqr stu_vwx" + "aBC_DEF GHI_JKL mno_pqr stu_vwxaBC_DEF GHI_JKL mNO_pqr stu_vwx" + "aBC_DEF GHI_JKL mNO_pqr stu_vwx\r\n" + "aBC_DEF GHI_JKL mNO_pqr stu_vwx\r\n" + "", "abc_def ghi_jkl mno_pqr stu_vwx\n" ) def test_make_lower_case( self_ ): self_.check_scenario( "", - "ABCDEFG HIJKLMNO PQRSTUVWABCDEFG " - "HIJKLMNO PQRSTUVW" - "ABCdefg HIJKLMNO " - "PQRSTUVWABCdefg hijklmno " - "PQRSTUVW" - "ABCdefg hijklmno " - "pqrstuvwABCdefg hijklmno " - "pqrstuvw\r\n" - "ABCdefg hijklmno pqrstuvw\r\n", + "replxx> ABCDEFG HIJKLMNO PQRSTUVW" + "ABCDEFG HIJKLMNO PQRSTUVWABCDEFG HIJKLMNO PQRSTUVW" + "ABCDEFG HIJKLMNO PQRSTUVWABCDEFG HIJKLMNO PQRSTUVW" + "ABCdefg HIJKLMNO PQRSTUVWABCdefg hijklmno PQRSTUVW" + "ABCdefg hijklmno PQRSTUVWABCdefg hijklmno pqrstuvw" + "ABCdefg hijklmno pqrstuvw\r\n" + "ABCdefg hijklmno pqrstuvw\r\n" + "", "ABCDEFG HIJKLMNO PQRSTUVW\n" ) self_.check_scenario( "", - "ABC_DEF GHI_JKL MNO_PQR STU_VWXABC_DEF GHI_JKL " - "MNO_PQR STU_VWX" - "Abc_DEF GHI_JKL MNO_PQR " - "STU_VWXAbc_def GHI_JKL MNO_PQR " - "STU_VWX" - "Abc_def ghi_jkl MNO_PQR " - "STU_VWX" - "Abc_def ghi_jkl Mno_PQR " - "STU_VWXAbc_def ghi_jkl Mno_PQR " - "STU_VWX\r\n" - "Abc_def ghi_jkl Mno_PQR STU_VWX\r\n", + "replxx> ABC_DEF GHI_JKL MNO_PQR STU_VWX" + "ABC_DEF GHI_JKL MNO_PQR STU_VWXABC_DEF GHI_JKL MNO_PQR STU_VWX" + "Abc_DEF GHI_JKL MNO_PQR STU_VWXAbc_def GHI_JKL MNO_PQR STU_VWX" + "Abc_def GHI_JKL MNO_PQR STU_VWXAbc_def ghi_jkl MNO_PQR STU_VWX" + "Abc_def ghi_jkl MNO_PQR STU_VWX" + "Abc_def ghi_jkl MNO_PQR STU_VWXAbc_def ghi_jkl Mno_PQR STU_VWX" + "Abc_def ghi_jkl Mno_PQR STU_VWX\r\n" + "Abc_def ghi_jkl Mno_PQR STU_VWX\r\n" + "", "ABC_DEF GHI_JKL MNO_PQR STU_VWX\n" ) def test_transpose( self_ ): self_.check_scenario( "", - "abcd" - "abcd" - "bacd" - "bcad" - "bcda" - "bcad" - "bcda" - "bcda\r\n" - "bcda\r\n", + "replxx> abcdabcdabcd" + "bacdbcadbcdabcad" + "bcdabcda\r\n" + "bcda\r\n" + "", "abcd\n" ) def test_kill_to_beginning_of_line( self_ ): self_.check_scenario( "", - "+abc defg--ijklmn " - "zzxq++abc " - "defg--ijklmn " - "zzxq+" - "-ijklmn " - "zzxq+-ijklmn " - "zzxq+-ijklmn " - "zzxq++abc " - "defg--ijklmn " - "zzxq++abc defg-\r\n" - "-ijklmn zzxq++abc defg-\r\n", + "replxx> +abc defg--" + "ijklmn zzxq++abc defg--" + "ijklmn zzxq++abc defg--" + "ijklmn zzxq++abc defg--" + "ijklmn zzxq++abc defg--" + "ijklmn zzxq+-ijklmn zzxq+" + "-ijklmn zzxq+-" + "ijklmn zzxq++abc defg--" + "ijklmn zzxq++abc defg-\r\n" + "-ijklmn zzxq++abc defg-\r\n" + "", "+abc defg--ijklmn zzxq+\n" ) def test_kill_to_end_of_line( self_ ): self_.check_scenario( "", - "+abc defg--ijklmn " - "zzxq++abc " - "defg--ijklmn " - "zzxq+" - "+abc " - "defg-+abc " - "defg--ijklmn " - "zzxq++abc " - "defg--ijklmn " - "zzxq++abc defg-\r\n" - "-ijklmn zzxq++abc defg-\r\n", + "replxx> +abc defg--" + "ijklmn zzxq++abc defg--" + "ijklmn zzxq++abc defg--" + "ijklmn zzxq++abc defg--" + "ijklmn zzxq++abc defg--" + "ijklmn zzxq++abc defg-" + "+abc defg--" + "ijklmn zzxq++abc defg--" + "ijklmn zzxq++abc defg-\r\n" + "-ijklmn zzxq++abc defg-\r\n" + "", "+abc defg--ijklmn zzxq+\n" ) def test_kill_next_word( self_ ): self_.check_scenario( "", - "alpha charlie bravo deltaalpha " - "charlie bravo delta" - "alpha bravo delta" - "alpha bravo charlie deltaalpha " - "bravo charlie delta\r\n" - "alpha bravo charlie delta\r\n", + "replxx> alpha charlie bravo delta" + "alpha charlie bravo deltaalpha charlie bravo delta" + "alpha bravo deltaalpha bravo delta" + "alpha bravo charlie deltaalpha bravo charlie delta\r\n" + "alpha bravo charlie delta\r\n" + "", "alpha charlie bravo delta\n" ) self_.check_scenario( "", - "abc_ABC def_DEF ghi_GHI jkl_JKL XXXabc_ABC def_DEF " - "ghi_GHI jkl_JKL XXX" - "abc_ABC_DEF ghi_GHI jkl_JKL " - "XXXabc_ABC ghi_GHI jkl_JKL " - "XXXabc_ABC jkl_JKL XXXabc_ABC_JKL " - "XXXabc_ABC_JKL " - "def_DEF ghi_GHI jkl XXXabc_ABC_JKL def_DEF ghi_GHI jkl " - "XXX\r\n" - "abc_ABC_JKL def_DEF ghi_GHI jkl XXX\r\n", + "replxx> abc_ABC def_DEF ghi_GHI jkl_JKL XXX" + "abc_ABC def_DEF ghi_GHI jkl_JKL XXXabc_ABC def_DEF ghi_GHI jkl_JKL XXX" + "abc_ABC_DEF ghi_GHI jkl_JKL XXXabc_ABC ghi_GHI jkl_JKL XXX" + "abc_ABC jkl_JKL XXXabc_ABC_JKL XXX" + "abc_ABC_JKL XXXabc_ABC_JKL def_DEF ghi_GHI jkl XXX" + "abc_ABC_JKL def_DEF ghi_GHI jkl XXX\r\n" + "abc_ABC_JKL def_DEF ghi_GHI jkl XXX\r\n" + "", "abc_ABC def_DEF ghi_GHI jkl_JKL XXX\n" ) def test_kill_prev_word_to_white_space( self_ ): self_.check_scenario( "", - "alpha charlie bravo deltaalpha " - "charlie bravo deltaalpha charlie " - "deltaalpha bravo " - "charlie deltaalpha bravo charlie delta\r\n" - "alpha bravo charlie delta\r\n", + "replxx> alpha charlie bravo delta" + "alpha charlie bravo deltaalpha charlie delta" + "alpha charlie deltaalpha bravo charlie delta" + "alpha bravo charlie delta\r\n" + "alpha bravo charlie delta\r\n" + "", "alpha charlie bravo delta\n" ) def test_kill_prev_word( self_ ): self_.check_scenario( "", - "alpha.charlie " - "bravo.deltaalpha.charlie " - "bravo.deltaalpha.charlie " - "delta" - "alpha.bravo.charlie " - "deltaalpha.bravo.charlie " - "delta\r\n" - "alpha.bravo.charlie delta\r\n", + "replxx> alpha.charlie bravo.delta" + "alpha.charlie bravo.delta" + "alpha.charlie deltaalpha." + "charlie deltaalpha.bravo." + "charlie deltaalpha.bravo." + "charlie delta\r\n" + "alpha.bravo.charlie delta\r\n" + "", "alpha.charlie bravo.delta\n" ) def test_kill_ring( self_ ): self_.check_scenario( " ", - "delta charlie bravo alphadelta " - "charlie bravo delta charlie " - "bravodelta charlie " - "delta " - "charliedelta " - "" - "delta" - "" - "delta" - "charlie" - "bravo" - "alpha" + "replxx> delta charlie bravo alphadelta " + "charlie bravo delta charlie " + "bravodelta charlie " + "delta " + "charliedelta " + "" + "delta" + "" + "delta" + "charlie" + "bravo" + "alpha" "alpha " - "alpha " - "alphaalpha " - "deltaalpha " - "charliealpha " - "bravoalpha bravo " - "alpha bravo " - "bravoalpha bravo " - "alphaalpha bravo " - "deltaalpha bravo " - "charliealpha bravo charlie " - "alpha bravo charlie " - "charliealpha bravo charlie " - "bravoalpha bravo charlie " - "alphaalpha bravo charlie " - "deltaalpha bravo charlie delta\r\n" - "alpha bravo charlie delta\r\n", + "alpha " + "alphaalpha " + "deltaalpha " + "charliealpha " + "bravoalpha bravo " + "alpha bravo " + "bravoalpha bravo " + "alphaalpha bravo " + "deltaalpha bravo " + "charliealpha bravo charlie " + "alpha bravo charlie " + "charliealpha bravo charlie " + "bravoalpha bravo charlie " + "alphaalpha bravo charlie " + "deltaalpha bravo charlie delta\r\n" + "alpha bravo charlie delta\r\n", "delta charlie bravo alpha\n" ) self_.check_scenario( " ", - "charlie delta alpha bravocharlie " - "delta alpha charlie delta " - "charlie " - "deltacharlie deltaalpha " - "bravocharlie deltaalpha bravo charlie " - "deltaalpha bravo charlie delta\r\n" - "alpha bravo charlie delta\r\n", + "replxx> charlie delta alpha bravo" + "charlie delta alpha charlie delta " + "charlie deltacharlie deltaalpha bravocharlie delta" + "alpha bravo charlie deltaalpha bravo charlie delta" + "\r\n" + "alpha bravo charlie delta\r\n" + "", "charlie delta alpha bravo\n" ) self_.check_scenario( " ", - "charlie delta alpha bravocharlie " - "delta alpha bravo delta alpha bravo " - "alpha bravoalpha bravoalpha " - "bravoalpha bravo " - "alpha bravo charlie " - "deltaalpha bravo charlie delta\r\n" - "alpha bravo charlie delta\r\n", + "replxx> charlie delta alpha bravo" + "charlie delta alpha bravo delta alpha bravo alpha bravo" + "alpha bravoalpha bravoalpha bravo " + "alpha bravo charlie deltaalpha bravo charlie delta" + "\r\n" + "alpha bravo charlie delta\r\n" + "", "charlie delta alpha bravo\n" ) self_.check_scenario( "" "" "", - "a b c d e f g h i j ka b c d e f g " - "h i j a b c d e f g h i " - "ja b c d e f g h i " - "a b c d e f g h " - "ia b c d e f g h " - "a b c d e f g " - "ha b c d e f g " - "a b c d e f ga " - "b c d e f a b c d e " - "fa b c d e a b " - "c d ea b c d a " - "b c da b c a b " - "ca b a " - "ba " - "" - "a" - "" - "a" - "b" - "c" - "d" - "e" - "f" - "g" - "h" - "i" - "j" - "a" + "replxx> a b c d e f g h i j ka b c d e f g " + "h i j a b c d e f g h i " + "ja b c d e f g h i " + "a b c d e f g h " + "ia b c d e f g h " + "a b c d e f g " + "ha b c d e f g " + "a b c d e f ga " + "b c d e f a b c d e " + "fa b c d e a b " + "c d ea b c d a " + "b c da b c a b " + "ca b a " + "ba " + "" + "a" + "" + "a" + "b" + "c" + "d" + "e" + "f" + "g" + "h" + "i" + "j" + "a" "a\r\n" - "a\r\n", + "a\r\n", "a b c d e f g h i j k\n" ) def test_yank_last_arg( self_ ): self_.check_scenario( "0123", - "0" - "01" - "012" - "0123" - "0123" - "01cat23" - "01trillion23" - "01twelve23" - "01twelve23\r\n" - "01twelve23\r\n", + "001012" + "012301230123" + "01cat2301" + "trillion2301twelve23" + "01twelve23\r\n" + "01twelve23\r\n" + "", "one two three\nten eleven twelve\nmillion trillion\ndog cat\n" ) self_.check_scenario( " ", - "dog catmillion trillionten " - "eleven twelveten eleven twelve ten " - "eleven twelve catten eleven twelve " - "trillionten eleven twelve trillion\r\n" - "ten eleven twelve trillion\r\n", + "replxx> dog catreplxx" + "> million trillionreplxx> ten eleven twelve" + "ten eleven twelve ten eleven twelve cat" + "ten eleven twelve trillionten eleven twelve trillion\r\n" + "ten eleven twelve trillion\r\n" + "", "one two three\nten eleven twelve\nmillion trillion\ndog cat\n" ) def test_tab_completion_cutoff( self_ ): self_.check_scenario( "ny", - "\r\n" + "\r\n" "Display all 9 possibilities? (y or n)\r\n" - "replxx> " - "\r\n" + "replxx> \r\n" "Display all 9 possibilities? (y or n)\r\n" "db hallo hansekogge quetzalcoatl power\r\n" "hello hans seamann quit\r\n" - "replxx> " - "\r\n", + "replxx> \r\n" + "", command = ReplxxTests._cSample_ + " q1 c3" ) self_.check_scenario( "n", - "\r\n" + "\r\n" "Display all 9 possibilities? (y or n)\r\n" - "replxx> " - "\r\n", + "replxx> \r\n" + "", command = ReplxxTests._cSample_ + " q1 c3" ) self_.check_scenario( "", - "\r\n" + "\r\n" "Display all 9 possibilities? (y or n)^C\r\n" - "replxx> " - "\r\n", + "replxx> \r\n" + "", command = ReplxxTests._cSample_ + " q1 c3" ) self_.check_scenario( ["", ""], "\r\n" "Display all 9 possibilities? (y or n)^C\r\n" - "replxx> " - "\r\n", + "replxx> \r\n" + "", command = ReplxxTests._cSample_ + " q1 c3 H200" ) def test_preload( self_ ): self_.check_scenario( "", - "Alice has a cat." - "Alice has a cat.\r\n" - "Alice has a cat.\r\n", + "Alice has a cat.Alice has a cat.\r\n" + "Alice has a cat.\r\n" + "", command = ReplxxTests._cSample_ + " q1 'PAlice has a cat.'" ) self_.check_scenario( "", - "Cat eats mice. " - "Cat eats mice. " - "\r\n" - "Cat eats mice. " - "\r\n", + "Cat eats mice. Cat eats mice. \r\n" + "Cat eats mice. \r\n" + "", command = ReplxxTests._cSample_ + " q1 'PCat\teats\tmice.\r\n'" ) self_.check_scenario( "", - "Cat eats mice. " - "Cat eats mice. " - "\r\n" - "Cat eats mice. " - "\r\n", + "Cat eats mice. Cat eats mice. \r\n" + "Cat eats mice. \r\n" + "", command = ReplxxTests._cSample_ + " q1 'PCat\teats\tmice.\r\n\r\n\n\n'" ) self_.check_scenario( "", - "M Alice has a cat." - "M Alice has a cat.\r\n" - "M Alice has a cat.\r\n", + "M Alice has a cat.M Alice has a cat.\r\n" + "M Alice has a cat.\r\n" + "", command = ReplxxTests._cSample_ + " q1 'PMAlice has a cat.'" ) self_.check_scenario( "", - "M Alice has a cat." - "M Alice has a cat.\r\n" - "M Alice has a cat.\r\n", + "M Alice has a cat.M Alice has a cat.\r\n" + "M Alice has a cat.\r\n" + "", command = ReplxxTests._cSample_ + " q1 'PM\t\t\t\tAlice has a cat.'" ) def test_prompt( self_ ): prompt = "date: now\nrepl> " self_.check_scenario( "", - "threethree\r\n" + "date: now\r\n" + "repl> threethree\r\n" "three\r\n" - "date: now\r\n" - "repl> " - "threetwotwo\r\n" - "two\r\n", + "date: now\r\n" + "repl> date: now\r\n" + "repl> threedate: now\r\n" + "repl> twotwo\r\n" + "two\r\n" + "", command = ReplxxTests._cSample_ + " q1 'p{}'".format( prompt ), prompt = prompt, end = prompt + ReplxxTests._end_ @@ -1524,7 +1556,7 @@ def test_prompt( self_ ): prompt = "repl>\n" self_.check_scenario( "a", - "aa\r\na\r\n", + "aa\r\na\r\n", command = ReplxxTests._cSample_ + " q1 'p{}'".format( prompt ), prompt = prompt, end = prompt + ReplxxTests._end_ @@ -1532,51 +1564,53 @@ def test_prompt( self_ ): def test_long_line( self_ ): self_.check_scenario( "~~~~~~~~~~~~", - "ada clojure eiffel fortran groovy java kotlin modula perl python " - "rust sqlada clojure eiffel fortran groovy " - "java kotlin modula perl python rust sqlada " - "clojure eiffel fortran groovy java kotlin modula perl python rust " - "~sqlada clojure " - "eiffel fortran groovy java kotlin modula perl python ~rust " - "~sqlada clojure " - "eiffel fortran groovy java kotlin modula perl ~python ~rust " - "~sqlada clojure " - "eiffel fortran groovy java kotlin modula ~perl ~python ~rust " - "~sqlada " - "clojure eiffel fortran groovy java kotlin ~modula ~perl ~python ~rust " - "~sqlada " - "clojure eiffel fortran groovy java ~kotlin ~modula ~perl ~python ~rust " - "~sqlada " - "clojure eiffel fortran groovy ~java ~kotlin ~modula ~perl ~python ~rust " - "~sqlada clojure " - "eiffel fortran ~groovy ~java ~kotlin ~modula ~perl ~python ~rust " - "~sqlada clojure eiffel " - "~fortran ~groovy ~java ~kotlin ~modula ~perl ~python ~rust " - "~sqlada clojure " - "~eiffel ~fortran ~groovy ~java ~kotlin ~modula ~perl ~python ~rust " - "~sqlada ~clojure " - "~eiffel ~fortran ~groovy ~java ~kotlin ~modula ~perl ~python ~rust " - "~sql~ada ~clojure " - "~eiffel ~fortran ~groovy ~java ~kotlin ~modula ~perl ~python ~rust " - "~sql~ada ~clojure " - "~eiffel ~fortran ~groovy ~java ~kotlin ~modula ~perl ~python ~rust " - "~sql\r\n" - "~ada ~clojure ~eiffel ~fortran ~groovy ~java ~kotlin ~modula ~perl ~python " - "~rust ~sql\r\n", + "replxx> ada clojure eiffel fortran groovy java kotlin modula perl python rust " + "sqlada clojure eiffel fortran groovy java kotlin modula perl python rust" + " sqlada clojure eiffel fortran groovy java kotlin modula perl python rus" + "t ~sqlada clojure eiffel fortran groovy java kotlin modula perl python r" + "ust ~sqlada clojure eiffel fortran groovy java kotlin modula perl python" + " ~rust ~sqlada clojure eiffel fortran groovy java kotlin modula perl pyt" + "hon ~rust ~sqlada clojure eiffel fortran groovy java kotlin modula perl " + "~python ~rust ~sqlada clojure eiffel fortran groovy java kotlin modula p" + "erl ~python ~rust ~sql" + "ada clojure eiffel fortran groovy java kotlin modula ~perl ~python ~rust ~sql" + "ada clojure eiffel fortran groovy java kotlin modula ~perl ~python ~rust ~sql" + "ada clojure eiffel fortran groovy java kotlin ~modula ~perl ~python ~rust ~sql" + "ada clojure eiffel fortran groovy java kotlin ~modula ~perl ~python ~rust ~sq" + "lada clojure eiffel fortran groovy java ~kotlin ~modula ~perl ~python ~ru" + "st ~sqlada clojure eiffel fortran groovy java ~kotlin ~modula ~perl ~pyth" + "on ~rust ~sqlada clojure eiffel fortran groovy ~java ~kotlin ~modula ~per" + "l ~python ~rust ~sqlada clojure eiffel fortran groovy ~java ~kotlin ~modu" + "la ~perl ~python ~rust ~sql" + "ada clojure eiffel fortran ~groovy ~java ~kotlin ~modula ~perl ~python ~rust ~sql" + "ada clojure eiffel fortran ~groovy ~java ~kotlin ~modula ~perl ~python ~rust ~sql" + "ada clojure eiffel ~fortran ~groovy ~java ~kotlin ~modula ~perl ~python ~rust ~sq" + "lada clojure eiffel ~fortran ~groovy ~java ~kotlin ~modula ~perl ~python ~ru" + "st ~sqlada clojure ~eiffel ~fortran ~groovy ~java ~kotlin ~modula ~perl ~pyt" + "hon ~rust ~sqlada clojure ~eiffel ~fortran ~groovy ~java ~kotlin ~modula ~pe" + "rl ~python ~rust ~sqlada ~clojure ~eiffel ~fortran ~groovy ~java ~kotlin ~mo" + "dula ~perl ~python ~rust ~sql" + "ada ~clojure ~eiffel ~fortran ~groovy ~java ~kotlin ~modula ~perl ~python ~rust ~sql" + "~ada ~clojure ~eiffel ~fortran ~groovy ~java ~kotlin ~modula ~perl ~python ~rust ~sql~ada ~clojure ~eiffel ~fortran ~groovy ~java ~kotlin ~modula ~perl ~python ~rus" + "t ~sql~ada ~clojure ~eiffel ~fortran ~groovy ~java ~kotlin ~modula ~perl ~pyt" + "hon ~rust ~sql\r\n" + "~ada ~clojure ~eiffel ~fortran ~groovy ~java ~kotlin ~modula ~perl ~python ~rust ~sql\r\n" + "", " ".join( _words_[::3] ) + "\n", dimensions = ( 10, 40 ) ) def test_colors( self_ ): self_.check_scenario( "", - "color_black color_red " + "replxx> color_black color_red " "color_green color_brown color_blue " "color_magenta color_cyan " "color_lightgray color_gray " "color_brightred color_brightgreen " "color_yellow color_brightblue " "color_brightmagenta color_brightcyan " - "color_whitecolor_black " + "color_whitecolor_black " "color_red color_green color_brown " "color_blue color_magenta color_cyan " "color_lightgray color_gray " @@ -1587,64 +1621,81 @@ def test_colors( self_ ): "color_black color_red color_green color_brown color_blue color_magenta " "color_cyan color_lightgray color_gray color_brightred color_brightgreen " "color_yellow color_brightblue color_brightmagenta color_brightcyan " - "color_white\r\n", + "color_white\r\n", "color_black color_red color_green color_brown color_blue color_magenta color_cyan color_lightgray" " color_gray color_brightred color_brightgreen color_yellow color_brightblue color_brightmagenta color_brightcyan color_white\n" ) def test_word_break_characters( self_ ): self_.check_scenario( "xxxxxx", - "one_two three-four five_six " - "seven-eightone_two three-four five_six " - "seven-eightone_two three-four five_six " - "seven-xeightone_two three-four five_six " - "xseven-xeightone_two three-four xfive_six " - "xseven-xeightone_two three-xfour xfive_six " - "xseven-xeightone_two xthree-xfour xfive_six " - "xseven-xeightxone_two xthree-xfour xfive_six " - "xseven-xeightxone_two xthree-xfour xfive_six " - "xseven-xeight\r\n" - "xone_two xthree-xfour xfive_six xseven-xeight\r\n", + "replxx> one_two three-four five_six seven-eight" + "one_two three-four five_six seven-eight" + "one_two three-four five_six seven-xeight" + "one_two three-four five_six seven-xeight" + "one_two three-four five_six seven-xeight" + "one_two three-four five_six xseven-xeight" + "one_two three-four five_six xseven-xeight" + "one_two three-four five_six xseven-xeight" + "one_two three-four xfive_six xseven-xeight" + "one_two three-four xfive_six xseven-xeight" + "one_two three-four xfive_six xseven-xeight" + "one_two three-xfour xfive_six xseven-xeight" + "one_two three-xfour xfive_six xseven-xeight" + "one_two three-xfour xfive_six xseven-xeight" + "one_two xthree-xfour xfive_six xseven-xeight" + "one_two xthree-xfour xfive_six xseven-xeight" + "one_two xthree-xfour xfive_six xseven-xeight" + "xone_two xthree-xfour xfive_six xseven-xeight" + "xone_two xthree-xfour xfive_six xseven-xeight\r\n" + "xone_two xthree-xfour xfive_six xseven-xeight\r\n" + "", "one_two three-four five_six seven-eight\n", command = ReplxxTests._cSample_ + " q1 'w \t-'" ) self_.check_scenario( "xxxxxx", - "one_two three-four five_six " - "seven-eightone_two three-four five_six " - "seven-eightone_two three-four five_six " - "xseven-eightone_two three-four five_xsix " - "xseven-eightone_two three-four xfive_xsix " - "xseven-eightone_two xthree-four xfive_xsix " - "xseven-eightone_xtwo xthree-four xfive_xsix " - "xseven-eightxone_xtwo xthree-four xfive_xsix " - "xseven-eightxone_xtwo xthree-four xfive_xsix " - "xseven-eight\r\n" - "xone_xtwo xthree-four xfive_xsix xseven-eight\r\n", + "replxx> one_two three-four five_six seven-eight" + "one_two three-four five_six seven-eight" + "one_two three-four five_six xseven-eight" + "one_two three-four five_six xseven-eight" + "one_two three-four five_six xseven-eight" + "one_two three-four five_xsix xseven-eight" + "one_two three-four five_xsix xseven-eight" + "one_two three-four five_xsix xseven-eight" + "one_two three-four xfive_xsix xseven-eight" + "one_two three-four xfive_xsix xseven-eight" + "one_two three-four xfive_xsix xseven-eight" + "one_two xthree-four xfive_xsix xseven-eight" + "one_two xthree-four xfive_xsix xseven-eight" + "one_two xthree-four xfive_xsix xseven-eight" + "one_xtwo xthree-four xfive_xsix xseven-eight" + "one_xtwo xthree-four xfive_xsix xseven-eight" + "one_xtwo xthree-four xfive_xsix xseven-eight" + "xone_xtwo xthree-four xfive_xsix xseven-eight" + "xone_xtwo xthree-four xfive_xsix xseven-eight\r\n" + "xone_xtwo xthree-four xfive_xsix xseven-eight\r\n" + "", "one_two three-four five_six seven-eight\n", command = ReplxxTests._cSample_ + " q1 'w \t_'" ) def test_no_color( self_ ): self_.check_scenario( " X", - "color_black color_red color_green color_brown color_blue " - "color_magenta color_cyan color_lightgray color_gray color_brightred " - "color_brightgreen color_yellow color_brightblue color_brightmagenta " - "color_brightcyan color_whitecolor_black color_red " - "color_green color_brown color_blue color_magenta color_cyan color_lightgray " - "color_gray color_brightred color_brightgreen color_yellow color_brightblue " - "color_brightmagenta color_brightcyan color_white " - "color_black color_red color_green color_brown color_blue " - "color_magenta color_cyan color_lightgray color_gray color_brightred " - "color_brightgreen color_yellow color_brightblue color_brightmagenta " - "color_brightcyan color_white Xcolor_black color_red " - "color_green color_brown color_blue color_magenta color_cyan color_lightgray " - "color_gray color_brightred color_brightgreen color_yellow color_brightblue " - "color_brightmagenta color_brightcyan color_white X\r\n" - "color_black color_red color_green color_brown color_blue color_magenta " - "color_cyan color_lightgray color_gray color_brightred color_brightgreen " - "color_yellow color_brightblue color_brightmagenta color_brightcyan " - "color_white X\r\n", + "replxx> color_black color_red color_green color_brown color_blue color_magenta" + " color_cyan color_lightgray color_gray color_brightred color_brightgreen color_yellow color_brightbl" + "ue color_brightmagenta color_brightcyan color_white" + "color_black color_red color_green color_brown color_blue color_magenta color_cyan color_lightgray co" + "lor_gray color_brightred color_brightgreen color_yellow color_brightblue color_brightmagenta color_b" + "rightcyan color_white color_black color_red color_green color_brown color_blue co" + "lor_magenta color_cyan color_lightgray color_gray color_brightred color_brightgreen color_yellow col" + "or_brightblue color_brightmagenta color_brightcyan color_white X" + "color_black color_red color_green color_brown color_blue color_magenta color_cyan color_lightgray co" + "lor_gray color_brightred color_brightgreen color_yellow color_brightblue color_brightmagenta color_b" + "rightcyan color_white X\r\n" + "color_black color_red color_green color_brown color_blue color_magenta color_cyan color_lightgray co" + "lor_gray color_brightred color_brightgreen color_yellow color_brightblue color_brightmagenta color_b" + "rightcyan color_white X\r\n" + "", "color_black color_red color_green color_brown color_blue color_magenta color_cyan color_lightgray" " color_gray color_brightred color_brightgreen color_yellow color_brightblue color_brightmagenta color_brightcyan color_white\n", command = ReplxxTests._cSample_ + " q1 m1" @@ -1653,184 +1704,124 @@ def test_backspace_long_line_on_small_term( self_ ): self_.check_scenario( "", "\r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> " - "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\r\n" - "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\r\n", + "replxx> \r\n" + "replxx> \r\n" + "replxx> replxx" + "> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\r\n" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\r\n" + "", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n", dimensions = ( 10, 40 ) ) self_.check_scenario( "", "\r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> a qu ite lo ng li ne of sh ort wo rds wi " - "ll te st cu rs or mo ve me nta qu ite lo " - "ng li ne of sh ort wo rds wi ll te st cu rs or mo ve me " - "na qu ite lo ng li ne of sh ort wo rds wi " - "ll te st cu rs or mo ve me a qu ite lo ng " - "li ne of sh ort wo rds wi ll te st cu rs or mo ve " - "mea qu ite lo ng li ne of sh ort wo rds " - "wi ll te st cu rs or mo ve ma qu ite lo " - "ng li ne of sh ort wo rds wi ll te st cu rs or mo ve " - "a qu ite lo ng li ne of sh ort wo rds wi " - "ll te st cu rs or mo vea qu ite lo ng li " - "ne of sh ort wo rds wi ll te st cu rs or mo ve\r\n" - "a qu ite lo ng li ne of sh ort wo rds wi ll te st cu rs or mo ve\r\n", + "replxx> \r\n" + "replxx> \r\n" + "replxx> replxx" + "> a qu ite lo ng li ne of sh ort wo rds wi ll te st cu rs or mo ve me nt" + "a qu ite lo ng li ne of sh ort wo rds wi ll te st cu rs or mo ve me n" + "a qu ite lo ng li ne of sh ort wo rds wi ll te st cu rs or mo ve me " + "a qu ite lo ng li ne of sh ort wo rds wi ll te st cu rs or mo ve me" + "a qu ite lo ng li ne of sh ort wo rds wi ll te st cu rs or mo ve m" + "a qu ite lo ng li ne of sh ort wo rds wi ll te st cu rs or mo ve " + "a qu ite lo ng li ne of sh ort wo rds wi ll te st cu rs or mo ve" + "a qu ite lo ng li ne of sh ort wo rds wi ll te st cu rs or mo ve\r\n" + "a qu ite lo ng li ne of sh ort wo rds wi ll te st cu rs or mo ve\r\n" + "", "a qu ite lo ng li ne of sh ort wo rds wi ll te st cu rs or mo ve me nt\n", dimensions = ( 10, 40 ) ) def test_reverse_history_search_on_max_match( self_ ): self_.check_scenario( "", - "aaaaaaaaaaaaaaaaaaaaa(reverse-i-search)`': " - "aaaaaaaaaaaaaaaaaaaaareplxx> " - "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\r\n" - "aaaaaaaaaaaaaaaaaaaaa\r\n", + "replxx> aaaaaaaaaaaaaaaaaaaaa" + "(reverse-i-search)`': aaaaaaaaaaaaaaaaaaaaareplxx" + "> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\r\n" + "aaaaaaaaaaaaaaaaaaaaa\r\n" + "", "aaaaaaaaaaaaaaaaaaaaa\n" ) def test_no_terminal( self_ ): res = subprocess.run( [ ReplxxTests._cSample_, "q1" ], input = b"replxx FTW!\n", stdout = subprocess.PIPE, stderr = subprocess.PIPE ) self_.assertSequenceEqual( res.stdout, b"starting...\nreplxx FTW!\n\nExiting Replxx\n" ) + @_no_parallel + @unittest.skipIf( skip( "async" ), "timing-dependent; flaky on busy CI" ) def test_async_print( self_ ): self_.check_scenario( - [ "a", "b", "c", "d", "e", "f" ], [ - "0\r\n" - "replxx> " - "aab1\r\n" - "replxx> " - "ababcabcd2\r\n" - "replxx> " - "abcdabcdeabcdefabcdef\r\n" - "abcdef\r\n", - "0\r\n" - "replxx> " - "aab1\r\n" - "replxx> " - "ababcabcd2\r\n" - "replxx> " - "abcdabcdeabcdefabcdef\r\n" - "abcdef\r\n", - ], + [ "a", "b", "c", "d", "e", "f" ], ["0\r\n" +"replxx> aab" +"1\r\n" +"replxx> ababcabcd" +"2\r\n" +"replxx> abcdabcdeabcdef" +"abcdef\r\n" +"abcdef\r\n" +""], command = [ ReplxxTests._cxxSample_, "m" ], pause = 0.5 ) self_.check_scenario( - [ "", "a", "b", "c", "d", "e", "f" ], [ - "0\r\n" - "replxx> a very long line of " - "user input, wider then current terminal, the line is wrapped: " - "a very long line of user input, wider then current " - "terminal, the line is wrapped: a1\r\n" - "replxx> \r\n" - "\r\n" - "a very long line of user input, wider then current terminal, " - "the line is wrapped: aa very long line of user " - "input, wider then current terminal, the line is wrapped: " - "aba very long line of user input, wider then current " - "terminal, the line is wrapped: abc2\r\n" - "replxx> \r\n" - "\r\n" - "a very long line of user input, wider then current terminal, " - "the line is wrapped: abca very long line of user " - "input, wider then current terminal, the line is wrapped: " - "abcda very long line of user input, wider then " - "current terminal, the line is wrapped: abcde3\r\n" - "replxx> \r\n" - "\r\n" - "a very long line of user input, wider then current terminal, " - "the line is wrapped: abcdea very long line of user " - "input, wider then current terminal, the line is wrapped: " - "abcdefa very long line of user input, wider then " - "current terminal, the line is wrapped: abcdef\r\n" - "a very long line of user input, wider then current terminal, the line is " - "wrapped: abcdef\r\n", - "0\r\n" - "replxx> a very long line of user input, " - "wider then current terminal, the line is wrapped: a " - "very long line of user input, wider then current terminal, the line is " - "wrapped: a1\r\n" - "replxx> \r\n" - "\r\n" - "a very long line of user input, wider then current terminal, the " - "line is wrapped: aa very long line of user input, " - "wider then current terminal, the line is wrapped: " - "aba very long line of user input, wider then current " - "terminal, the line is wrapped: abc2\r\n" - "replxx> \r\n" - "\r\n" - "a very long line of user input, wider then current terminal, the " - "line is wrapped: abca very long line of user input, " - "wider then current terminal, the line is wrapped: " - "abcd3\r\n" - "replxx> \r\n" - "\r\n" - "a very long line of user input, wider then current terminal, the " - "line is wrapped: abcda very long line of user input, " - "wider then current terminal, the line is wrapped: " - "abcdea very long line of user input, wider then " - "current terminal, the line is wrapped: abcdefa very " - "long line of user input, wider then current terminal, the line is wrapped: " - "abcdef\r\n" - "a very long line of user input, wider then current terminal, the line is " - "wrapped: abcdef\r\n", - "0\r\n" - "replxx> a very long line of user input, wider then " - "current terminal, the line is wrapped: a very long " - "line of user input, wider then current terminal, the line is wrapped: " - "a1\r\n" - "replxx> \r\n" - "\r\n" - "a very long line of user input, wider then current terminal, the " - "line is wrapped: aa very long line of user input, " - "wider then current terminal, the line is wrapped: " - "aba very long line of user input, wider then current " - "terminal, the line is wrapped: abc2\r\n" - "replxx> \r\n" - "\r\n" - "a very long line of user input, wider then current terminal, the " - "line is wrapped: abca very long line of user input, " - "wider then current terminal, the line is wrapped: " - "abcd3\r\n" - "replxx> \r\n" - "\r\n" - "a very long line of user input, wider then current terminal, the " - "line is wrapped: abcda very long line of user input, " - "wider then current terminal, the line is wrapped: " - "abcdea very long line of user input, wider then " - "current terminal, the line is wrapped: abcdefa very " - "long line of user input, wider then current terminal, the line is wrapped: " - "abcdef\r\n" - "a very long line of user input, wider then current terminal, the line is " - "wrapped: abcdef\r\n" - ], + [ "", "a", "b", "c", "d", "e", "f" ], ["0\r\n" +"replxx> replxx" +"> a very long line of user input, wider then current terminal, the line is wrapped: " +"a very long line of user input, wider then current terminal, the line is wrapped: a1\r\n" +"replxx> \r\n" +"\r\n" +"a very long line of user input, wider then current terminal, the line is wrapped: a" +"a very long line of user input, wider then current terminal, the line is wra" +"pped: aba very long line of user input, wider then current terminal, th" +"e line is wrapped: abc2\r\n" +"replxx> \r\n" +"\r\n" +"a very long line of user input, wider then current terminal, the line is wrapped: abc" +"a very long line of user input, wider then current terminal, the line is wra" +"pped: abcda very long line of user input, wider then current terminal, " +"the line is wrapped: abcde3\r\n" +"replxx> \r\n" +"\r\n" +"a very long line of user input, wider then current terminal, the line is wrapped: abcde" +"a very long line of user input, wider then current terminal, the line is wra" +"pped: abcdefa very long line of user input, wider then current terminal" +", the line is wrapped: abcdef\r\n" +"a very long line of user input, wider then current terminal, the line is wrapped: abcdef\r\n" +""], "a very long line of user input, wider then current terminal, the line is wrapped: \n", command = [ ReplxxTests._cxxSample_, "m" ], dimensions = ( 10, 40 ), pause = 0.5 ) + @_no_parallel + @unittest.skipIf( skip( "async" ), "timing-dependent; flaky on busy CI" ) def test_async_emulate_key_press( self_ ): self_.check_scenario( [ "a", "b", "c", "d", "e", "f" ], [ - "11a" - "1ab1ab" - "21ab2" - "c1ab2" - "cd1ab2cd3" - "1ab2cd3e" - "1ab2cd3ef" - "1ab2cd3ef\r\n" - "1ab2cd3ef\r\n", - "1a1ab" - "1ab21ab" - "2c1ab2cd" - "1ab2cd31ab" - "2cd3e1ab2cd" - "3ef1ab2cd3ef\r\n" - "1ab2cd3ef\r\n" - ], + "1a1ab1" + "ab21ab2c1" + "ab2cd1ab2cd3" + "1ab2cd3e1ab2" + "cd3ef1ab2cd3ef\r\n" + "1ab2cd3ef\r\n" + "", + "11a1ab" + "1ab21ab2c" + "1ab2cd1ab2" + "cd31ab2cd3e" + "1ab2cd3ef1ab2" + "cd3ef\r\n" + "1ab2cd3ef\r\n" + "" + ], command = [ ReplxxTests._cxxSample_, "k123456" ], pause = 0.5 ) @@ -1843,97 +1834,101 @@ def test_special_keys( self_ ): "" "", "\r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" - "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "replxx> \r\n" + "" ) def test_overwrite_mode( self_ ): self_.check_scenario( "XYZ012345", - "abcdefghabcdefgh" - "" - "abXcdefghabXYcdefgh" - "abXYZcdefghabXYZ0defgh" - "abXYZ01efghabXYZ012fgh" - "abXYZ0123fghabXYZ01234fgh" - "abXYZ012345fghabXYZ012345fgh\r\n" - "abXYZ012345fgh\r\n", + "replxx> abcdefghabcdefgh" + "abcdefghabcdefghabXcdefghabXYcdefgh" + "abXYZcdefghabXYZ0defgh" + "abXYZ01efghabXYZ012fgh" + "abXYZ0123fghabXYZ01234fgh" + "abXYZ012345fghabXYZ012345fgh\r\n" + "abXYZ012345fgh\r\n" + "", "abcdefgh\n" ) def test_verbatim_insert( self_ ): self_.check_scenario( ["", rapid( "" ), ""], - "^[[2~^[[2~\r\n" + "^[[2~^[[2~" + "\r\n" "\r\n" + "" ) def test_hint_delay( self_ ): self_.check_scenario( ["han", ""], "hhahanhan\r\n" " hans\r\n" - " hansekoggehan\r\n" - "han\r\n", + " hansekoggehan\r\n" + "han\r\n" + "", command = [ ReplxxTests._cSample_, "q1", "H200" ] ) def test_complete_next( self_ ): self_.check_scenario( "", - "color_\r\n" + "replxx> color_\r\n" " color_black\r\n" " color_red\r\n" - " " - "color_greencolor_black" - "color_redcolor_blackcolor_\r\n" - + " color_greencolor_black" + "color_redcolor_blackcolor_" + "\r\n" " color_black\r\n" " color_red\r\n" - " " - "color_greencolor_whitecolor_white\r\n" - "color_white\r\n", + " color_greencolor_white" + "color_white\r\n" + "color_white\r\n" + "", "color_\n" ) self_.check_scenario( @@ -1941,15 +1936,16 @@ def test_complete_next( self_ ): "l\r\n" " lc_ctype\r\n" " lc_time\r\n" - " lc_messageslc_\r\n" + " lc_messageslc_\r\n" " lc_ctype\r\n" " lc_time\r\n" - " " - "lc_messageslc_ctypelc_timelc_ctypelc_\r\n" + " lc_messageslc_ctypelc_time" + "lc_ctypelc_\r\n" " lc_ctype\r\n" " lc_time\r\n" - " lc_messageslc_\r\n" - "lc_\r\n", + " lc_messageslc_\r\n" + "lc_\r\n" + "", command = [ ReplxxTests._cSample_, "xlc_ctype,lc_time,lc_messages,zoom", "I1", "q1" ] ) self_.check_scenario( @@ -1957,52 +1953,57 @@ def test_complete_next( self_ ): "l\r\n" " lc_ctype\r\n" " lc_time\r\n" - " lc_messageslc_\r\n" + " lc_messageslc_\r\n" " lc_ctype\r\n" " lc_time\r\n" - " " - "lc_messageslc_ctypelc_\r\n" + " lc_messageslc_ctypelc_\r\n" " lc_ctype\r\n" " lc_time\r\n" - " " - "lc_messageslc_messageslc_messages\r\n" - "lc_messages\r\n", + " lc_messageslc_messageslc_messages" + "\r\n" + "lc_messages\r\n" + "", command = [ ReplxxTests._cSample_, "xlc_ctype,lc_time,lc_messages,zoom", "I0", "q1" ] ) def test_disabled_handlers( self_ ): self_.check_scenario( "4", - "(+ 1 2)(+ 1 " - "2)(+ 1 " - ")(+ 1 " - "4)(+ 1 4)\r\n" - "thanks for the input: (+ 1 4)\r\n", - "(+ 1 2)\r\n", + "replxx> (+ 1 2)(+ 1 2)" + "(+ 1 )(+ 1 4)" + "(+ 1 4)\r\n" + "thanks for the input: (+ 1 4)\r\n" + "", + "(+ 1 2)\r\n", command = [ ReplxxTests._cSample_, "N", "S" ] ) def test_state_manipulation( self_ ): self_.check_scenario( "~", - "replxxREPLXXREP~LXXREP~LXX\r\n" - "REP~LXX\r\n", + "replxx> replxxREPLXXREP~LXX" + "REP~LXX\r\n" + "REP~LXX\r\n" + "", "replxx\n", command = [ ReplxxTests._cSample_, "q1" ] ) def test_modify_callback( self_ ): self_.check_scenario( "*", - "abcd12abcd12" - "" - "ababcd12cd12" - "ababcd12cd12\r\n" - "ababcd12cd12\r\n", + "replxx> abcd12" + "abcd12abcd12" + "abcd12ababcd12cd12" + "ababcd12cd12\r\n" + "ababcd12cd12\r\n" + "", "abcd12\n", command = [ ReplxxTests._cSample_, "q1", "M1" ] ) def test_paste( self_ ): self_.check_scenario( rapid( "abcdef" ), - "aabcdef\r\nabcdef\r\n" + "aabcdef\r\n" + "abcdef\r\n" + "" ) def test_history_merge( self_ ): with open( "replxx_history_alt.txt", "w" ) as f: @@ -2021,7 +2022,7 @@ def test_history_merge( self_ ): f.close() self_.check_scenario( "", - ".merge.merge\r\n", + "replxx> .merge.merge\r\n", "### 0000-00-00 00:00:00.002\n" "two\n" "### 0000-00-00 00:00:00.004\n" @@ -2071,1002 +2072,1076 @@ def test_history_save( self_ ): f.close() self_.check_scenario( "zoom.save", - "zzozoozoomzoom\r\n" + "zzozoozoom" + "zoom\r\n" "zoom\r\n" - "replxx> " - "..s.sa.sav.save.save\r\n" - "replxx> " - "zoomzoom\r\n" + "replxx> .." + "s.sa." + "sav.save." + "save\r\n" + "replxx> replxx> zoomzoom" + "\r\n" "zoom\r\n" + "" ) def test_bracketed_paste( self_ ): self_.check_scenario( "a0b1c2d3e4f", - "a" - "a0" - "a0b1c2d3e" - "a0b1c2d3e4" - "a0b1c2d3e4f" - "a0b1c2d3e4f\r\n" - "a0b1c2d3e4f\r\n", + "aa0a0" + "b1c2d3e" + "a0b1c2d3" + "e4a0b1" + "c2d3e4f" + "a0b1c2d3" + "e4f\r\n" + "a0b1c2d3e4f\r\n" + "", command = [ ReplxxTests._cSample_, "q1" ] ) self_.check_scenario( "a0b1c2d3e4f", - "a" - "a0" - "a0b1c2d3e" - "a0b1c2d3e4" - "a0b1c2d3e4f" - "a0b1c2d3e4f\r\n" - "a0b1c2d3e4f\r\n", + "aa0a0" + "b1c2d3e" + "a0b1c2d3" + "e4a0b1" + "c2d3e4f" + "a0b1c2d3" + "e4f\r\n" + "a0b1c2d3e4f\r\n" + "", command = [ ReplxxTests._cSample_, "q1", "B" ] ) self_.check_scenario( "a0/eb/dbx", - "aa0a0" - "a/eb0a/eb0\r\n" + "aa0a0" + "a/eb0a/eb0\r\n" "a/eb0\r\n" - "replxx> /db/db\r\n" + "replxx> /db/db\r\n" "/db\r\n" - "replxx> xx\r\n" - "x\r\n", + "replxx> xx\r\n" + "x\r\n" + "", command = [ ReplxxTests._cSample_, "q1" ] ) self_.check_scenario( "aaa\n\tbbb", - "\r\n", + "aaa\r\n" + " bbbaaa\r\n" + " bbaaa\r\n" + " baaa\r\n" + " aaa\r\n" + "aaaaaa" + "\r\n" + "replxx> \r\n", command = [ ReplxxTests._cxxSample_, "B" ] ) def test_embedded_newline( self_ ): self_.check_scenario( "", - "color_blue " - "color_redcolor_blue " - "color_redcolor_blue \r\n" + "replxx> color_blue color_red" + "color_blue color_redcolor_blue \r\n" "color_redcolor_blue \r\n" "color_red\r\n" "color_blue \r\n" - "color_red\r\n", + "color_red\r\n" + "", "color_blue color_red\n" ) def test_move_up_in_multiline( self_ ): self_.check_scenario( " ", - "color_blue\r\n" - "color_redcolor_blue\r\n" + "replxx> color_blue\r\n" + "color_redcolor_blue\r\n" "color_redc olor_blue\r\n" "color_redc olor_blue\r\n" "color_red\r\n" "c olor_blue\r\n" - "color_red\r\n", + "color_red\r\n" + "", "some other\ncolor_bluecolor_red\n" ) self_.check_scenario( " ", - "color_brightblue\r\n" - " " - "color_redcolor_brightblue\r\n" + "replxx> color_brightblue\r\n" + " color_redcolor_brightblue\r\n" " color_redcolor_bri ghtblue\r\n" " color_redcolor_bri ghtblue\r\n" " color_red\r\n" "color_bri ghtblue\r\n" - "color_red\r\n", + "color_red\r\n" + "", "some other\ncolor_brightbluecolor_red\n", command = [ ReplxxTests._cxxSample_, "I" ] ) self_.check_scenario( "x", - "bbbbbbbbbbbbbbbb\r\n" + "replxx> bbbbbbbbbbbbbbbb\r\n" + "bbbbbbbbbbbbbbbbbbbb\r\n" "bbbbbbbbbbbbbbbbbbbb\r\n" + "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\r\n" "bbbbbbbbbbbbbbbbbbbb\r\n" - "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\r\n" "bbbbbbbbbbbbbbbbbbbb\r\n" + "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\r\n" "bbbbbbbbbbbbbbbbbbbb\r\n" - "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbxbbbb\r\n" "bbbbbbbbbbbbbbbbbbbb\r\n" + "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\r\n" "bbbbbbbbbbbbbbbbbbbb\r\n" - "bbbbbbbbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\r\n" - "aaaaaaaaaaaaaaaaaaaa\r\n", + "bbbbbbbbbbbbbbbbbbbb\r\n" + "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbxbbbb\r\n" + "bbbbbbbbbbbbbbbbbbbb\r\n" + "bbbbbbbbbbbbbbbbbbbb\r\n" + "bbbbbbbbbbbbbbbbbbbbbbbreplxx> aaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaa\r\n" + "aaaaaaaaaaaaaaaaaaaa\r\n" + "", "aaaaaaaaaaaaaaaaaaaa\nbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\n" ) self_.check_scenario( "x", - "bbbbbbbbbbbbbbbb\r\n" + "replxx> bbbbbbbbbbbbbbbb\r\n" + " bbbbbbbbbbbbb\r\n" + " bbbbbbbbbbbbb\r\n" + " bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\r\n" " bbbbbbbbbbbbb\r\n" " bbbbbbbbbbbbb\r\n" - " bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\r\n" + " bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\r\n" " bbbbbbbbbbbbb\r\n" " bbbbbbbbbbbbb\r\n" - " " - "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbxbbb\r\n" + " bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\r\n" " bbbbbbbbbbbbb\r\n" " bbbbbbbbbbbbb\r\n" - " " - "bbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\r\n" - "aaaaaaaaaaaaaaaaaaaa\r\n", + " bbbbbbbbbbbbbbbbbbbbbbbbbbbbbxbbb\r\n" + " bbbbbbbbbbbbb\r\n" + " bbbbbbbbbbbbb\r\n" + " bbbbbbbbbbbbbbbbreplxx> aaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaa\r\n" + "aaaaaaaaaaaaaaaaaaaa\r\n" + "", "aaaaaaaaaaaaaaaaaaaa\nbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\n", command = [ ReplxxTests._cxxSample_, "I" ] ) def test_move_down_in_multiline( self_ ): self_.check_scenario( " ", - "some othercolor_red\r\n" - "color_bluecolor_red\r\n" - "color_bluecolor_red\r\n" + "replxx> some otherreplxx> " + "color_red\r\n" + "color_bluecolor_red\r\n" + "color_bluecolor_red\r\n" + "color_bluecolor_red\r\n" "color_bl uecolor_red\r\n" "color_bl ue\r\n" "color_red\r\n" - "color_bl ue\r\n", + "color_bl ue\r\n" + "", "some other\ncolor_redcolor_blue\n" ) self_.check_scenario( " ", - "some othercolor_red\r\n" - " color_bluecolor_red\r\n" - " " - "color_bluecolor_red\r\n" + "replxx> some otherreplxx> " + "color_red\r\n" + " color_bluecolor_red\r\n" + " color_bluecolor_red\r\n" + " color_bluecolor_red\r\n" " color_bluecolor_red\r\n" " color_blue\r\n" "color_red\r\n" - " color_blue\r\n", + " color_blue\r\n" + "", "some other\ncolor_redcolor_blue\n", command = [ ReplxxTests._cxxSample_, "I" ] ) self_.check_scenario( "x", - "bbbbbbbbbbbbbbbbbbbbbbb\r\n" + "replxx> bbbbbbbbbbbbbbbbbbbbbbb\r\n" + "bbbbbbbbbbbbbbbbbbbb\r\n" + "bbbbbbbbbbbbbbbbbbbb\r\n" + "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\r\n" + "bbbbbbbbbbbbbbbbbbbb\r\n" "bbbbbbbbbbbbbbbbbbbb\r\n" + "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\r\n" "bbbbbbbbbbbbbbbbbbbb\r\n" - "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\r\n" "bbbbbbbbbbbbbbbbbbbb\r\n" + "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\r\n" "bbbbbbbbbbbbbbbbbbbb\r\n" - "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\r\n" "bbbbbbbbbbbbbbbbbbbb\r\n" + "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\r\n" "bbbbbbbbbbbbbbbbbbbb\r\n" - "bbbbbbbbxbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\r\n" - "aaaaaaaaaaaaaaaaaaaa\r\n", + "bbbbbbbbbbbbbbbbbbbb\r\n" + "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\r\n" + "bbbbbbbbbbbbbbbbbbbb\r\n" + "bbbbbbbbbbbbbbbbbbbb\r\n" + "bbbbbbbbxbbbbbbbbreplxx> aaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaa\r\n" + "aaaaaaaaaaaaaaaaaaaa\r\n" + "", "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\naaaaaaaaaaaaaaaaaaaa\n" ) self_.check_scenario( "x", - "bbbbbbbbbbbbbbbbbbbbbbb\r\n" + "replxx> bbbbbbbbbbbbbbbbbbbbbbb\r\n" + " bbbbbbbbbbbbbbbbbbbb\r\n" + " bbbbbbbbbbbbbbbbbbbb\r\n" + " bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\r\n" " bbbbbbbbbbbbbbbbbbbb\r\n" " bbbbbbbbbbbbbbbbbbbb\r\n" - " bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\r\n" + " bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\r\n" " bbbbbbbbbbbbbbbbbbbb\r\n" " bbbbbbbbbbbbbbbbbbbb\r\n" - " " - "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\r\n" + " bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\r\n" " bbbbbbbbbbbbbbbbbbbb\r\n" " bbbbbbbbbbbbbbbbbbbb\r\n" - " " - "xbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\r\n" - "aaaaaaaaaaaaaaaaaaaa\r\n", + " bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\r\n" + " bbbbbbbbbbbbbbbbbbbb\r\n" + " bbbbbbbbbbbbbbbbbbbb\r\n" + " bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\r\n" + " bbbbbbbbbbbbbbbbbbbb\r\n" + " bbbbbbbbbbbbbbbbbbbb\r\n" + " xbbbbbbbbbbbbbbbbreplxx> aaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaa\r\n" + "aaaaaaaaaaaaaaaaaaaa\r\n" + "", "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\naaaaaaaaaaaaaaaaaaaa\n", command = [ ReplxxTests._cxxSample_, "I" ] ) def test_go_to_beginning_of_multiline_entry( self_ ): self_.check_scenario( "x ", - "color_red\r\n" + "replxx> color_red\r\n" "color_blue\r\n" - "zzzzzzcolor_red\r\n" + "zzzzzzcolor_red\r\n" "color_blue\r\n" "zzzzzzxcolor_red\r\n" "color_blue\r\n" "zzzzzzx color_red\r\n" "color_blue\r\n" - "zzzzzzsome othersome " - "other\r\n" - "some other\r\n", + "zzzzzzx color_red\r\n" + "color_blue\r\n" + "zzzzzzreplxx> some othersome other" + "\r\n" + "some other\r\n" + "", "some other\ncolor_redcolor_bluezzzzzz\n" ) def test_go_to_end_of_multiline_entry( self_ ): self_.check_scenario( "x ", - "123color_red " - "color_green\r\n" + "replxx> 123replxx> " + "color_red color_green\r\n" "color_blue color_yellow\r\n" - "zzzzzzcolor_red color_green\r\n" + "zzzzzzcolor_red color_green\r\n" "color_blue color_yellow\r\n" "zzzzzzxcolor_red color_green\r\n" "color_blue color_yellow\r\n" - "zzzzzzx color_red " - "color_green\r\n" + "zzzzzzx color_red color_green\r\n" "color_blue color_yellow\r\n" - "zzzzzzx color_red " - "color_green\r\n" + "zzzzzzx color_red color_green\r\n" "color_blue color_yellow\r\n" - "zzzzzz\r\n", + "zzzzzzreplxx> \r\n" + "", "some other\ncolor_red color_greencolor_blue color_yellowzzzzzz\n123\n" ) def test_move_to_beginning_of_line_in_multiline( self_ ): self_.check_scenario( "x x x ", - "color_red more text\r\n" + "replxx> color_red more text\r\n" "color_blue 123\r\n" - "color_green zzzcolor_red more " - "text\r\n" + "color_green zzzcolor_red more text\r\n" "color_blue 123\r\n" - "color_green zzzcolor_red more " - "text\r\n" + "color_green zzzcolor_red more text\r\n" "color_blue 123\r\n" "xcolor_green zzzcolor_red more text\r\n" "color_blue 123\r\n" - "x color_green " - "zzzcolor_red more text\r\n" + "x color_green zzzcolor_red more text\r\n" + "color_blue 123\r\n" + "x color_green zzzcolor_red more text\r\n" + "color_blue 123\r\n" + "x color_green zzzcolor_red more text\r\n" + "color_blue 123\r\n" + "x color_green zzzcolor_red more text\r\n" "xcolor_blue 123\r\n" - "x color_green zzzcolor_red " - "more text\r\n" + "x color_green zzzcolor_red more text\r\n" + "x color_blue 123\r\n" + "x color_green zzzcolor_red more text\r\n" + "x color_blue 123\r\n" + "x color_green zzzcolor_red more text\r\n" + "x color_blue 123\r\n" + "x color_green zzzcolor_red more text\r\n" "x color_blue 123\r\n" - "x color_green " - "zzzxcolor_red more text\r\n" + "x color_green zzzxcolor_red more text\r\n" "x color_blue 123\r\n" - "x color_green zzzx color_red " - "more text\r\n" + "x color_green zzzx color_red more text\r\n" "x color_blue 123\r\n" - "x color_green zzzx color_red " - "more text\r\n" + "x color_green zzzx color_red more text\r\n" "x color_blue 123\r\n" "x color_green zzz\r\n" "x color_red more text\r\n" "x color_blue 123\r\n" - "x color_green zzz\r\n", + "x color_green zzz\r\n" + "", "color_red more textcolor_blue 123color_green zzz\n" ) self_.check_scenario( "", - "first line of text\r\n" + "replxx> first line of text\r\n" "second verse of a poem\r\n" "next passage of a scripture\r\n" - "last line of a codefirst line of text\r\n" + "last line of a codefirst line of text\r\n" "second verse of a poem\r\n" "next passage of a scripture\r\n" - "last line of a codefirst line of text\r\n" + "last line of a codefirst line of text\r\n" + "second verse of a poem\r\n" + "next passage of a scripture\r\n" + "last line of a codefirst line of text\r\n" + "second verse of a poem\r\n" + "next passage of a scripture\r\n" + "last line of a codefirst line of text\r\n" "second verse of a poem\r\n" "next passage of a scripture\r\n" "last line of a code\r\n" "first line of text\r\n" "second verse of a poem\r\n" "next passage of a scripture\r\n" - "last line of a code\r\n", + "last line of a code\r\n" + "", "first line of textsecond verse of a poemnext passage of a scripturelast line of a code\n" ) def test_move_to_end_of_line_in_multiline( self_ ): self_.check_scenario( "x xxx", - "color_red more text\r\n" + "replxx> color_red more text\r\n" "color_blue 123\r\n" - "color_green zzzcolor_red more " - "text\r\n" + "color_green zzzcolor_red more text\r\n" "color_blue 123\r\n" "color_green zzzxcolor_red more text\r\n" "color_blue 123\r\n" - "color_green zzzx color_red " - "more text\r\n" + "color_green zzzx color_red more text\r\n" + "color_blue 123\r\n" + "color_green zzzx color_red more text\r\n" "color_blue 123\r\n" - "color_green zzzx " - "color_red more textx\r\n" + "color_green zzzx color_red more textx\r\n" "color_blue 123\r\n" - "color_green zzzx " - "color_red more textx\r\n" + "color_green zzzx color_red more textx\r\n" + "color_blue 123\r\n" + "color_green zzzx color_red more textx\r\n" + "color_blue 123\r\n" + "color_green zzzx color_red more textx\r\n" + "color_blue 123x\r\n" + "color_green zzzx color_red more textx\r\n" "color_blue 123x\r\n" - "color_green zzzx " - "color_red more textx\r\n" + "color_green zzzx color_red more textx\r\n" "color_blue 123x\r\n" - "color_green zzzx color_red " - "more textx\r\n" + "color_green zzzx color_red more textx\r\n" "color_blue 123x\r\n" - "color_green zzzxx color_red " - "more textx\r\n" + "color_green zzzxx color_red more textx\r\n" "color_blue 123x\r\n" "color_green zzzx\r\n" "x color_red more textx\r\n" "color_blue 123x\r\n" - "color_green zzzx\r\n", + "color_green zzzx\r\n" + "", "color_red more textcolor_blue 123color_green zzz\n" ) self_.check_scenario( "", - "first line of text\r\n" + "replxx> first line of text\r\n" "second verse of a poem\r\n" "next passage of a scripture\r\n" - "last line of a codefirst line of text\r\n" + "last line of a codefirst line of text\r\n" "second verse of a poem\r\n" "next passage of a scripture\r\n" - "last line of a codefirst line of " - "text\r\n" + "last line of a codefirst line of text\r\n" "second verse of a poem\r\n" "next passage of a scripture\r\n" - "last line of a codefirst line of text\r\n" + "last line of a codefirst line of text\r\n" + "second verse of a poem\r\n" + "next passage of a scripture\r\n" + "last line of a codefirst line of text\r\n" + "second verse of a poem\r\n" + "next passage of a scripture\r\n" + "last line of a codefirst line of text\r\n" "second verse of a poem\r\n" "next passage of a scripture\r\n" "last line of a code\r\n" "first line of text\r\n" "second verse of a poem\r\n" "next passage of a scripture\r\n" - "last line of a code\r\n", + "last line of a code\r\n" + "", "first line of textsecond verse of a poemnext passage of a scripturelast line of a code\n" ) def test_hints_in_multiline( self_ ): self_.check_scenario( "", - "some text\r\n" + "replxx> some text\r\n" "color_b\r\n" "color_black\r\n" "color_brown\r\n" - "color_bluesome text\r\n" + "color_bluesome text\r\n" "color_black\r\n" "color_brown\r\n" "color_blue\r\n" - "color_brightredsome text\r\n" + "color_brightredsome text\r\n" "color_b\r\n" "some text\r\n" - "color_b\r\n", + "color_b\r\n" + "", "some textcolor_b\n" ) self_.check_scenario( "", - "some long text\r\n" + "replxx> some long text\r\n" " color_br\r\n" " color_brown\r\n" " color_brightred\r\n" - " color_brightgreensome long text\r\n" + " color_brightgreensome long text\r\n" " color_brown\r\n" " color_brightred\r\n" " color_brightgreen\r\n" - " color_brightbluesome long text\r\n" + " color_brightbluesome long text\r\n" " color_br\r\n" "some long text\r\n" - "color_br\r\n", + "color_br\r\n" + "", "some long textcolor_br\n", command = [ ReplxxTests._cxxSample_, "I" ] ) self_.check_scenario( "", - "some text\r\n" + "replxx> some text\r\n" "not on start color_b\r\n" " color_black\r\n" " color_brown\r\n" - " color_bluesome text\r\n" + " color_bluesome text\r\n" "not on start color_black\r\n" " color_brown\r\n" " color_blue\r\n" - " color_brightredsome text\r\n" + " color_brightredsome text\r\n" "not on start color_b\r\n" "some text\r\n" - "not on start color_b\r\n", + "not on start color_b\r\n" + "", "some textnot on start color_b\n" ) self_.check_scenario( "", - "some text\r\n" + "replxx> some text\r\n" " not on start color_br\r\n" " color_brown\r\n" " color_brightred\r\n" - " color_brightgreensome " - "text\r\n" + " color_brightgreensome text\r\n" " not on start color_brown\r\n" " color_brightred\r\n" " color_brightgreen\r\n" - " color_brightbluesome " - "text\r\n" + " color_brightbluesome text\r\n" " not on start color_br\r\n" "some text\r\n" - "not on start color_br\r\n", + "not on start color_br\r\n" + "", "some textnot on start color_br\n", command = [ ReplxxTests._cxxSample_, "I" ] ) + @_no_parallel + @unittest.skipIf( skip( "async" ), "timing-dependent; flaky on busy CI" ) def test_async_prompt( self_ ): self_.check_scenario( [ "", "r", "i", "g", "h", "t", "g" ], [ - "replxx[-]> long line " - "color_green and color_b\r\n" - " color_black\r\n" - " color_brown\r\n" - " " - "color_bluereplxx[\\]> " - "long line color_green and color_b\r\n" - " color_black\r\n" - " color_brown\r\n" - " " - "color_bluereplxx[|]> " - "long line color_green and color_b\r\n" - " color_black\r\n" - " color_brown\r\n" - " color_bluelong " - "line color_green and color_br\r\n" - " color_brown\r\n" - " color_brightred\r\n" - " " - "color_brightgreenreplxx[/]> " - "long line color_green and color_br\r\n" - " color_brown\r\n" - " color_brightred\r\n" - " " - "color_brightgreenreplxx[-]> " - "long line color_green and color_br\r\n" - " color_brown\r\n" - " color_brightred\r\n" - " " - "color_brightgreenreplxx[\\]> " - "long line color_green and color_br\r\n" - " color_brown\r\n" - " color_brightred\r\n" - " " - "color_brightgreenlong line color_green " - "and color_bri\r\n" - " color_brightred\r\n" - " color_brightgreen\r\n" - " " - "color_brightbluereplxx[|]> " - "long line color_green and color_bri\r\n" - " color_brightred\r\n" - " color_brightgreen\r\n" - " " - "color_brightbluereplxx[/]> " - "long line color_green and color_bri\r\n" - " color_brightred\r\n" - " color_brightgreen\r\n" - " " - "color_brightbluelong line color_green " - "and color_brig\r\n" - " color_brightred\r\n" - " color_brightgreen\r\n" - " " - "color_brightbluereplxx[-]> " - "long line color_green and color_brig\r\n" - " color_brightred\r\n" - " color_brightgreen\r\n" - " " - "color_brightbluereplxx[\\]> " - "long line color_green and color_brig\r\n" - " color_brightred\r\n" - " color_brightgreen\r\n" - " " - "color_brightbluelong line color_green " - "and color_brigh\r\n" - " color_brightred\r\n" - " color_brightgreen\r\n" - " " - "color_brightbluereplxx[|]> " - "long line color_green and color_brigh\r\n" - " color_brightred\r\n" - " color_brightgreen\r\n" - " " - "color_brightbluereplxx[/]> " - "long line color_green and color_brigh\r\n" - " color_brightred\r\n" - " color_brightgreen\r\n" - " " - "color_brightbluelong line color_green " - "and color_bright\r\n" - " color_brightred\r\n" - " color_brightgreen\r\n" - " " - "color_brightbluereplxx[-]> " - "long line color_green and color_bright\r\n" - " color_brightred\r\n" - " color_brightgreen\r\n" - " " - "color_brightbluereplxx[\\]> " - "long line color_green and color_bright\r\n" - " color_brightred\r\n" - " color_brightgreen\r\n" - " " - "color_brightbluelong line color_green " - "and " - "color_brightgreenreplxx[|]> " - "long line color_green and " - "color_brightgreenlong line " - "color_green and " - "color_brightgreenlong line " - "color_green and " - "color_brightgreen\r\n" - "long line color_green and color_brightgreen\r\n", - "replxx[-]> long line " - "color_green and color_b\r\n" - " color_black\r\n" - " color_brown\r\n" - " " - "color_bluereplxx[\\]> " - "long line color_green and color_b\r\n" - " color_black\r\n" - " color_brown\r\n" - " " - "color_bluereplxx[|]> " - "long line color_green and color_b\r\n" - " color_black\r\n" - " color_brown\r\n" - " color_bluelong " - "line color_green and color_br\r\n" - " color_brown\r\n" - " color_brightred\r\n" - " " - "color_brightgreenreplxx[/]> " - "long line color_green and color_br\r\n" - " color_brown\r\n" - " color_brightred\r\n" - " " - "color_brightgreenreplxx[-]> " - "long line color_green and color_br\r\n" - " color_brown\r\n" - " color_brightred\r\n" - " " - "color_brightgreenreplxx[\\]> " - "long line color_green and color_br\r\n" - " color_brown\r\n" - " color_brightred\r\n" - " " - "color_brightgreenlong line color_green " - "and color_bri\r\n" - " color_brightred\r\n" - " color_brightgreen\r\n" - " " - "color_brightbluereplxx[|]> " - "long line color_green and color_bri\r\n" - " color_brightred\r\n" - " color_brightgreen\r\n" - " " - "color_brightbluereplxx[/]> " - "long line color_green and color_bri\r\n" - " color_brightred\r\n" - " color_brightgreen\r\n" - " " - "color_brightbluelong line color_green " - "and color_brig\r\n" - " color_brightred\r\n" - " color_brightgreen\r\n" - " " - "color_brightbluereplxx[-]> " - "long line color_green and color_brig\r\n" - " color_brightred\r\n" - " color_brightgreen\r\n" - " " - "color_brightbluereplxx[\\]> " - "long line color_green and color_brig\r\n" - " color_brightred\r\n" - " color_brightgreen\r\n" - " " - "color_brightbluelong line color_green " - "and color_brigh\r\n" - " color_brightred\r\n" - " color_brightgreen\r\n" - " " - "color_brightbluereplxx[|]> " - "long line color_green and color_brigh\r\n" - " color_brightred\r\n" - " color_brightgreen\r\n" - " " - "color_brightbluereplxx[/]> " - "long line color_green and color_brigh\r\n" - " color_brightred\r\n" - " color_brightgreen\r\n" - " " - "color_brightbluelong line color_green " - "and color_bright\r\n" - " color_brightred\r\n" - " color_brightgreen\r\n" - " " - "color_brightbluereplxx[-]> " - "long line color_green and color_bright\r\n" - " color_brightred\r\n" - " color_brightgreen\r\n" - " " - "color_brightbluereplxx[\\]> " - "long line color_green and color_bright\r\n" - " color_brightred\r\n" - " color_brightgreen\r\n" - " " - "color_brightbluelong line color_green " - "and " - "color_brightgreenreplxx[|]> " - "long line color_green and " - "color_brightgreenlong line " - "color_green and " - "color_brightgreenlong line " - "color_green and " - "color_brightgreen\r\n" - "long line color_green and color_brightgreen\r\n" - "replxx> \r\n" - ], + "replxx[-]> replxx" + "[-]> long line color_green and color_b\r\n" + " color_black\r\n" + " color_brown\r\n" + " color_bluereplxx" + "[\\]> long line color_green and color_b\r\n" + " color_black\r\n" + " color_brown\r\n" + " color_bluereplxx" + "[|]> long line color_green and color_b\r\n" + " color_black\r\n" + " color_brown\r\n" + " color_bluelong line color_green" + " and color_br\r\n" + " color_brown\r\n" + " color_brightred\r\n" + " color_brightgreen" + "replxx[/]> long line color_green and color_br\r\n" + " color_brown\r\n" + " color_brightred\r\n" + " color_brightgreen" + "replxx[-]> long line color_green and color_br\r\n" + " color_brown\r\n" + " color_brightred\r\n" + " color_brightgreen" + "replxx[\\]> long line color_green and color_br\r\n" + " color_brown\r\n" + " color_brightred\r\n" + " color_brightgreen" + "long line color_green and color_bri\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "replxx[|]> long line color_green and color_bri\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "replxx[/]> long line color_green and color_bri\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "long line color_green and color_brig\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "replxx[-]> long line color_green and color_brig\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "replxx[\\]> long line color_green and color_brig\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "long line color_green and color_brigh\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "replxx[|]> long line color_green and color_brigh\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "replxx[/]> long line color_green and color_brigh\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "long line color_green and color_bright\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "replxx[-]> long line color_green and color_bright\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "replxx[\\]> long line color_green and color_bright\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "long line color_green and color_brightgreen" + "replxx[|]> long line color_green and color_brightg" + "reenlong line color_green and color_brightgreen" + "long line color_green and color_brightgreen\r\n" + "long line color_green and color_brightgreen\r\n" + "replxx> \r\n", + "0\r\n" + "replxx[-]> replxx[-]> " + "111a" + "replxx[\\]> 1areplxx" + "[|]> 1a1ab" + "replxx[/]> 1ab1\r\n" + "replxx[-]> 1abreplxx" + "[-]> 1ab21ab2" + "1ab2creplxx[\\]> " + "1ab2creplxx[|]> 1" + "ab2c1ab2cd" + "replxx[/]> 1ab2cd2\r\n" + "replxx[-]> 1ab2cd" + "replxx[-]> 1ab2cd3" + "1ab2cd3replxx[\\]> " + "1ab2cd31ab2" + "cd3ereplxx[|]> 1" + "ab2cd3ereplxx[/]> " + "1ab2cd3e1ab2" + "cd3ef3\r\n" + "replxx[-]> 1ab2cd3ef" + "replxx[-]> 1ab2cd3ef4" + "1ab2cd3ef4" + "replxx[\\]> 1ab2cd3ef4" + "1ab2cd3ef4g" + "1ab2cd3ef4g\r\n" + "1ab2cd3ef4g\r\n" + "replxx> \r\n", + "0\r\n" + "replxx> replxx[-]> 1" + "11a" + "replxx[\\]> 1areplxx" + "[|]> 1a1ab" + "replxx[/]> 1ab1\r\n" + "replxx[-]> 1abreplxx" + "[-]> 1ab21ab2" + "1ab2creplxx[\\]> " + "1ab2creplxx[|]> 1" + "ab2c1ab2cd" + "replxx[/]> 1ab2cd2\r\n" + "replxx[-]> 1ab2cd" + "replxx[-]> 1ab2cd3" + "1ab2cd3replxx[\\]> " + "1ab2cd31ab2" + "cd3ereplxx[|]> 1" + "ab2cd3ereplxx[/]> " + "1ab2cd3e1ab2" + "cd3ef3\r\n" + "replxx[-]> 1ab2cd3ef" + "replxx[-]> 1ab2cd3ef4" + "1ab2cd3ef4" + "replxx[\\]> 1ab2cd3ef4" + "1ab2cd3ef4g" + "1ab2cd3ef4g\r\n" + "1ab2cd3ef4g\r\n" + "replxx> replxx[|]> \r\n", + "0\r\n" + "replxx> replxx[-]> " + "areplxx[\\]> a" + "replxx[|]> aab" + "replxx[/]> ab1\r\n" + "replxx[-]> abreplxx[-]> ab" + "abcreplxx[\\]> abc" + "replxx[|]> abcreplxx" + "[/]> abcabcd2\r\n" + "replxx[-]> abcdreplxx[-]> " + "abcdreplxx[\\]> abcdabcde" + "replxx[|]> abcde" + "replxx[/]> abcdeabcdef3\r\n" + "replxx[-]> abcdefreplxx[-]> " + "abcdefreplxx[\\]> abcdef" + "abcdefgreplxx[|]> abcdefg" + "abcdefg\r\n" + "abcdefg\r\n" + "replxx> \r\n", + "0\r\n" + "replxx[-]> 11a" + "replxx[-]> 1areplxx" + "[\\]> 1areplxx[|]> 1a" + "1abreplxx[/]> " + "1ab1\r\n" + "replxx[-]> 1abreplxx" + "[-]> 1ab21ab2" + "1ab2creplxx[\\]> " + "1ab2creplxx[|]> 1" + "ab2c1ab2cd" + "replxx[/]> 1ab2cd2\r\n" + "replxx[-]> 1ab2cd" + "replxx[-]> 1ab2cd3" + "1ab2cd3replxx[\\]> " + "1ab2cd31ab2" + "cd3ereplxx[|]> 1" + "ab2cd3ereplxx[/]> " + "1ab2cd3e1ab2" + "cd3ef3\r\n" + "replxx[-]> 1ab2cd3ef" + "replxx[-]> 1ab2cd3ef4" + "1ab2cd3ef4" + "replxx[\\]> 1ab2cd3ef4" + "1ab2cd3ef4g" + "1ab2cd3ef4g\r\n" + "1ab2cd3ef4g\r\n" + "replxx> replxx[|]> \r\n", + "replxx> long line color_green and color_b\r\n" + " color_black\r\n" + " color_brown\r\n" + " color_bluereplxx" + "[\\]> long line color_green and color_b\r\n" + " color_black\r\n" + " color_brown\r\n" + " color_bluereplxx" + "[|]> long line color_green and color_b\r\n" + " color_black\r\n" + " color_brown\r\n" + " color_bluelong line color_green" + " and color_br\r\n" + " color_brown\r\n" + " color_brightred\r\n" + " color_brightgreen" + "replxx[/]> long line color_green and color_br\r\n" + " color_brown\r\n" + " color_brightred\r\n" + " color_brightgreen" + "replxx[-]> long line color_green and color_br\r\n" + " color_brown\r\n" + " color_brightred\r\n" + " color_brightgreen" + "replxx[\\]> long line color_green and color_br\r\n" + " color_brown\r\n" + " color_brightred\r\n" + " color_brightgreen" + "long line color_green and color_bri\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "replxx[|]> long line color_green and color_bri\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "replxx[/]> long line color_green and color_bri\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "long line color_green and color_brig\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "replxx[-]> long line color_green and color_brig\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "replxx[\\]> long line color_green and color_brig\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "long line color_green and color_brigh\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "replxx[|]> long line color_green and color_brigh\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "replxx[/]> long line color_green and color_brigh\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "long line color_green and color_bright\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "replxx[-]> long line color_green and color_bright\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "replxx[\\]> long line color_green and color_bright\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "long line color_green and color_brightgreen" + "replxx[|]> long line color_green and color_brightg" + "reenlong line color_green and color_brightgreen" + "long line color_green and color_brightgreen\r\n" + "long line color_green and color_brightgreen\r\n" + "replxx> \r\n", + "replxx[-]> replxx" + "[-]> long line color_green and color_b\r\n" + " color_black\r\n" + " color_brown\r\n" + " color_bluereplxx" + "[\\]> long line color_green and color_b\r\n" + " color_black\r\n" + " color_brown\r\n" + " color_bluereplxx" + "[|]> long line color_green and color_b\r\n" + " color_black\r\n" + " color_brown\r\n" + " color_bluelong line color_green" + " and color_br\r\n" + " color_brown\r\n" + " color_brightred\r\n" + " color_brightgreen" + "replxx[/]> long line color_green and color_br\r\n" + " color_brown\r\n" + " color_brightred\r\n" + " color_brightgreen" + "replxx[-]> long line color_green and color_br\r\n" + " color_brown\r\n" + " color_brightred\r\n" + " color_brightgreen" + "replxx[\\]> long line color_green and color_br\r\n" + " color_brown\r\n" + " color_brightred\r\n" + " color_brightgreen" + "long line color_green and color_bri\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "replxx[|]> long line color_green and color_bri\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "replxx[/]> long line color_green and color_bri\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "long line color_green and color_brig\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "replxx[-]> long line color_green and color_brig\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "replxx[\\]> long line color_green and color_brig\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "long line color_green and color_brigh\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "replxx[|]> long line color_green and color_brigh\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "replxx[/]> long line color_green and color_brigh\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "long line color_green and color_bright\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "replxx[-]> long line color_green and color_bright\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "replxx[\\]> long line color_green and color_bright\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "replxx[|]> long line color_green and color_bright\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "long line color_green and color_brightgreen" + "long line color_green and color_brightgreen" + "long line color_green and color_brightgreen\r\n" + "long line color_green and color_brightgreen\r\n" + "replxx> \r\n", + "replxx[-]> replxx" + "[-]> long line color_green and color_b\r\n" + " color_black\r\n" + " color_brown\r\n" + " color_bluereplxx" + "[\\]> long line color_green and color_b\r\n" + " color_black\r\n" + " color_brown\r\n" + " color_bluereplxx" + "[|]> long line color_green and color_b\r\n" + " color_black\r\n" + " color_brown\r\n" + " color_bluereplxx" + "[/]> long line color_green and color_b\r\n" + " color_black\r\n" + " color_brown\r\n" + " color_bluelong line color_green" + " and color_br\r\n" + " color_brown\r\n" + " color_brightred\r\n" + " color_brightgreen" + "replxx[-]> long line color_green and color_br\r\n" + " color_brown\r\n" + " color_brightred\r\n" + " color_brightgreen" + "replxx[\\]> long line color_green and color_br\r\n" + " color_brown\r\n" + " color_brightred\r\n" + " color_brightgreen" + "long line color_green and color_bri\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "replxx[|]> long line color_green and color_bri\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "replxx[/]> long line color_green and color_bri\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "long line color_green and color_brig\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "replxx[-]> long line color_green and color_brig\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "replxx[\\]> long line color_green and color_brig\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "long line color_green and color_brigh\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "replxx[|]> long line color_green and color_brigh\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "replxx[/]> long line color_green and color_brigh\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "long line color_green and color_bright\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "replxx[-]> long line color_green and color_bright\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "replxx[\\]> long line color_green and color_bright\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "replxx[|]> long line color_green and color_bright\r\n" + " color_brightred\r\n" + " color_brightgreen\r\n" + " color_brightblue" + "long line color_green and color_brightgreen" + "long line color_green and color_brightgreen" + "long line color_green and color_brightgreen\r\n" + "long line color_green and color_brightgreen\r\n" + "replxx> \r\n" + ], "long line color_green and color_b\n", command = [ ReplxxTests._cxxSample_, "F" ], pause = 0.5 ) self_.check_scenario( - [ "a", "b", "c", "d", "e", "f", "g" ], [ - "0\r\n" - "replxx[-]> " - "replxx[-]> " - "areplxx[\\]> " - "areplxx[|]> " - "aabreplxx[/]> " - "ab1\r\n" - "replxx[-]> " - "abreplxx[-]> " - "ababcreplxx[\\]> " - "abcreplxx[|]> " - "abcreplxx[/]> " - "abcabcd2\r\n" - "replxx[-]> " - "abcdreplxx[-]> " - "abcdreplxx[\\]> " - "abcdabcdereplxx[|]> " - "abcdereplxx[/]> " - "abcdeabcdef3\r\n" - "replxx[-]> " - "abcdefreplxx[-]> " - "abcdefreplxx[\\]> " - "abcdefabcdefgreplxx[|]> " - "abcdefgabcdefg\r\n" - "abcdefg\r\n" - "replxx> \r\n", - "0\r\n" - "replxx[-]> " - "replxx[-]> " - "areplxx[\\]> " - "areplxx[|]> " - "aabreplxx[/]> " - "ab1\r\n" - "replxx[-]> " - "abreplxx[-]> " - "ababcreplxx[\\]> " - "abcreplxx[|]> " - "abcreplxx[/]> " - "abcabcd2\r\n" - "replxx[-]> " - "abcdreplxx[-]> " - "abcdreplxx[\\]> " - "abcdabcdereplxx[|]> " - "abcdereplxx[/]> " - "abcdeabcdef3\r\n" - "replxx[-]> " - "abcdefreplxx[-]> " - "abcdefreplxx[\\]> " - "abcdefabcdefgreplxx[|]> " - "abcdefgabcdefg\r\n" - "abcdefg\r\n", - "0\r\n" - "replxx[-]> " - "replxx[-]> " - "areplxx[\\]> " - "areplxx[|]> " - "aabreplxx[/]> " - "ab1\r\n" - "replxx[-]> " - "abreplxx[-]> " - "abreplxx[\\]> " - "ababcreplxx[|]> " - "abcreplxx[/]> " - "abcabcd2\r\n" - "replxx[-]> " - "abcdreplxx[-]> " - "abcdreplxx[\\]> " - "abcdabcdereplxx[|]> " - "abcdereplxx[/]> " - "abcdeabcdef3\r\n" - "replxx[-]> " - "abcdefreplxx[-]> " - "abcdefreplxx[\\]> " - "abcdefabcdefgreplxx[|]> " - "abcdefgabcdefg\r\n" - "abcdefg\r\n", - "0\r\n" - "replxx[-]> " - "replxx[-]> " - "areplxx[\\]> " - "areplxx[|]> " - "aabreplxx[/]> " - "ab1\r\n" - "replxx[-]> " - "abreplxx[-]> " - "abreplxx[\\]> " - "ababcreplxx[|]> " - "abcreplxx[/]> " - "abcabcd2\r\n" - "replxx[-]> " - "abcdreplxx[-]> " - "abcdreplxx[\\]> " - "abcdabcdereplxx[|]> " - "abcdereplxx[/]> " - "abcdeabcdef3\r\n" - "replxx[-]> " - "abcdefreplxx[-]> " - "abcdefreplxx[\\]> " - "abcdefabcdefgreplxx[|]> " - "abcdefgabcdefg\r\n" - "abcdefg\r\n" - "replxx> \r\n" - ], + [ "a", "b", "c", "d", "e", "f", "g" ], ["0\r\n" +"replxx[-]> replxx[-]> " +"areplxx[\\]> a" +"replxx[|]> aab" +"replxx[/]> ab1\r\n" +"replxx[-]> abreplxx" +"[-]> ababcreplxx" +"[\\]> abcreplxx[|]> abc" +"replxx[/]> abcabcd" +"2\r\n" +"replxx[-]> abcdreplxx" +"[-]> abcdreplxx[\\]> abcd" +"abcdereplxx[|]> abcde" +"replxx[/]> abcdeabcdef" +"3\r\n" +"replxx[-]> abcdefreplxx" +"[-]> abcdefreplxx[\\]> abcdef" +"abcdefgreplxx[|]> " +"abcdefgabcdefg\r\n" +"abcdefg\r\n" +"replxx> \r\n"], command = [ ReplxxTests._cxxSample_, "m", "F" ], pause = 0.5 ) self_.check_scenario( - [ "a", "b", "c", "d", "e", "f", "g" ], [ - "0\r\n" - "replxx[-]> " - "replxx[-]> " - "11areplxx[\\]> " - "1areplxx[|]> " - "1a1abreplxx[/]> " - "1ab1\r\n" - "replxx[-]> " - "1abreplxx[-]> " - "1ab1ab21ab2creplxx[\\]> " - "1ab2creplxx[|]> " - "1ab2creplxx[/]> " - "1ab2c1ab2cd2\r\n" - "replxx[-]> " - "1ab2cdreplxx[-]> " - "1ab2cd1ab2cd3replxx[\\]> " - "1ab2cd31ab2cd3ereplxx[|]> " - "1ab2cd3ereplxx[/]> " - "1ab2cd3e1ab2cd3ef3\r\n" - "replxx[-]> " - "1ab2cd3efreplxx[-]> " - "1ab2cd3ef1ab2cd3ef4replxx[\\]> " - "1ab2cd3ef41ab2cd3ef4greplxx[|]> " - "1ab2cd3ef4g1ab2cd3ef4g\r\n" - "1ab2cd3ef4g\r\n", - "10\r\n" - "replxx[-]> " - "11areplxx[-]> " - "1areplxx[\\]> " - "1areplxx[|]> " - "1a1abreplxx[/]> " - "1ab1\r\n" - "replxx[-]> " - "1abreplxx[-]> " - "1ab1ab2replxx[\\]> " - "1ab21ab2creplxx[|]> " - "1ab2creplxx[/]> " - "1ab2c1ab2cd2\r\n" - "replxx[-]> " - "1ab2cdreplxx[-]> " - "1ab2cd1ab2cd3replxx[\\]> " - "1ab2cd31ab2cd3ereplxx[|]> " - "1ab2cd3ereplxx[/]> " - "1ab2cd3e1ab2cd3ef3\r\n" - "replxx[-]> " - "1ab2cd3efreplxx[-]> " - "1ab2cd3ef1ab2cd3ef4replxx[\\]> " - "1ab2cd3ef41ab2cd3ef4greplxx[|]> " - "1ab2cd3ef4g1ab2cd3ef4g\r\n" - "1ab2cd3ef4g\r\n", - "0\r\n" - "replxx[-]> " - "1areplxx[-]> " - "1areplxx[\\]> " - "1areplxx[|]> " - "1a1abreplxx[/]> " - "1ab1\r\n" - "replxx[-]> " - "1abreplxx[-]> " - "1ab1ab2replxx[\\]> " - "1ab21ab2creplxx[|]> " - "1ab2creplxx[/]> " - "1ab2c1ab2cd2\r\n" - "replxx[-]> " - "1ab2cdreplxx[-]> " - "1ab2cd1ab2cd3replxx[\\]> " - "1ab2cd31ab2cd3ereplxx[|]> " - "1ab2cd3ereplxx[/]> " - "1ab2cd3e1ab2cd3ef3\r\n" - "replxx[-]> " - "1ab2cd3efreplxx[-]> " - "1ab2cd3ef1ab2cd3ef4replxx[\\]> " - "1ab2cd3ef41ab2cd3ef4greplxx[|]> " - "1ab2cd3ef4g1ab2cd3ef4g\r\n" - "1ab2cd3ef4g\r\n", - "0\r\n" - "replxx> " - "replxx[-]> " - "11areplxx[\\]> " - "1areplxx[|]> " - "1a1abreplxx[/]> " - "1ab1\r\n" - "replxx[-]> " - "1abreplxx[-]> " - "1ab1ab2replxx[\\]> " - "1ab21ab2creplxx[|]> " - "1ab2creplxx[/]> " - "1ab2c1ab2cd2\r\n" - "replxx[-]> " - "1ab2cdreplxx[-]> " - "1ab2cd1ab2cd3replxx[\\]> " - "1ab2cd31ab2cd3ereplxx[|]> " - "1ab2cd3ereplxx[/]> " - "1ab2cd3e1ab2cd3ef3\r\n" - "replxx[-]> " - "1ab2cd3efreplxx[-]> " - "1ab2cd3ef1ab2cd3ef4replxx[\\]> " - "1ab2cd3ef41ab2cd3ef4greplxx[|]> " - "1ab2cd3ef4g1ab2cd3ef4g\r\n" - "1ab2cd3ef4g\r\n", - "0\r\n" - "replxx[-]> " - "replxx[-]> " - "11areplxx[\\]> " - "1areplxx[|]> " - "1a1abreplxx[/]> " - "1ab1\r\n" - "replxx[-]> " - "1abreplxx[-]> " - "1ab1ab2replxx[\\]> " - "1ab21ab2creplxx[|]> " - "1ab2creplxx[/]> " - "1ab2c1ab2cd2\r\n" - "replxx[-]> " - "1ab2cdreplxx[-]> " - "1ab2cd1ab2cd3replxx[\\]> " - "1ab2cd31ab2cd3ereplxx[|]> " - "1ab2cd3ereplxx[/]> " - "1ab2cd3e1ab2cd3ef3\r\n" - "replxx[-]> " - "1ab2cd3efreplxx[-]> " - "1ab2cd3ef1ab2cd3ef4replxx[\\]> " - "1ab2cd3ef41ab2cd3ef4greplxx[|]> " - "1ab2cd3ef4g1ab2cd3ef4g\r\n" - "1ab2cd3ef4g\r\n", - "0\r\n" - "replxx[-]> " - "replxx[-]> " - "11areplxx[\\]> " - "1areplxx[|]> " - "1a1abreplxx[/]> " - "1ab1\r\n" - "replxx[-]> " - "1abreplxx[-]> " - "1ab1ab21ab2creplxx[\\]> " - "1ab2creplxx[|]> " - "1ab2creplxx[/]> " - "1ab2c1ab2cd2\r\n" - "replxx[-]> " - "1ab2cdreplxx[-]> " - "1ab2cd1ab2cd3replxx[\\]> " - "1ab2cd31ab2cd3ereplxx[|]> " - "1ab2cd3ereplxx[/]> " - "1ab2cd3e1ab2cd3ef3\r\n" - "replxx[-]> " - "1ab2cd3efreplxx[-]> " - "1ab2cd3ef1ab2cd3ef4replxx[\\]> " - "1ab2cd3ef41ab2cd3ef4g1ab2cd3ef4g\r\n" - "1ab2cd3ef4g\r\n" - "replxx> replxx[|]> " - "\r\n", - "0\r\n" - "replxx[-]> " - "1areplxx[-]> " - "1areplxx[\\]> " - "1areplxx[|]> " - "1a1abreplxx[/]> " - "1ab1\r\n" - "replxx[-]> " - "1abreplxx[-]> " - "1ab1ab21ab2creplxx[\\]> " - "1ab2creplxx[|]> " - "1ab2creplxx[/]> " - "1ab2c1ab2cd2\r\n" - "replxx[-]> " - "1ab2cdreplxx[-]> " - "1ab2cd1ab2cd3replxx[\\]> " - "1ab2cd31ab2cd3ereplxx[|]> " - "1ab2cd3ereplxx[/]> " - "1ab2cd3e1ab2cd3ef3\r\n" - "replxx[-]> " - "1ab2cd3efreplxx[-]> " - "1ab2cd3ef1ab2cd3ef4replxx[\\]> " - "1ab2cd3ef41ab2cd3ef4g1ab2cd3ef4g\r\n" - "1ab2cd3ef4g\r\n" - "replxx> replxx[|]> " - "\r\n" - ], + [ "a", "b", "c", "d", "e", "f", "g" ], ["0\r\n" +"replxx[-]> replxx[-]> " +"111a" +"replxx[\\]> 1a" +"replxx[|]> 1a1ab" +"replxx[/]> 1ab" +"1\r\n" +"replxx[-]> 1ab" +"replxx[-]> 1ab21" +"ab21ab2c" +"replxx[\\]> 1ab2c" +"replxx[|]> 1ab2c" +"1ab2cdreplxx[/]> " +"1ab2cd2\r\n" +"replxx[-]> 1ab2cd" +"replxx[-]> 1ab2cd3" +"1ab2cd3" +"replxx[\\]> 1ab2cd3" +"1ab2cd3e" +"replxx[|]> 1ab2cd3e" +"replxx[/]> 1ab2cd3" +"e1ab2cd3ef" +"3\r\n" +"replxx[-]> 1ab2cd3ef" +"replxx[-]> 1ab2cd3" +"ef41ab2cd3ef4" +"replxx[\\]> 1ab2" +"cd3ef41ab2cd3" +"ef4g1ab2cd3" +"ef4g\r\n" +"1ab2cd3ef4g\r\n" +"replxx> replxx[|]> \r\n"], command = [ ReplxxTests._cxxSample_, "m", "F", "k123456" ], pause = 0.487 ) + @_no_parallel + @unittest.skipIf( skip( "async" ), "timing-dependent; flaky on busy CI" ) def test_prompt_from_callback( self_ ): self_.check_scenario( "rib", - "some text color_b\r\n" + "replxx> some text color_b\r\n" " color_black\r\n" " color_brown\r\n" - " " - "color_bluereplxx[17]> " - "some text color_b\r\n" + " color_bluereplxx[17]> " + "some text color_b\r\n" " color_black\r\n" " color_brown\r\n" - " " - "color_bluereplxx[18]> " - "some text color_b\r\n" - " color_black\r\n" - " color_brown\r\n" - " " - "color_bluereplxx[18]> " - "some text color_br\r\n" + " color_bluereplxx" + "[18]> some text color_br\r\n" " color_brown\r\n" " color_brightred\r\n" - " " - "color_brightgreenreplxx[19]> " - "some text color_br\r\n" + " color_brightgreenreplxx" + "[18]> some text color_br\r\n" " color_brown\r\n" " color_brightred\r\n" - " " - "color_brightgreenreplxx[19]> " - "some text color_bri\r\n" + " color_brightgreenreplxx" + "[19]> some text color_bri\r\n" " color_brightred\r\n" " color_brightgreen\r\n" - " color_brightbluesome text " - "color_bright\r\n" + " color_brightbluereplxx" + "[19]> some text color_bri\r\n" " color_brightred\r\n" " color_brightgreen\r\n" - " " - "color_brightbluereplxx[22]> " - "some text color_bright\r\n" + " color_brightbluesome text color_bright" + "\r\n" " color_brightred\r\n" " color_brightgreen\r\n" - " " - "color_brightbluereplxx[23]> " - "some text color_bright\r\n" + " color_brightbluereplxx" + "[22]> some text color_bright\r\n" " color_brightred\r\n" " color_brightgreen\r\n" - " " - "color_brightbluereplxx[23]> " - "some text color_brightbluesome text " - "color_brightbluereplxx[26]> " - "some text color_brightbluesome text " - "color_brightbluereplxx[26]> \r\n" + " color_brightbluereplxx" + "[23]> some text color_brightblue" + "replxx[23]> some text color_brightblue" + "some text color_brightbluereplxx" + "[26]> some text color_brightblue" + "some text color_brightbluereplxx[26]> \r\n" "some text color_brightblue\r\n" - "replxx> " - "replxx[0]> " - "\r\n", + "replxx> replxx[0]> " + "\r\n", "some text color_b\n", command = [ ReplxxTests._cxxSample_, "P" ] ) def test_color_256( self_ ): self_.check_scenario( "", - "x c_3_6 rgb123 " + "replxx> x c_3_6 rgb123 " "fg513bg142 gs21 " "gs5 gs19gs5 " - "xx c_3_6 " + "xx c_3_6 " "rgb123 fg513bg142 " "gs21 gs5 " "gs19gs5 x\r\n" - "x c_3_6 rgb123 fg513bg142 gs21 gs5 gs19gs5 x\r\n", + "x c_3_6 rgb123 fg513bg142 gs21 gs5 gs19gs5 x\r\n", "x c_3_6 rgb123 fg513bg142 gs21 gs5 gs19gs5 x\n" ) def test_bold_and_underline_attributes( self_ ): self_.check_scenario( "", - "bold_color_brightred " + "replxx> bold_color_brightred " "color_brightred bold_color_red " "color_red underline_color_red " - "bold_underline_color_redbold_color_brightred " + "bold_underline_color_redbold_color_brightred " "color_brightred bold_color_red " "color_red underline_color_red " "bold_underline_color_red\r\n" "bold_color_brightred color_brightred bold_color_red color_red " - "underline_color_red bold_underline_color_red\r\n", + "underline_color_red bold_underline_color_red\r\n", "bold_color_brightred color_brightred bold_color_red color_red underline_color_red bold_underline_color_red\n" ) self_.check_scenario( "", - "normal_text bold_text underline_text " - "bold_underline_textnormal_text " + "replxx> normal_text bold_text underline_text " + "bold_underline_textnormal_text " "bold_text underline_text " "bold_underline_text\r\n" - "normal_text bold_text underline_text bold_underline_text\r\n", + "normal_text bold_text underline_text bold_underline_text\r\n", "normal_text bold_text underline_text bold_underline_text\n" ) def test_kill_to_begining_of_line_in_multiline( self_ ): self_.check_scenario( "", - "first line of text\r\n" + "replxx> first line of text\r\n" "second verse of a poem\r\n" "next passage of a scripture\r\n" - "last line of a codefirst line of text\r\n" + "last line of a codefirst line of text\r\n" "second verse of a poem\r\n" "next passage of a scripture\r\n" "last line of a codefirst line of text\r\n" @@ -3083,45 +3158,50 @@ def test_kill_to_begining_of_line_in_multiline( self_ ): "first line of text\r\n" "second verse of a poem\r\n" "next passage of a scripture\r\n" - "last line of a code\r\n", + "last line of a code\r\n" + "", "first line of textsecond verse of a poemnext passage of a scripturelast line of a code\n" ) def test_kill_to_end_of_line_in_multiline( self_ ): self_.check_scenario( "", - "first line of text\r\n" + "replxx> first line of text\r\n" "second verse of a poem\r\n" "next passage of a scripture\r\n" - "last line of a codefirst line of text\r\n" + "last line of a codefirst line of text\r\n" "second verse of a poem\r\n" "next passage of a scripture\r\n" - "last line of a codefirst line of text\r\n" + "last line of a codefirst line of text\r\n" + "second verse of a poem\r\n" + "next passage of a scripture\r\n" + "last line of a codefirst line of text\r\n" "second v\r\n" "next passage of a scripture\r\n" "last line of a codefirst line of text\r\n" - "second vfirst line of text\r\n" + "second vfirst line of text\r\n" "second verse of a poem\r\n" "next passage of a scripture\r\n" - "last line of a codefirst line of text\r\n" + "last line of a codefirst line of text\r\n" "second verse of a poem\r\n" "next passage of a scripture\r\n" "last line of a code\r\n" "first line of text\r\n" "second verse of a poem\r\n" "next passage of a scripture\r\n" - "last line of a code\r\n", + "last line of a code\r\n" + "", "first line of textsecond verse of a poemnext passage of a scripturelast line of a code\n" ) def test_long_prompt_multiline_enabled_hints( self_ ): prompt = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa> " self_.check_scenario( "", - "co\r\n" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa> co\r\n" " color_black\r\n" " color_red\r\n" - " " - "color_greenco\r\n" - "co\r\n", + " color_greenco\r\n" + "co\r\n" + "", "co\n", command = [ ReplxxTests._cxxSample_, "I", "p" + prompt ], dimensions = ( 24, 64 ), @@ -3130,83 +3210,90 @@ def test_long_prompt_multiline_enabled_hints( self_ ): def test_ignore_case_hints_completions( self_ ): self_.check_scenario( "dee", - "dde\r\n" + "dde\r\n" " determinANT\r\n" " determiNATION\r\n" - " deterMINEdetermin\r\n" + " deterMINEdetermin\r\n" " determinANT\r\n" " determiNATION\r\n" - " deterMINEdetermine\r\n" + " deterMINEdetermine\r\n" " deterMINE\r\n" - " deTERMINEDdetermine\r\n" + " deTERMINEDdetermine\r\n" "deterMINE deTERMINED\r\n" "replxx> determine\r\n" " deterMINE\r\n" - " deTERMINEDdetermine\r\n" + " deTERMINEDdetermine\r\n" " deTERMINED\r\n" - " " - "determinedeterMINEdeterMINE\r\n" - "deterMINE\r\n", + " determinedeterMINEdeterMINE" + "\r\n" + "deterMINE\r\n" + "", command = [ ReplxxTests._cxxSample_, "i" ] ) self_.check_scenario( "deed", - "dde\r\n" + "dde\r\n" " determinANT\r\n" " determiNATION\r\n" - " deterMINEdetermin\r\n" + " deterMINEdetermin\r\n" " determinANT\r\n" " determiNATION\r\n" - " deterMINEdetermine\r\n" + " deterMINEdetermine\r\n" " deterMINE\r\n" - " deTERMINEDdetermine\r\n" + " deTERMINEDdetermine\r\n" "deterMINE deTERMINED\r\n" "replxx> determine\r\n" " deterMINE\r\n" - " " - "deTERMINEDdetermineddeTERMINEDdeTERMINED\r\n" - "deTERMINED\r\n", + " deTERMINEDdetermineddeTERMINED" + "deTERMINED\r\n" + "deTERMINED\r\n" + "", command = [ ReplxxTests._cxxSample_, "i" ] ) def test_ignore_case_history_search( self_ ): self_.check_scenario( "erR", - "(reverse-i-search)`': " - "(reverse-i-search)`e': " - "determinANT(reverse-i-search)`er': " - "determinANT(reverse-i-search)`e': " - "determinANT(reverse-i-search)`eR': " - "deteRMINISMreplxx> " - "deteRMINISMdeteRMINISMdeteRMINISM\r\n" - "thanks for the input: deteRMINISM\r\n", + "(reverse-i-search)`': (reverse-i-search)`e': determinANT" + "(reverse-i-search)`er': determinANT(reverse-i-search)`e': determinANT" + "(reverse-i-search)`eR': deteRMINISMreplxx> deteRMINISM" + "deteRMINISMdeteRMINISM\r\n" + "thanks for the input: deteRMINISM\r\n" + "", "deTERMINED\ndetERMINISTIC\ndeteRMINISM\ndeterMINE\ndetermiNATION\ndeterminANT\n", command = [ ReplxxTests._cSample_, "i1" ] ) self_.check_scenario( "deter", - "dbdedetdetedeterdeterminANTdeterminANT\r\n" - "thanks for the input: determinANT\r\n", + "dbdedet" + "detedeterdeterminANT" + "determinANT\r\n" + "thanks for the input: determinANT\r\n" + "", "deTERMINED\ndetERMINISTIC\ndeteRMINISM\ndeterMINE\ndetermiNATION\ndeterminANT\n", command = [ ReplxxTests._cSample_, "i1" ] ) self_.check_scenario( "deteR", - "dbdedetdetedeteRdeteRMINISMdeteRMINISM\r\n" - "thanks for the input: deteRMINISM\r\n", + "dbdedet" + "detedeteRdeteRMINISM" + "deteRMINISM\r\n" + "thanks for the input: deteRMINISM\r\n" + "", "deTERMINED\ndetERMINISTIC\ndeteRMINISM\ndeterMINE\ndetermiNATION\ndeterminANT\n", command = [ ReplxxTests._cSample_, "i1" ] ) def test_history_scratch( self_ ): self_.check_scenario( "xyzZ", - "threethreex" - "twotwoy" - "oneonez" - "twoyonez" - "onezZ" - "threexonezZ" - "onezZ\r\n" - "onezZ\r\n", + "replxx> threethreex" + "replxx> twotwoy" + "replxx> oneonez" + "replxx> twoyreplxx> onez" + "onezZreplxx> " + "replxx> threexreplxx> onezZ" + "onezZ\r\n" + "onezZ\r\n" + "", "one\ntwo\nthree\n" ) with open( "replxx_history.txt", "rb" ) as f: @@ -3216,65 +3303,75 @@ def test_history_scratch( self_ ): self_.assertSequenceEqual( data[-6:], "onezZ\n" ) self_.check_scenario( "xyz", - "threethreex" - "twotwoy" - "oneonez" - "twoytwo" - "oneztwo" - "two\r\n" - "two\r\n", + "replxx> threethreex" + "replxx> twotwoy" + "replxx> oneonez" + "replxx> twoytwo" + "replxx> onezreplxx> two" + "two\r\n" + "two\r\n" + "", "one\ntwo\nthree\n" ) self_.check_scenario( "xyz", - "threethreex" - "twotwoy" - "oneonez" - "twoytwo" - "onetwo" - "threethree\r\n" - "three\r\n", + "replxx> threethreex" + "replxx> twotwoy" + "replxx> oneonez" + "replxx> twoytwo" + "replxx> onereplxx> two" + "replxx> threethree\r\n" + "three\r\n" + "", "one\ntwo\nthree\n" ) def test_move_up_over_multiline( self_ ): self_.check_scenario( "", - "ZZZbbbbbbbbbbbbbbbb\r\n" + "replxx> ZZZreplxx> " + "bbbbbbbbbbbbbbbb\r\n" "bbbbbbbbbbbbbbbbbbbb\r\n" "bbbbbbbbbbbbbbbbbbbb\r\n" - "bbbbbbbbbbbbbbbbbbbbbbb123123\r\n" - "123\r\n", + "bbbbbbbbbbbbbbbbbbbbbbbreplxx> 123" + "123\r\n" + "123\r\n" + "", "123\nbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\nZZZ\n" ) def test_move_down_over_multiline( self_ ): self_.check_scenario( "x", - "123bbbbbbbbbbbbbbbbbbbbbbb\r\n" + "replxx> 123replxx> " + "bbbbbbbbbbbbbbbbbbbbbbb\r\n" "bbbbbbbbbbbbbbbbbbbb\r\n" "bbbbbbbbbbbbbbbbbbbb\r\n" - "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\r\n" + "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\r\n" "bbbbbbbbbbbbbbbbbbbb\r\n" "bbbbbbbbbbbbbbbbbbbb\r\n" - "bbbbbbbbbbbbbbbbZZZxx\r\n" - "x\r\n", + "bbbbbbbbbbbbbbbbreplxx> ZZZ" + "replxx> xx\r\n" + "x\r\n" + "", "123\nbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\nZZZ\n" ) def test_position_tracking_no_color( self_ ): self_.check_scenario( "abcdef", - "abcdefabcdef\r\nthanks for the input: abcdef\r\n", + "abcdefabcdefabcdef\r\n" + "thanks for the input: abcdef\r\n" + "", command = [ ReplxxTests._cSample_, "m", "N", "S", "C", "M0" ] ) def test_seeded_incremental_history_search( self_ ): self_.check_scenario( "for", - "ffofor(reverse-i-search)`for': " - "for(reverse-i-search)`for': " - "forth(reverse-i-search)`for': " - "fortranreplxx> " - "fortranfortranfortran\r\n" - "fortran\r\n", + "ffofor" + "(reverse-i-search)`for': for(reverse-i-search)`for': forth" + "(reverse-i-search)`for': fortranreplxx> fortranfortran" + "fortran\r\n" + "fortran\r\n" + "", "\n".join( _words_[::-1] ) + "\n" ) @@ -3284,7 +3381,71 @@ def parseArgs( self, func, argv ): verbosity = self.verbosity return res +def _run_one( test_name ): + """Worker entry point for parallel runs: run a single test by name.""" + global verbosity + verbosity = 0 + import io + loader = unittest.TestLoader() + suite = loader.loadTestsFromName( test_name ) + buf = io.StringIO() + runner = unittest.TextTestRunner( stream = buf, verbosity = 2 ) + result = runner.run( suite ) + return ( test_name, result.wasSuccessful(), buf.getvalue() ) + +def _run_parallel( jobs ): + import multiprocessing + loader = unittest.TestLoader() + suite = loader.loadTestsFromTestCase( ReplxxTests ) + parallel = [] + serial = [] + def _collect( s ): + for t in s: + if isinstance( t, unittest.TestSuite ): + _collect( t ) + continue + method = getattr( type( t ), t._testMethodName, None ) + if method is not None and getattr( method, "_no_parallel", False ): + serial.append( t.id() ) + else: + parallel.append( t.id() ) + _collect( suite ) + failures = 0 + passes = 0 + + def _report( name, ok, out ): + nonlocal failures, passes + marker = "ok" if ok else "FAIL" + print( "{:4} {}".format( marker, name ) ) + if not ok: + print( out ) + failures += 1 + else: + passes += 1 + + with multiprocessing.Pool( processes = jobs ) as pool: + for name, ok, out in pool.imap_unordered( _run_one, parallel ): + _report( name, ok, out ) + # Run the timing-sensitive tests sequentially once the pool drains, so + # they are not racing against ~jobs other PTYs. Even alone, the spinner + # / async-print interleaving is not fully deterministic, so retry a few + # times before declaring a failure. + for name in serial: + for attempt in range( 5 ): + res = _run_one( name ) + if res[1]: + break + _report( *res ) + + print( "{} passed, {} failed".format( passes, failures ) ) + return 0 if failures == 0 else 1 + if __name__ == "__main__": + if "-j" in sys.argv: + i = sys.argv.index( "-j" ) + jobs = int( sys.argv[i + 1] ) if i + 1 < len( sys.argv ) else os.cpu_count() or 1 + del sys.argv[i:i + 2] + sys.exit( _run_parallel( jobs ) ) pa = unittest.TestProgram.parseArgs unittest.TestProgram.parseArgs = lambda self, argv: parseArgs( self, pa, argv ) unittest.main()