diff options
Diffstat (limited to 'test/ruby/test_enum.rb')
| -rw-r--r-- | test/ruby/test_enum.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_enum.rb b/test/ruby/test_enum.rb index f7c8f012d8..237bdc8a4d 100644 --- a/test/ruby/test_enum.rb +++ b/test/ruby/test_enum.rb @@ -843,6 +843,8 @@ class TestEnumerable < Test::Unit::TestCase end def test_callcc + omit 'requires callcc support' unless respond_to?(:callcc) + assert_raise(RuntimeError) do c = nil @obj.sort_by {|x| callcc {|c2| c ||= c2 }; x } @@ -1346,4 +1348,12 @@ class TestEnumerable < Test::Unit::TestCase klass.new.grep(/(b.)/) { svars << $1 } assert_equal(["ba", "ba"], svars) end + + def test_all_fast + data = { "key" => { "key2" => 1 } } + kk = vv = nil + data.all? { |(k, v)| kk, vv = k, v } + assert_equal(kk, "key") + assert_equal(vv, { "key2" => 1 }) + end end |
