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

[ruby/reline] Add a test for Reline.add_dialog_proc

https://github.com/ruby/reline/commit/c4bb1bfd79
This commit is contained in:
aycabta 2021-12-17 14:16:59 +09:00 committed by git
parent cf508d4db9
commit ec517d60b0

View file

@ -310,6 +310,21 @@ class Reline::Test < Reline::TestCase
assert_equal(Reline::KeyActor::Emacs, Reline.send(:core).config.editing_mode.class)
end
def test_add_dialog_proc
p = proc {}
Reline.add_dialog_proc(:test_proc, p)
l = lambda {}
Reline.add_dialog_proc(:test_lambda, l)
assert_raise(ArgumentError) { Reline.add_dialog_proc(:error, 42) }
assert_raise(ArgumentError) { Reline.add_dialog_proc(:error, 'hoge') }
assert_raise(ArgumentError) { Reline.add_dialog_proc('error', proc {} ) }
dummy = DummyCallbackObject.new
Reline.add_dialog_proc(:dummy, dummy)
end
def test_readmultiline
# readmultiline is module function
assert_include(Reline.methods, :readmultiline)