Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: JRuby 1.6.6, JRuby 1.6.7, JRuby 1.7.0.pre1
    • Fix Version/s: None
    • Component/s: Encoding
    • Labels:
      None
    • Number of attachments :
      0

      Description

      I think that looking directly to the source code will make it easier to understand: https://raw.github.com/plentz/jruby_report/6ca21e77b80d60619c863fcf447626db676dde22/json_builder_test.rb

      The first one breaks, the second one works. Already created a pull request adding some more tests to the json_builder gem(https://github.com/dewski/json_builder/pull/21)

        Activity

        Hide
        Charles Oliver Nutter added a comment -

        It would be helpful to know what you mean by "breaks". It seems like we're able to call the method correctly, and produce a result, but we're not inspecting the string right somewhere (and as a result the inspected output has the escaped character).

          1) Failure:
        test_json_generation_with_unicode_in_key(JsonBuilderTest) [blah.rb:14]:
        Expected "{\"\": \"json\"}", not "{\"\u00E9\": \"json\"}".
        

        The failure is the same on master, but the escape matches how MRI would escape the character now:

          1) Failure:
        test_json_generation_with_unicode_in_key(JsonBuilderTest) [../jruby2/blah.rb:14]:
        Expected: "{\"\": \"json\"}"
          Actual: "{\"\xE9\": \"json\"}"
        
        Show
        Charles Oliver Nutter added a comment - It would be helpful to know what you mean by "breaks". It seems like we're able to call the method correctly, and produce a result, but we're not inspecting the string right somewhere (and as a result the inspected output has the escaped character). 1) Failure: test_json_generation_with_unicode_in_key(JsonBuilderTest) [blah.rb:14]: Expected "{\"\": \"json\"}", not "{\"\u00E9\": \"json\"}". The failure is the same on master, but the escape matches how MRI would escape the character now: 1) Failure: test_json_generation_with_unicode_in_key(JsonBuilderTest) [../jruby2/blah.rb:14]: Expected: "{\"\": \"json\"}" Actual: "{\"\xE9\": \"json\"}"
        Hide
        Diego Plentz added a comment -

        The problem is basic this...with MRI 1.9.3:

        ~/Projects/opensource/jruby_report (master) $ ruby -v
        ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin11.3.0]
        ~/Projects/opensource/jruby_report (master) $ ruby json_builder_test.rb 
        Run options: --seed 22054
        
        # Running tests:
        
        ..
        
        Finished tests in 0.000799s, 2503.1289 tests/s, 2503.1289 assertions/s.
        
        2 tests, 2 assertions, 0 failures, 0 errors, 0 skips
        ~/Projects/opensource/jruby_report (master) $ gem list|grep json_builder
        json_builder (3.0.7)
        

        and with jruby 1.6.7:

        ~/Projects/opensource/jruby_report (master) $ ruby -v
        jruby 1.6.7 (ruby-1.9.2-p312) (2012-02-22 3e82bc8) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_29) [darwin-x86_64-java]
        ~/Projects/opensource/jruby_report (master) $ ruby json_builder_test.rb 
        Loaded suite json_builder_test
        Started
        .F
        Finished in 0.020000 seconds.
        
          1) Failure:
        test_json_generation_with_unicode_in_key(JsonBuilderTest) [json_builder_test.rb:14]:
        Expected "{\"\": \"json\"}", not "{\"\u00E9\": \"json\"}".
        
        2 tests, 2 assertions, 1 failures, 0 errors, 0 skips
        
        Test run options: --seed 56598
        ~/Projects/opensource/jruby_report (master) $ gem list|grep json_builder
        json_builder (3.0.7)
        
        Show
        Diego Plentz added a comment - The problem is basic this...with MRI 1.9.3: ~/Projects/opensource/jruby_report (master) $ ruby -v ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin11.3.0] ~/Projects/opensource/jruby_report (master) $ ruby json_builder_test.rb Run options: --seed 22054 # Running tests: .. Finished tests in 0.000799s, 2503.1289 tests/s, 2503.1289 assertions/s. 2 tests, 2 assertions, 0 failures, 0 errors, 0 skips ~/Projects/opensource/jruby_report (master) $ gem list|grep json_builder json_builder (3.0.7) and with jruby 1.6.7: ~/Projects/opensource/jruby_report (master) $ ruby -v jruby 1.6.7 (ruby-1.9.2-p312) (2012-02-22 3e82bc8) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_29) [darwin-x86_64-java] ~/Projects/opensource/jruby_report (master) $ ruby json_builder_test.rb Loaded suite json_builder_test Started .F Finished in 0.020000 seconds. 1) Failure: test_json_generation_with_unicode_in_key(JsonBuilderTest) [json_builder_test.rb:14]: Expected "{\"\": \"json\"}", not "{\"\u00E9\": \"json\"}". 2 tests, 2 assertions, 1 failures, 0 errors, 0 skips Test run options: --seed 56598 ~/Projects/opensource/jruby_report (master) $ gem list|grep json_builder json_builder (3.0.7)
        Hide
        Charles Oliver Nutter added a comment -

        I believe json fixes over the past year have fixed this.

        Show
        Charles Oliver Nutter added a comment - I believe json fixes over the past year have fixed this.

          People

          • Assignee:
            Charles Oliver Nutter
            Reporter:
            Diego Plentz
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: