diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-09-18 08:05:53 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-09-18 08:05:53 +0000 |
commit | 13f5dcb9f25cf07ef22baa5aded490395700b283 (patch) | |
tree | 5678b3e222c96077a2eb8e7a80e21dd5dbef1d3e /test/ruby/test_env.rb | |
parent | 2627c19d82252f2bb571f6bcb44e359cacefa92b (diff) |
error.c: KeyError#receiver and KeyError#key
* error.c: new method KeyError#receiver and KeyError#key.
[Feature #12063]
* hash.c: make KeyError object with receiver and key.
* sprintf.c: ditto.
Author: ksss <co000ri@gmail.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59955 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_env.rb')
-rw-r--r-- | test/ruby/test_env.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/test/ruby/test_env.rb b/test/ruby/test_env.rb index 29c058339f..d136ba75fa 100644 --- a/test/ruby/test_env.rb +++ b/test/ruby/test_env.rb @@ -122,9 +122,11 @@ class TestEnv < Test::Unit::TestCase assert_equal("foo", ENV.fetch("test")) ENV.delete("test") feature8649 = '[ruby-core:56062] [Feature #8649]' - assert_raise_with_message(KeyError, 'key not found: "test"', feature8649) do + e = assert_raise_with_message(KeyError, 'key not found: "test"', feature8649) do ENV.fetch("test") end + assert_same(ENV, e.receiver) + assert_equal("test", e.key) assert_equal("foo", ENV.fetch("test", "foo")) assert_equal("bar", ENV.fetch("test") { "bar" }) assert_equal("bar", ENV.fetch("test", "foo") { "bar" }) |