1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/reline] Fix complete proc of a script for tests

ee1c1adddc
This commit is contained in:
aycabta 2021-09-10 07:34:33 +09:00 committed by git
parent 963e2c33b6
commit f51ce20c6a
2 changed files with 5 additions and 9 deletions

View file

@ -74,19 +74,19 @@ opt.on('--dialog VAL') { |v|
}
opt.on('--complete') {
Reline.completion_proc = lambda { |target, preposing = nil, postposing = nil|
%w{String ScriptError SyntaxError Signal}
%w{String ScriptError SyntaxError Signal}.select{ |c| c.start_with?(target) }
}
}
opt.on('--autocomplete') {
Reline.autocompletion = true
Reline.completion_proc = lambda { |target, preposing = nil, postposing = nil|
%w{String Struct Symbol ScriptError SyntaxError Signal}
%w{String Struct Symbol ScriptError SyntaxError Signal}.select{ |c| c.start_with?(target) }
}
}
opt.on('--autocomplete-long') {
Reline.autocompletion = true
Reline.completion_proc = lambda { |target, preposing = nil, postposing = nil|
%w{String Struct Symbol StopIteration SystemCallError SystemExit SystemStackError ScriptError SyntaxError Signal SizedQueue Set SecureRandom Socket StringIO StringScanner Shellwords Syslog Singleton SDBM}
%w{String Struct Symbol StopIteration SystemCallError SystemExit SystemStackError ScriptError SyntaxError Signal SizedQueue Set SecureRandom Socket StringIO StringScanner Shellwords Syslog Singleton SDBM}.select{ |c| c.start_with?(target) }
}
}
opt.parse!(ARGV)

View file

@ -911,17 +911,13 @@ begin
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")
write("Str")
close
assert_screen(<<~'EOC')
Multiline REPL.
prompt> Stri
prompt> Str
String
Struct
Symbol
ScriptError
SyntaxError
Signal
EOC
end