ruby-changes:67679
From: aycabta <ko1@a...>
Date: Fri, 10 Sep 2021 09:04:40 +0900 (JST)
Subject: [ruby-changes:67679] 4475953378 (master): [ruby/reline] Add a simple test for autocomplete
https://git.ruby-lang.org/ruby.git/commit/?id=4475953378 From 44759533786562d0ff5c49147d050ea685e97ea5 Mon Sep 17 00:00:00 2001 From: aycabta <aycabta@g...> Date: Thu, 9 Sep 2021 07:22:53 +0900 Subject: [ruby/reline] Add a simple test for autocomplete https://github.com/ruby/reline/commit/11f83b2f4b --- test/reline/yamatanooroti/multiline_repl | 6 ++++++ test/reline/yamatanooroti/test_rendering.rb | 16 ++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/test/reline/yamatanooroti/multiline_repl b/test/reline/yamatanooroti/multiline_repl index 00d4825e..b21ad4b 100755 --- a/test/reline/yamatanooroti/multiline_repl +++ b/test/reline/yamatanooroti/multiline_repl @@ -35,6 +35,12 @@ opt.on('--complete') { https://github.com/ruby/ruby/blob/trunk/test/reline/yamatanooroti/multiline_repl#L35 %w{String ScriptError SyntaxError Signal} } } +opt.on('--autocomplete') { + Reline.autocompletion = true + Reline.completion_proc = lambda { |target, preposing = nil, postposing = nil| + %w{String Struct Symbol ScriptError SyntaxError Signal} + } +} opt.parse!(ARGV) begin diff --git a/test/reline/yamatanooroti/test_rendering.rb b/test/reline/yamatanooroti/test_rendering.rb index e93aa1a..55b122e 100644 --- a/test/reline/yamatanooroti/test_rendering.rb +++ b/test/reline/yamatanooroti/test_rendering.rb @@ -835,6 +835,22 @@ begin https://github.com/ruby/ruby/blob/trunk/test/reline/yamatanooroti/test_rendering.rb#L835 EOC end + def test_autocomplete + start_terminal(20, 30, %W{ruby -I#{@pwd}/lib #{@pwd}/test/reline/yamatanooroti/multiline_repl --autocomplete}, startup_message: 'Multiline REPL.') + write("Stri") + close + assert_screen(<<~'EOC') + Multiline REPL. + prompt> Stri + String + Struct + Symbol + ScriptError + SyntaxError + Signal + EOC + end + def write_inputrc(content) File.open(@inputrc_file, 'w') do |f| f.write content -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/