Skip to content

Commit dcd8292

Browse files
authored
Merge pull request ruby#681 from casperisfine/fix-warnings
Fix some warnings in the test suite
2 parents 5ce7142 + f38fde6 commit dcd8292

File tree

2 files changed

+60
-60
lines changed

2 files changed

+60
-60
lines changed

test/json/json_parser_test.rb

Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -210,64 +210,64 @@ def test_parse_arrays_with_allow_trailing_comma
210210
end
211211

212212
def test_parse_object_with_allow_trailing_comma
213-
assert_equal({}, parse('{}', allow_trailing_comma: true))
214-
assert_equal({}, parse('{}', allow_trailing_comma: false))
215-
assert_raise(JSON::ParserError) { parse('{,}', allow_trailing_comma: true) }
216-
assert_raise(JSON::ParserError) { parse('{,}', allow_trailing_comma: false) }
217-
218-
assert_equal({'foo'=>'bar'}, parse('{"foo":"bar"}', allow_trailing_comma: true))
219-
assert_equal({'foo'=>'bar'}, parse('{"foo":"bar"}', allow_trailing_comma: false))
220-
assert_equal({'foo'=>'bar'}, parse('{"foo":"bar",}', allow_trailing_comma: true))
221-
assert_raise(JSON::ParserError) { parse('{"foo":"bar",}', allow_trailing_comma: false) }
222-
223-
assert_equal(
224-
{'foo'=>'bar', 'baz'=>'qux', 'quux'=>'garply'},
225-
parse('{"foo":"bar","baz":"qux","quux":"garply"}', allow_trailing_comma: true)
226-
)
227-
assert_equal(
228-
{'foo'=>'bar', 'baz'=>'qux', 'quux'=>'garply'},
229-
parse('{"foo":"bar","baz":"qux","quux":"garply"}', allow_trailing_comma: false)
230-
)
231-
assert_equal(
232-
{'foo'=>'bar', 'baz'=>'qux', 'quux'=>'garply'},
233-
parse('{"foo":"bar","baz":"qux","quux":"garply",}', allow_trailing_comma: true)
234-
)
235-
assert_raise(JSON::ParserError) {
236-
parse('{"foo":"bar","baz":"qux","quux":"garply",}', allow_trailing_comma: false)
237-
}
238-
239-
assert_equal(
240-
{'foo'=>'bar', 'baz'=>'qux', 'quux'=>'garply'},
241-
parse('{ "foo":"bar" , "baz":"qux" , "quux":"garply" }', allow_trailing_comma: true)
242-
)
243-
assert_equal(
244-
{'foo'=>'bar', 'baz'=>'qux', 'quux'=>'garply'},
245-
parse('{ "foo":"bar" , "baz":"qux" , "quux":"garply" }', allow_trailing_comma: false)
246-
)
247-
assert_equal(
248-
{'foo'=>'bar', 'baz'=>'qux', 'quux'=>'garply'},
249-
parse('{ "foo":"bar" , "baz":"qux" , "quux":"garply" , }', allow_trailing_comma: true)
250-
)
251-
assert_raise(JSON::ParserError) {
252-
parse('{ "foo":"bar" , "baz":"qux" , "quux":"garply" , }', allow_trailing_comma: false)
253-
}
254-
255-
assert_equal(
256-
[{'foo'=>'bar', 'baz'=>'qux', 'quux'=>'garply'}],
257-
parse('[{"foo":"bar","baz":"qux","quux":"garply"}]', allow_trailing_comma: true)
258-
)
259-
assert_equal(
260-
[{'foo'=>'bar', 'baz'=>'qux', 'quux'=>'garply'}],
261-
parse('[{"foo":"bar","baz":"qux","quux":"garply"}]', allow_trailing_comma: false)
262-
)
263-
assert_equal(
264-
[{'foo'=>'bar', 'baz'=>'qux', 'quux'=>'garply'}],
265-
parse('[{"foo":"bar","baz":"qux","quux":"garply",}]', allow_trailing_comma: true)
266-
)
267-
assert_raise(JSON::ParserError) {
268-
parse('[{"foo":"bar","baz":"qux","quux":"garply",}]', allow_trailing_comma: false)
269-
}
270-
end
213+
assert_equal({}, parse('{}', allow_trailing_comma: true))
214+
assert_equal({}, parse('{}', allow_trailing_comma: false))
215+
assert_raise(JSON::ParserError) { parse('{,}', allow_trailing_comma: true) }
216+
assert_raise(JSON::ParserError) { parse('{,}', allow_trailing_comma: false) }
217+
218+
assert_equal({'foo'=>'bar'}, parse('{"foo":"bar"}', allow_trailing_comma: true))
219+
assert_equal({'foo'=>'bar'}, parse('{"foo":"bar"}', allow_trailing_comma: false))
220+
assert_equal({'foo'=>'bar'}, parse('{"foo":"bar",}', allow_trailing_comma: true))
221+
assert_raise(JSON::ParserError) { parse('{"foo":"bar",}', allow_trailing_comma: false) }
222+
223+
assert_equal(
224+
{'foo'=>'bar', 'baz'=>'qux', 'quux'=>'garply'},
225+
parse('{"foo":"bar","baz":"qux","quux":"garply"}', allow_trailing_comma: true)
226+
)
227+
assert_equal(
228+
{'foo'=>'bar', 'baz'=>'qux', 'quux'=>'garply'},
229+
parse('{"foo":"bar","baz":"qux","quux":"garply"}', allow_trailing_comma: false)
230+
)
231+
assert_equal(
232+
{'foo'=>'bar', 'baz'=>'qux', 'quux'=>'garply'},
233+
parse('{"foo":"bar","baz":"qux","quux":"garply",}', allow_trailing_comma: true)
234+
)
235+
assert_raise(JSON::ParserError) {
236+
parse('{"foo":"bar","baz":"qux","quux":"garply",}', allow_trailing_comma: false)
237+
}
238+
239+
assert_equal(
240+
{'foo'=>'bar', 'baz'=>'qux', 'quux'=>'garply'},
241+
parse('{ "foo":"bar" , "baz":"qux" , "quux":"garply" }', allow_trailing_comma: true)
242+
)
243+
assert_equal(
244+
{'foo'=>'bar', 'baz'=>'qux', 'quux'=>'garply'},
245+
parse('{ "foo":"bar" , "baz":"qux" , "quux":"garply" }', allow_trailing_comma: false)
246+
)
247+
assert_equal(
248+
{'foo'=>'bar', 'baz'=>'qux', 'quux'=>'garply'},
249+
parse('{ "foo":"bar" , "baz":"qux" , "quux":"garply" , }', allow_trailing_comma: true)
250+
)
251+
assert_raise(JSON::ParserError) {
252+
parse('{ "foo":"bar" , "baz":"qux" , "quux":"garply" , }', allow_trailing_comma: false)
253+
}
254+
255+
assert_equal(
256+
[{'foo'=>'bar', 'baz'=>'qux', 'quux'=>'garply'}],
257+
parse('[{"foo":"bar","baz":"qux","quux":"garply"}]', allow_trailing_comma: true)
258+
)
259+
assert_equal(
260+
[{'foo'=>'bar', 'baz'=>'qux', 'quux'=>'garply'}],
261+
parse('[{"foo":"bar","baz":"qux","quux":"garply"}]', allow_trailing_comma: false)
262+
)
263+
assert_equal(
264+
[{'foo'=>'bar', 'baz'=>'qux', 'quux'=>'garply'}],
265+
parse('[{"foo":"bar","baz":"qux","quux":"garply",}]', allow_trailing_comma: true)
266+
)
267+
assert_raise(JSON::ParserError) {
268+
parse('[{"foo":"bar","baz":"qux","quux":"garply",}]', allow_trailing_comma: false)
269+
}
270+
end
271271

272272
def test_parse_some_strings
273273
assert_equal([""], parse('[""]'))

test/json/test_helper.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
# This method was added in Ruby 3.0.0. Calling it this way asks the GC to
2424
# move objects around, helping to find object movement bugs.
2525
begin
26-
GC.verify_compaction_references(double_heap: true, toward: :empty)
27-
rescue NotImplementedError
26+
GC.verify_compaction_references(expand_heap: true, toward: :empty)
27+
rescue NotImplementedError, ArgumentError
2828
# Some platforms don't support compaction
2929
end
3030
end

0 commit comments

Comments
 (0)