Skip to content

JRuby fails newline tests on Windows #867

@headius

Description

@headius

The JRuby builds on Windows have been disabled in CI since #521. The extension appears to build fine now on Windows, but fails a few tests that check for Windows newlines. The failures are in tests test_generate_custom, test_generate_pretty, and test_generate_pretty and look generally like this:

Failure: test_generate_custom(JSONGeneratorTest)
D:/a/json/json/test/json/json_generator_test.rb:144:in 'test_generate_custom'
     141:   def test_generate_custom
     142:     state = State.new(:space_before => " ", :space => "   ", :indent => "<i>", :object_nl => "\n", :array_nl => "<a_nl>")
     143:     json = generate({1=>{2=>3,4=>[5,6]}}, state)
  => 144:     assert_equal(<<~'JSON'.chomp, json)
     145:       {
     146:       <i>"1" :   {
     147:       <i><i>"2" :   3,
org/jruby/RubyKernel.java:1397:in 'catch'
org/jruby/RubyKernel.java:1392:in 'catch'
org/jruby/RubyArray.java:2088:in 'each'
org/jruby/RubyArray.java:2088:in 'each'
org/jruby/RubyKernel.java:1397:in 'catch'
org/jruby/RubyKernel.java:1392:in 'catch'
<"{\r\n" +
"<i>\"1\" :   {\r\n" +
"<i><i>\"2\" :   3,\r\n" +
"<i><i>\"4\" :   [<a_nl><i><i><i>5,<a_nl><i><i><i>6<a_nl><i><i>]\r\n" +
"<i>}\r\n" +
"}"> expected but was
<"{\n" +
"<i>\"1\" :   {\n" +
"<i><i>\"2\" :   3,\n" +
"<i><i>\"4\" :   [<a_nl><i><i><i>5,<a_nl><i><i><i>6<a_nl><i><i>]\n" +
"<i>}\n" +
"}">

We should fix the dumping to emit proper line terminators.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions