diff options
| author | Étienne Barrié <etienne.barrie@gmail.com> | 2025-11-28 15:53:58 +0100 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2025-12-03 13:49:05 +0000 |
| commit | 32c7c3c19aa7c9c3fda10a9520d29e244baeaa6d (patch) | |
| tree | e21d8a5e511a49e13e63c9364b963d59e29cda5e | |
| parent | 54a73a57a292d8d7e88cadd3fd8454a3084a60e9 (diff) | |
[ruby/json] Reproduce C ext behavior of ignoring mutated depth in arrays
https://github.com/ruby/json/commit/e0257b9f82
| -rwxr-xr-x | test/json/json_generator_test.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/test/json/json_generator_test.rb b/test/json/json_generator_test.rb index ab3a6807d6..e623e05409 100755 --- a/test/json/json_generator_test.rb +++ b/test/json/json_generator_test.rb @@ -329,7 +329,6 @@ class JSONGeneratorTest < Test::Unit::TestCase "#{state.indent * state.depth}\"foo\":#{state.space}1#{state.object_nl}"\ "#{state.indent * (state.depth - 1)}}" end - indent = " " * 2 if RUBY_ENGINE != "ruby" assert_equal <<~JSON.chomp, JSON.pretty_generate([obj] * 2) [ { @@ -338,11 +337,14 @@ class JSONGeneratorTest < Test::Unit::TestCase { "foo": 1 } - #{indent}] + ] JSON state = JSON::State.new(object_nl: "\n", array_nl: "\n", space: " ", indent: " ") state.generate(obj) - assert_equal 1, state.depth + assert_equal 1, state.depth # FIXME + state.depth = 0 + state.generate([obj]) + assert_equal 0, state.depth end def test_depth |
