From ec517d60b06069b7de6ac63cb284745a5c827bbd Mon Sep 17 00:00:00 2001 From: aycabta Date: Fri, 17 Dec 2021 14:16:59 +0900 Subject: [PATCH] [ruby/reline] Add a test for Reline.add_dialog_proc https://github.com/ruby/reline/commit/c4bb1bfd79 --- test/reline/test_reline.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/reline/test_reline.rb b/test/reline/test_reline.rb index dd049ac127..679de42b97 100644 --- a/test/reline/test_reline.rb +++ b/test/reline/test_reline.rb @@ -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)