summaryrefslogtreecommitdiff
path: root/bootstraptest/test_proc.rb
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-17 19:27:24 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-17 19:27:24 +0000
commit00e4fd42f36fa23de04cccb9cea3c3e5d14c9ae9 (patch)
tree0012d083c6af5721147cdd7ed7d21d260f38b811 /bootstraptest/test_proc.rb
parente2f37fb9c6c9df54b2be78d09de00aa7da0d694f (diff)
* vm.c, vm_insnhelper.c: fix escape process with "braek" and "return"
syntax in "lambda". [ ruby-Bugs-19304 ], [ruby-core:17164] * KNOWNBUGS.rb, bootstraptest/test_proc.rb: add/move solved test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17390 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bootstraptest/test_proc.rb')
-rw-r--r--bootstraptest/test_proc.rb88
1 files changed, 88 insertions, 0 deletions
diff --git a/bootstraptest/test_proc.rb b/bootstraptest/test_proc.rb
index 51c6944..1ffd5c0 100644
--- a/bootstraptest/test_proc.rb
+++ b/bootstraptest/test_proc.rb
@@ -276,3 +276,91 @@ assert_equal 'ok', %q{
:ng
}.call
}, '[ruby-dev:34646]'
+
+assert_equal %q{[:bar, :foo]}, %q{
+ def foo
+ klass = Class.new do
+ define_method(:bar) do
+ return :bar
+ end
+ end
+ [klass.new.bar, :foo]
+ end
+ foo
+}, "[ ruby-Bugs-19304 ]"
+
+assert_equal 'ok', %q{
+ $x = :ok
+ def def7(x, y)
+ x[y]
+ $x = :ng
+ end
+ def test_def7
+ def7(lambda {|x| x.call}, Proc.new {return})
+ $x = :ng
+ end
+ test_def7
+ $x
+}, '[ruby-core:17164]'
+
+assert_equal 'ok', %q{
+ lambda { a = lambda { return }; $x = :ng; a[]; $x = :ok }.call
+ $x
+}, '[ruby-core:17164]'
+
+assert_equal 'ok', %q{
+ lambda { a = lambda { break }; $x = :ng; a[]; $x = :ok }.call
+ $x
+}, '[ruby-core:17164]'
+
+assert_equal 'ok', %q{
+ def def8
+ $x = :ng
+ lambda { a = Proc.new { return }; a[]}.call
+ $x = :ok
+ end
+ def8
+ $x
+}, '[ruby-core:17164]'
+
+
+assert_equal 'ok', %q{
+ def def9
+ lambda {|a| $x = :ok; a[]; $x = :ng }.call(Proc.new { return })
+ $x = :ng
+ end
+ def9
+ $x
+}, '[ruby-core:17164]'
+
+assert_equal 'ok', %q{
+ def def10
+ $x = :ng
+ lambda { 1.times { return } }.call
+ $x = :ok
+ end
+ $x = :ok
+ def10
+ $x
+}, '[ruby-core:17164]'
+
+assert_equal 'ok', %q{
+ def def11
+ yield
+ end
+ begin
+ lambda { def11 { return } }.call
+ rescue LocalJumpError
+ :ng
+ else
+ :ok
+ end
+}, '[ruby-core:17164]'
+
+assert_equal 'ok', %q{
+ def def12
+ b = Proc.new { $x = :ng; lambda { return }.call; $x = :ok }.call
+ end
+ def12
+ $x
+}, '[ruby-core:17164]'