[前][次][番号順一覧][スレッド一覧]

ruby-changes:70346

From: aycabta <ko1@a...>
Date: Mon, 20 Dec 2021 14:55:03 +0900 (JST)
Subject: [ruby-changes:70346] 7572e0c6ec (master): [ruby/reline] Add a test for dialog proc with context

https://git.ruby-lang.org/ruby.git/commit/?id=7572e0c6ec

From 7572e0c6eca8930c875073ff944d5729f3b7a160 Mon Sep 17 00:00:00 2001
From: aycabta <aycabta@g...>
Date: Mon, 20 Dec 2021 14:44:50 +0900
Subject: [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 a0ea43b2ad8..03e663bcddd 100644
--- a/test/reline/test_reline.rb
+++ b/test/reline/test_reline.rb
@@ -338,6 +338,20 @@ class Reline::Test < Reline::TestCase https://github.com/ruby/ruby/blob/trunk/test/reline/test_reline.rb#L338
     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)
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]