summaryrefslogtreecommitdiff
path: root/test/fiddle/test_closure.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/fiddle/test_closure.rb')
-rw-r--r--test/fiddle/test_closure.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/fiddle/test_closure.rb b/test/fiddle/test_closure.rb
index 6ccd3859f5..9e748bf5ee 100644
--- a/test/fiddle/test_closure.rb
+++ b/test/fiddle/test_closure.rb
@@ -54,6 +54,19 @@ module Fiddle
assert_equal 10, func.call(10)
end
+ def test_const_string
+ closure_class = Class.new(Closure) do
+ def call(string)
+ @return_string = "Hello! #{string}"
+ @return_string
+ end
+ end
+ closure = closure_class.new(:const_string, [:const_string])
+
+ func = Function.new(closure, [:const_string], :const_string)
+ assert_equal("Hello! World!", func.call("World!"))
+ end
+
def test_block_caller
cb = Closure::BlockCaller.new(TYPE_INT, [TYPE_INT]) do |one|
one