Skip to content

Commit 78aa8d5

Browse files
etiennebarriematzbot
authored andcommitted
[ruby/json] Test current behavior regarding depth for Coder
Coder currently ignores its depth and always resets it to 0 when generating a new JSON document. ruby/json@cca1f38316
1 parent 68a7eda commit 78aa8d5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

test/json/json_coder_test.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,11 @@ def test_json_coder_string_invalid_encoding
132132
assert_equal 2, calls
133133
end
134134

135+
def test_depth
136+
coder = JSON::Coder.new(object_nl: "\n", array_nl: "\n", space: " ", indent: " ", depth: 1)
137+
assert_equal %({\n "foo": 42\n}), coder.dump(foo: 42)
138+
end
139+
135140
def test_nesting_recovery
136141
coder = JSON::Coder.new
137142
ary = []

0 commit comments

Comments
 (0)