Index: ChangeLog =================================================================== --- ChangeLog (revision 42019) +++ ChangeLog (working copy) @@ -1,3 +1,7 @@ +Wed Jul 17 04:56:29 2013 Matthew M. Boedicker + + * hash.c (env_fetch): Add key name to message on ENV.fetch KeyError. + Wed Jul 17 12:30:05 2013 Tanaka Akira * include/ruby/st.h (st_strcasecmp): Macro defined for compatibility. Index: hash.c =================================================================== --- hash.c (revision 42019) +++ hash.c (working copy) @@ -2411,7 +2411,7 @@ if (!env) { if (block_given) return rb_yield(key); if (argc == 1) { - rb_raise(rb_eKeyError, "key not found"); + rb_raise(rb_eKeyError, "key not found: \"%s\"", nam); } return if_none; } Index: test/ruby/test_env.rb =================================================================== --- test/ruby/test_env.rb (revision 42019) +++ test/ruby/test_env.rb (working copy) @@ -103,7 +103,9 @@ ENV["test"] = "foo" assert_equal("foo", ENV.fetch("test")) ENV.delete("test") - assert_raise(KeyError) { ENV.fetch("test") } + assert_raise_with_message(KeyError, 'key not found: "test"') do + ENV.fetch("test") + end assert_equal("foo", ENV.fetch("test", "foo")) assert_equal("bar", ENV.fetch("test") { "bar" }) assert_equal("bar", ENV.fetch("test", "foo") { "bar" })