Skip to content

Commit e4a9394

Browse files
etiennebarriebyroot
authored andcommitted
[ruby/json] Improve test coverage
Test SubArrayWrapper#[] and SubOpenStruct#[] ruby/json@bae760aa19 Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
1 parent 72888b7 commit e4a9394

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

test/json/json_parser_test.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,7 @@ def test_parse_array_custom_array_derived_class
635635
def test_parse_array_custom_non_array_derived_class
636636
res = parse('[1,2]', :array_class => SubArrayWrapper)
637637
assert_equal([1,2], res.data)
638+
assert_equal(1, res[0])
638639
assert_equal(SubArrayWrapper, res.class)
639640
assert res.shifted?
640641
end
@@ -696,6 +697,7 @@ def item_set?
696697
def test_parse_object_custom_non_hash_derived_class
697698
res = parse('{"foo":"bar"}', :object_class => SubOpenStruct)
698699
assert_equal "bar", res.foo
700+
assert_equal "bar", res[:foo]
699701
assert_equal(SubOpenStruct, res.class)
700702
assert res.item_set?
701703
end

0 commit comments

Comments
 (0)