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 dialog proc with context

https://github.com/ruby/reline/commit/2ce2696d6e
This commit is contained in:
aycabta 2021-12-20 14:44:50 +09:00 committed by git
parent bb12281164
commit 7572e0c6ec

View file

@ -338,6 +338,20 @@ class Reline::Test < Reline::TestCase
assert_equal(dummy, d.dialog_proc) assert_equal(dummy, d.dialog_proc)
end end
def test_add_dialog_proc_with_context
dummy_proc = proc {}
array = Array.new
Reline.add_dialog_proc(:test_proc, dummy_proc, array)
d = Reline.dialog_proc(:test_proc)
assert_equal(dummy_proc, d.dialog_proc)
assert_equal(array, d.context)
Reline.add_dialog_proc(:test_proc, dummy_proc, nil)
d = Reline.dialog_proc(:test_proc)
assert_equal(dummy_proc, d.dialog_proc)
assert_equal(nil, d.context)
end
def test_readmultiline def test_readmultiline
# readmultiline is module function # readmultiline is module function
assert_include(Reline.methods, :readmultiline) assert_include(Reline.methods, :readmultiline)