aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2021-12-20 14:44:50 +0900
committergit <svn-admin@ruby-lang.org>2021-12-20 14:54:45 +0900
commit7572e0c6eca8930c875073ff944d5729f3b7a160 (patch)
treef00bd5b63d265349ec700d37892324966d230bc2
parentbb122811640db5ab307805f81cf6b5ccdd6a2f4d (diff)
downloadruby-7572e0c6eca8930c875073ff944d5729f3b7a160.tar.gz
[ruby/reline] Add a test for dialog proc with context
https://github.com/ruby/reline/commit/2ce2696d6e
-rw-r--r--test/reline/test_reline.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/reline/test_reline.rb b/test/reline/test_reline.rb
index a0ea43b2ad..03e663bcdd 100644
--- a/test/reline/test_reline.rb
+++ b/test/reline/test_reline.rb
@@ -338,6 +338,20 @@ class Reline::Test < Reline::TestCase
assert_equal(dummy, d.dialog_proc)
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
# readmultiline is module function
assert_include(Reline.methods, :readmultiline)