diff options
author | tomoya ishida <tomoyapenguin@gmail.com> | 2023-01-12 09:14:48 +0900 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-01-12 00:14:53 +0000 |
commit | 0abb4b6348f00b03736b198b26e58b08cefc3303 (patch) | |
tree | 3273ee905e1f75cd66e4b4a806d753d63de8ff76 /test | |
parent | 048751dd73f45ba02c8be80092a38fd47e56a925 (diff) |
[ruby/reline] Pass unmodifined lines(that does not include escape
sequence) to check_multiline_prompt
(https://github.com/ruby/reline/pull/458)
* pass unmodified lines to check_multiline_prompt
* Add test to check that output modified by output_modifier_proc is not passed to prompt_proc
Diffstat (limited to 'test')
-rwxr-xr-x | test/reline/yamatanooroti/multiline_repl | 13 | ||||
-rw-r--r-- | test/reline/yamatanooroti/test_rendering.rb | 12 |
2 files changed, 25 insertions, 0 deletions
diff --git a/test/reline/yamatanooroti/multiline_repl b/test/reline/yamatanooroti/multiline_repl index d27d216652..c429494442 100755 --- a/test/reline/yamatanooroti/multiline_repl +++ b/test/reline/yamatanooroti/multiline_repl @@ -39,6 +39,19 @@ opt.on('--dynamic-prompt-with-newline') { } } } +opt.on('--broken-dynamic-prompt-assert-no-escape-sequence') { + Reline.prompt_proc = proc { |lines| + has_escape_sequence = lines.join.include?("\e") + (lines.size + 1).times.map { |i| + has_escape_sequence ? 'error>' : '[%04d]> ' % i + } + } +} +opt.on('--color-bold') { + Reline.output_modifier_proc = ->(output, complete:){ + output.gsub(/./) { |c| "\e[1m#{c}\e[0m" } + } +} opt.on('--auto-indent') { AutoIndent.new } diff --git a/test/reline/yamatanooroti/test_rendering.rb b/test/reline/yamatanooroti/test_rendering.rb index c383112131..42d2b173d5 100644 --- a/test/reline/yamatanooroti/test_rendering.rb +++ b/test/reline/yamatanooroti/test_rendering.rb @@ -460,6 +460,18 @@ begin EOC end + def test_no_escape_sequence_passed_to_dynamic_prompt + start_terminal(10, 30, %W{ruby -I#{@pwd}/lib #{@pwd}/test/reline/yamatanooroti/multiline_repl --autocomplete --color-bold --broken-dynamic-prompt-assert-no-escape-sequence}, startup_message: 'Multiline REPL.') + write("%[ S") + write("\n") + close + assert_screen(<<~EOC) + Multiline REPL. + [0000]> %[ S + [0001]> + EOC + end + def test_enable_bracketed_paste omit if Reline::IOGate.win? write_inputrc <<~LINES |