summaryrefslogtreecommitdiff
path: root/sample
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-03-03 04:55:35 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-03-03 04:55:35 +0000
commit54a04074256fa85db5da3bf0041773ddc3391196 (patch)
tree73b38f7c4ca353aa285a5fa0935a142c7a73d16f /sample
parente3b15cf111472455a75ec181ff676bf5d370038d (diff)
* eval.c (method_hash): new method. [ruby-talk:93968]
* eval.c (proc_eq): do not compare dyna_vars. * eval.c (proc_hash): new method. * eval.c (rb_yield_0): protect break/return from within orphan (or lambda) Proc object. * parse.y (yylex): should not allow symbol for invalid global variable (e.g. `:$-)`). [ruby-core:02518] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5879 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sample')
-rw-r--r--sample/test.rb16
1 files changed, 15 insertions, 1 deletions
diff --git a/sample/test.rb b/sample/test.rb
index d37c978774..fe39fc646f 100644
--- a/sample/test.rb
+++ b/sample/test.rb
@@ -1120,6 +1120,20 @@ end
ljump_test(false, get_block{break})
ljump_test(true, lambda{break})
+def exit_value_test(&block)
+ block.call
+rescue LocalJumpError
+ $!.exit_value
+end
+
+test_ok(45, exit_value_test{break 45})
+
+test_ok(55, begin
+ get_block{break 55}.call
+ rescue LocalJumpError
+ $!.exit_value
+ end)
+
test_ok(block.arity == -1)
test_ok(lambda.arity == -1)
test_ok(lambda{||}.arity == 0)
@@ -1140,7 +1154,7 @@ test_ok(return_in_lambda())
def marity_test(m)
method = method(m)
- test_ok(method.arity == method.to_proc.arity)
+ test_ok(method.arity == method.to_proc.arity, 2)
end
marity_test(:test_ok)
marity_test(:marity_test)