summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChristopher Aue <[email protected]>2017-08-30 12:22:14 +0200
committerChristopher Aue <[email protected]>2017-08-30 12:25:55 +0200
commit35deaae7768b1f5404cf00c1ca85d9d770062413 (patch)
treef676130d9208fd0575bd39e1cecef5e5831aa11a
parent71357ff1d8bd6ec0b3e7cce364c2513d6d3f7a77 (diff)
downloadmruby-35deaae7768b1f5404cf00c1ca85d9d770062413.tar.gz
mruby-35deaae7768b1f5404cf00c1ca85d9d770062413.zip
Tested LocalJumpErrors caused by break in a proc
-rw-r--r--mrbgems/mruby-proc-ext/test/proc.rb4
-rw-r--r--test/t/proc.rb14
2 files changed, 18 insertions, 0 deletions
diff --git a/mrbgems/mruby-proc-ext/test/proc.rb b/mrbgems/mruby-proc-ext/test/proc.rb
index 424c0bc1d..037d8d124 100644
--- a/mrbgems/mruby-proc-ext/test/proc.rb
+++ b/mrbgems/mruby-proc-ext/test/proc.rb
@@ -66,6 +66,10 @@ end
assert('Kernel#proc') do
assert_true !proc{|a|}.lambda?
+
+ assert_raise LocalJumpError do
+ proc{ break }.call
+ end
end
assert('mrb_proc_new_cfunc_with_env') do
diff --git a/test/t/proc.rb b/test/t/proc.rb
index ef4566e66..42ac3b941 100644
--- a/test/t/proc.rb
+++ b/test/t/proc.rb
@@ -11,6 +11,10 @@ assert('Proc.new', '15.2.17.3.1') do
end
assert_equal (Proc.new {}).class, Proc
+
+ assert_raise LocalJumpError do
+ Proc.new{ break }.call
+ end
end
assert('Proc#[]', '15.2.17.4.1') do
@@ -164,3 +168,13 @@ assert('&obj call to_proc if defined') do
assert_raise(TypeError){ mock(&(Object.new)) }
end
+
+assert('Creation of a proc through the block of a method') do
+ def m(&b) b end
+
+ assert_equal m{}.class, Proc
+
+ assert_raise LocalJumpError do
+ m{ break }.call
+ end
+end