diff options
| author | Étienne Barrié <etienne.barrie@gmail.com> | 2025-09-08 15:27:02 +0200 |
|---|---|---|
| committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2025-09-11 11:54:49 +0900 |
| commit | e4a93944d1a368c4b464de5391a51fc5ac2ca92e (patch) | |
| tree | e67115f69e6680ba1fa2f924c854229e48dfc229 | |
| parent | 72888b75060f6e5438372328256ab8c1e2a184ae (diff) | |
[ruby/json] Improve test coverage
Test SubArrayWrapper#[] and SubOpenStruct#[]
https://github.com/ruby/json/commit/bae760aa19
Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
| -rw-r--r-- | test/json/json_parser_test.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/test/json/json_parser_test.rb b/test/json/json_parser_test.rb index 2217f2b9e8..a9b0624f6b 100644 --- a/test/json/json_parser_test.rb +++ b/test/json/json_parser_test.rb @@ -635,6 +635,7 @@ class JSONParserTest < Test::Unit::TestCase def test_parse_array_custom_non_array_derived_class res = parse('[1,2]', :array_class => SubArrayWrapper) assert_equal([1,2], res.data) + assert_equal(1, res[0]) assert_equal(SubArrayWrapper, res.class) assert res.shifted? end @@ -696,6 +697,7 @@ class JSONParserTest < Test::Unit::TestCase def test_parse_object_custom_non_hash_derived_class res = parse('{"foo":"bar"}', :object_class => SubOpenStruct) assert_equal "bar", res.foo + assert_equal "bar", res[:foo] assert_equal(SubOpenStruct, res.class) assert res.item_set? end |
