From 7572e0c6eca8930c875073ff944d5729f3b7a160 Mon Sep 17 00:00:00 2001 From: aycabta Date: Mon, 20 Dec 2021 14:44:50 +0900 Subject: [PATCH] [ruby/reline] Add a test for dialog proc with context https://github.com/ruby/reline/commit/2ce2696d6e --- test/reline/test_reline.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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)