Skip to content

Instantly share code, notes, and snippets.

@SFEley
Created September 19, 2018 18:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SFEley/2cb2b0101ac2e534515db10d8711562c to your computer and use it in GitHub Desktop.
Save SFEley/2cb2b0101ac2e534515db10d8711562c to your computer and use it in GitHub Desktop.
JrJackson test run in JRuby 9.2.0.0
❯ rake test
/Users/Serah/dev/misc/jrjackson/test/jrjackson_test.rb:343: warning: Ambiguous first argument; make sure.
/Users/Serah/dev/misc/jrjackson/test/jrjackson_test.rb:373: warning: Ambiguous first argument; make sure.
/Users/Serah/.rbenv/versions/jruby-9.2.0.0/lib/ruby/gems/shared/gems/power_assert-1.1.3/lib/power_assert.rb:8: warning: tracing (e.g. set_trace_func) will not capture all events without --debug flag
/Users/Serah/.rbenv/versions/jruby-9.2.0.0/lib/ruby/gems/shared/gems/power_assert-1.1.3/lib/power_assert.rb:8: warning: tracing (e.g. set_trace_func) will not capture all events without --debug flag
Loaded suite /Users/Serah/.rbenv/versions/jruby-9.2.0.0/lib/ruby/gems/shared/gems/rake-12.3.1/lib/rake/rake_test_loader
Started
.F
================================================================================
org/jruby/RubyKernel.java:1175:in `catch'
org/jruby/RubyKernel.java:1175:in `catch'
521: mixed = {"mixed" => object}
522: mixed['time'] = timeobj
523: actual = JrJackson::Json.dump(mixed)
=> 524: assert_equal expected, actual
525: end
526:
527: def test_can_serialize_exceptions
/Users/Serah/dev/misc/jrjackson/test/jrjackson_test.rb:524:in `test_can_mix_java_and_ruby_objects'
<"{\"mixed\":{\"arr\":[2,3,4],\"utf8\":\"żółć\",\"flo\":3.33,\"zzz\":{\"one\":1.0,\"two\":2,\"six\":6.0},\"moo\":\"bar\"},\"time\":\"2015-11-11 11:11:11 +0000\"}"> expected but was
<"{\"mixed\":{\"arr\":[2,3,4],\"utf8\":\"żółć\",\"flo\":3.33,\"zzz\":{\"one\":1.0,\"two\":2,\"six\":6.0},\"moo\":\"bar\"},\"time\":\"2015-11-11 11:11:11 -0500\"}">
diff:
? {"mixed":{"arr":[2,3,4],"utf8":"żółć","flo":3.33,"zzz":{"one":1.0,"two":2,"six":6.0},"moo":"bar"},"time":"2015-11-11 11:11:11 +0000"}
? - 5
Failure: test_can_mix_java_and_ruby_objects(JrJacksonTest)
================================================================================
/Users/Serah/dev/misc/jrjackson/test/jrjackson_test.rb:454: warning: BigDecimal.new is deprecated
/Users/Serah/dev/misc/jrjackson/test/jrjackson_test.rb:549: warning: BigDecimal.new is deprecated
/Users/Serah/dev/misc/jrjackson/test/jrjackson_test.rb:549: warning: BigDecimal.new is deprecated
/Users/Serah/dev/misc/jrjackson/test/jrjackson_test.rb:549: warning: BigDecimal.new is deprecated
/Users/Serah/dev/misc/jrjackson/test/jrjackson_test.rb:549: warning: BigDecimal.new is deprecated
.../Users/Serah/dev/misc/jrjackson/test/jrjackson_test.rb:372: warning: constant ::Bignum is deprecated
.F
================================================================================
org/jruby/RubyKernel.java:1175:in `catch'
org/jruby/RubyKernel.java:1175:in `catch'
392: }
393: json = JrJackson::Json.dump(expected)
394: actual = JrJackson::Json.parse_ruby(json)
=> 395: assert_equal expected, actual
396: actual = JrJackson::Ruby.parse(json, {})
397: assert_equal expected, actual
398: end
/Users/Serah/dev/misc/jrjackson/test/jrjackson_test.rb:395:in `test_can_parse_returning_ruby_objects_string_keys'
<{"a"=>"żółć",
"b"=>true,
"c"=>12345,
"d"=>
[true, [false, [-123456789, nil], 3.9676, ["Something else.", false], nil]],
"e"=>{"four"=>[0, 1, 2, 3, 4], "one"=>1, "three"=>[3], "two"=>2, "zero"=>nil},
"h"=>{"a"=>{"b"=>{"c"=>{"d"=>{"e"=>{"f"=>{"g"=>nil}}}}}}},
"i"=>[[[[[[[nil]]]]]]],
"żółć"=>nil}> expected but was
<{"a"=>"żółć",
"b"=>true,
"c"=>"12345",
"d"=>
[true,
[false, ["-123456789", nil], 0.39676e1, ["Something else.", false], nil]],
"e"=>
{"four"=>["0", "1", "2", "3", "4"],
"one"=>"1",
"three"=>["3"],
"two"=>"2",
"zero"=>nil},
"h"=>{"a"=>{"b"=>{"c"=>{"d"=>{"e"=>{"f"=>{"g"=>nil}}}}}}},
"i"=>[[[[[[[nil]]]]]]],
"żółć"=>nil}>
diff:
{"a"=>"żółć",
"b"=>true,
? "c"=>"12345",
"d"=>
+ [true,
? [true, [false, [ -123456789 , nil], 3.9676 , ["Something else.", false], nil]],
? " " 0. e1
+ "e"=>
? "e"=>{"four"=>[ 0 , 1 , 2 , 3 , 4 ], "one"=>1, "three"=>[3], "two"=>2, "zero"=>nil},
? " " " " " " " " " "
+ "one"=>"1",
+ "three"=>["3"],
+ "two"=>"2",
+ "zero"=>nil},
"h"=>{"a"=>{"b"=>{"c"=>{"d"=>{"e"=>{"f"=>{"g"=>nil}}}}}}},
"i"=>[[[[[[[nil]]]]]]],
"żółć"=>nil}
Failure: test_can_parse_returning_ruby_objects_string_keys(JrJacksonTest)
================================================================================
F
================================================================================
org/jruby/RubyKernel.java:1175:in `catch'
org/jruby/RubyKernel.java:1175:in `catch'
410: }
411: json = JrJackson::Json.dump(expected)
412: actual = JrJackson::Ruby.parse_sym(json, {})
=> 413: assert_equal expected, actual
414: end
415:
416: def test_can_parse_nulls
/Users/Serah/dev/misc/jrjackson/test/jrjackson_test.rb:413:in `test_can_parse_returning_ruby_objects_symbol_keys'
<{:a=>"Alpha",
:b=>true,
:c=>12345,
:d=>
[true, [false, [-123456789, nil], 3.9676, ["Something else.", false], nil]],
:e=>{:four=>[0, 1, 2, 3, 4], :one=>1, :three=>[3], :two=>2, :zero=>nil},
:f=>nil,
:h=>{:a=>{:b=>{:c=>{:d=>{:e=>{:f=>{:g=>nil}}}}}}},
:i=>[[[[[[[nil]]]]]]]}> expected but was
<{:a=>"Alpha",
:b=>true,
:c=>"12345",
:d=>
[true,
[false, ["-123456789", nil], 0.39676e1, ["Something else.", false], nil]],
:e=>
{:four=>["0", "1", "2", "3", "4"],
:one=>"1",
:three=>["3"],
:two=>"2",
:zero=>nil},
:f=>nil,
:h=>{:a=>{:b=>{:c=>{:d=>{:e=>{:f=>{:g=>nil}}}}}}},
:i=>[[[[[[[nil]]]]]]]}>
diff:
{:a=>"Alpha",
:b=>true,
? :c=>"12345",
:d=>
+ [true,
? [true, [false, [ -123456789 , nil], 3.9676 , ["Something else.", false], nil]],
? " " 0. e1
+ :e=>
? :e=>{:four=>[ 0 , 1 , 2 , 3 , 4 ], :one=>1, :three=>[3], :two=>2, :zero=>nil},
? " " " " " " " " " "
+ :one=>"1",
+ :three=>["3"],
+ :two=>"2",
+ :zero=>nil},
:f=>nil,
:h=>{:a=>{:b=>{:c=>{:d=>{:e=>{:f=>{:g=>nil}}}}}}},
:i=>[[[[[[[nil]]]]]]]}
Failure: test_can_parse_returning_ruby_objects_symbol_keys(JrJacksonTest)
================================================================================
........F
================================================================================
org/jruby/RubyKernel.java:1175:in `catch'
org/jruby/RubyKernel.java:1175:in `catch'
234: h = {datetime: DateTime.parse("2014-01-27T18:24:46+01:00")}
235: expected = '{"datetime":"2014-01-27 17:24:46 +0000"}'
236: actual = JrJackson::Json.dump(h)
=> 237: assert_equal expected, actual
238: end
239:
240: def test_dump_date_in_array
/Users/Serah/dev/misc/jrjackson/test/jrjackson_test.rb:237:in `test_datetime'
<"{\"datetime\":\"2014-01-27 17:24:46 +0000\"}"> expected but was
<"{\"datetime\":\"2014-01-27 12:24:46 -0500\"}">
diff:
? {"datetime":"2014-01-27 17:24:46 +0000"}
? 2 - 5
Failure: test_datetime(JrJacksonTest)
================================================================================
...F
================================================================================
org/jruby/RubyKernel.java:1175:in `catch'
org/jruby/RubyKernel.java:1175:in `catch'
308: assert_equal JrJackson::Json.dump("foo"), "\"foo\""
309:
310: # Hash and implementations of the Java Hash interface
=> 311: assert_equal JrJackson::Json.dump({"foo" => 1}), "{\"foo\":1}"
312: assert_equal JrJackson::Json.dump(Java::JavaUtil::HashMap.new({"foo" => 1})), "{\"foo\":1}"
313: assert_equal JrJackson::Json.dump(Java::JavaUtil::LinkedHashMap.new({"foo" => 1})), "{\"foo\":1}"
314:
/Users/Serah/dev/misc/jrjackson/test/jrjackson_test.rb:311:in `test_raw_serialize_base_classes'
<"{\"foo\":\"1\"}"> expected but was
<"{\"foo\":1}">
diff:
? {"foo":"1"}
Failure: test_raw_serialize_base_classes(JrJacksonTest)
================================================================================
.....F
================================================================================
org/jruby/RubyKernel.java:1175:in `catch'
org/jruby/RubyKernel.java:1175:in `catch'
300: :co5 => today.to_time.to_s
301: }
302: actual = JrJackson::Json.load(json_string, :symbolize_keys => true)
=> 303: assert_equal expected, actual
304: end
305:
306: def test_raw_serialize_base_classes
/Users/Serah/dev/misc/jrjackson/test/jrjackson_test.rb:303:in `test_serialize_non_json_datatypes_as_values'
<{:co1=>{:one=>"uno", :six=>6.0, :two=>"two"},
:co2=>{:one=>"uno", :six=>6.0, :two=>"two"},
:co3=>{:one=>1.0, :six=>6.0, :two=>2.0},
:co4=>[1, 2, 6],
:co5=>"2018-09-19 00:00:00 -0400",
:dt=>"2018-09-19 14:31:23 -0400",
:sym=>"a_symbol"}> expected but was
<{:co1=>{:one=>"uno", :six=>0.6e1, :two=>"two"},
:co2=>{:one=>"uno", :six=>0.6e1, :two=>"two"},
:co3=>{:one=>0.1e1, :six=>0.6e1, :two=>2},
:co4=>["1", "2", "6"],
:co5=>"2018-09-19 00:00:00 -0400",
:dt=>"2018-09-19 14:31:23 -0400",
:sym=>"a_symbol"}>
diff:
? {:co1=>{:one=>"uno", :six=> 6.0, :two=>"two"},
? 0. e1
? :co2=>{:one=>"uno", :six=> 6.0, :two=>"two"},
? 0. e1
? :co3=>{:one=> 1.0, :six=> 6.0, :two=>2.0},
? 0. e1 0. e1
? :co4=>["1", "2", "6"],
:co5=>"2018-09-19 00:00:00 -0400",
:dt=>"2018-09-19 14:31:23 -0400",
:sym=>"a_symbol"}
Failure: test_serialize_non_json_datatypes_as_values(JrJacksonTest)
================================================================================
..F
================================================================================
org/jruby/RubyKernel.java:1175:in `catch'
org/jruby/RubyKernel.java:1175:in `catch'
495: def test_supports_pretty_printing
496: object = {"foo" => 5, "utf8" => "żółć"}
497: actual = JrJackson::Json.dump(object, :pretty => true)
=> 498: assert_equal "{\n \"foo\" : 5,\n \"utf8\" : \"żółć\"\n}", actual
499: end
500:
501: def test_can_serialise_non_string_keys
/Users/Serah/dev/misc/jrjackson/test/jrjackson_test.rb:498:in `test_supports_pretty_printing'
<"{\n" + " \"foo\" : 5,\n" + " \"utf8\" : \"żółć\"\n" + "}"> expected but was
<"{\n" + " \"foo\" : \"5\",\n" + " \"utf8\" : \"żółć\"\n" + "}">
diff:
{
? "foo" : "5",
"utf8" : "żółć"
}
Failure: test_supports_pretty_printing(JrJacksonTest)
================================================================================
.F
================================================================================
org/jruby/RubyKernel.java:1175:in `catch'
org/jruby/RubyKernel.java:1175:in `catch'
227: object = ToJsonData.new("uno", :two, 6.0)
228: expected = "[1,[\"uno\",\"two\",6.0]]"
229: actual = JrJackson::Json.dump([1, object])
=> 230: assert_equal expected, actual
231: end
232:
233: def test_datetime
/Users/Serah/dev/misc/jrjackson/test/jrjackson_test.rb:230:in `test_to_json_data'
<"[1,[\"uno\",\"two\",6.0]]"> expected but was
<"[\"1\",[\"uno\",\"two\",6.0]]">
diff:
? ["1",["uno","two",6.0]]
Failure: test_to_json_data(JrJacksonTest)
================================================================================
Finished in 1.7016449999999999 seconds.
--------------------------------------------------------------------------------
32 tests, 56 assertions, 8 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
75% passed
--------------------------------------------------------------------------------
18.80 tests/s, 32.91 assertions/s
rake aborted!
Command failed with status (1)
Tasks: TOP => test
(See full trace by running task with --trace)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment