diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-11-16 05:46:50 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-11-16 05:46:50 +0000 |
commit | 6af392c73dc9be5ea09080d3d24e76bf1d7638f3 (patch) | |
tree | dc06bd74a568571a2996dee55475d9a3a812aa81 /test/ruby/test_struct.rb | |
parent | 56cfbfc297d9e1d7820e6bece4cefed556401e2c (diff) | |
download | ruby-6af392c73dc9be5ea09080d3d24e76bf1d7638f3.tar.gz |
struct.c: fix index in message
* struct.c (rb_struct_aref, rb_struct_aset): show the given index,
not offset index, in the error messages when the offset is out
of the range.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52584 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_struct.rb')
-rw-r--r-- | test/ruby/test_struct.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/ruby/test_struct.rb b/test/ruby/test_struct.rb index df859f75cb..f51432cfd6 100644 --- a/test/ruby/test_struct.rb +++ b/test/ruby/test_struct.rb @@ -155,8 +155,8 @@ module TestStruct klass = @Struct.new(:a) o = klass.new(1) assert_equal(1, o[0]) - assert_raise(IndexError) { o[-2] } - assert_raise(IndexError) { o[1] } + assert_raise_with_message(IndexError, /offset -2\b/) {o[-2]} + assert_raise_with_message(IndexError, /offset 1\b/) {o[1]} assert_raise_with_message(NameError, /foo/) {o["foo"]} assert_raise_with_message(NameError, /foo/) {o[:foo]} end @@ -166,8 +166,8 @@ module TestStruct o = klass.new(1) o[0] = 2 assert_equal(2, o[:a]) - assert_raise(IndexError) { o[-2] = 3 } - assert_raise(IndexError) { o[1] = 3 } + assert_raise_with_message(IndexError, /offset -2\b/) {o[-2] = 3} + assert_raise_with_message(IndexError, /offset 1\b/) {o[1] = 3} assert_raise_with_message(NameError, /foo/) {o["foo"] = 3} assert_raise_with_message(NameError, /foo/) {o[:foo] = 3} end |