summaryrefslogtreecommitdiff
path: root/test/ruby/test_iterator.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-10-15 23:38:10 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-10-15 23:38:10 +0000
commite45c4cd1ac8523f83b1d72b068ba009e3d9fe6db (patch)
treec73178db42b65dc40319bc4b0bf3db7a8268ff3d /test/ruby/test_iterator.rb
parentc1b6f966bef5ee3ea3e08ad29c3616354d0e4ef8 (diff)
* test/digest/test_digest.rb (test_eq): show failed class.
* test/ruby/test_iterator.rb (test_break, test_return_trace_func): test localjump destination. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_iterator.rb')
-rw-r--r--test/ruby/test_iterator.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/ruby/test_iterator.rb b/test/ruby/test_iterator.rb
index 9a5b9c5352..f91bf81644 100644
--- a/test/ruby/test_iterator.rb
+++ b/test/ruby/test_iterator.rb
@@ -403,4 +403,25 @@ class TestIterator < Test::Unit::TestCase
end
assert(false, "must not reach here")
end
+
+ def test_break_from_enum
+ result = ["a"].inject("ng") {|x,y| break "ok"}
+ assert_equal("ok", result)
+ end
+
+ def _test_return_trace_func(x)
+ set_trace_func(proc {})
+ [].fetch(2) {return x}
+ ensure
+ set_trace_func(nil)
+ end
+
+ def test_return_trace_func
+ ok = "returned gracefully"
+ result = "skipped"
+ result = _test_return_from_builtin(ok)
+ ensure
+ assert_equal(ok, result)
+ return
+ end
end