Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test failure: "MultiJson ok_json behaves like an adapter .dump allows to dump JSON with UTF-8 characters" #126

Closed
voxik opened this issue Jun 14, 2013 · 7 comments

Comments

@voxik
Copy link
Contributor

voxik commented Jun 14, 2013

I observe following test failure when running the test suite with default locales $ LANG=C rspec ./spec/multi_json_spec.rb:

  1) MultiJson ok_json behaves like an adapter .dump allows to dump JSON with UTF-8 characters
     Failure/Error: expect(MultiJson.dump({'color' => 'żółć'})).to eq('{"color":"żółć"}')

       expected: "{\"color\":\"\u017C\u00F3\u0142\u0107\"}"
            got: "{\"color\":\"\xC5\xBC\xC3\xB3\xC5\x82\xC4\x87\"}"

       (compared using ==)
     Shared Example Group: "an adapter" called from ./spec/multi_json_spec.rb:200
     # /usr/share/gems/gems/rspec-expectations-2.13.0/lib/rspec/expectations/fail_with.rb:32:in `fail_with'
     # /usr/share/gems/gems/rspec-expectations-2.13.0/lib/rspec/expectations/handler.rb:31:in `handle_matcher'
     # /usr/share/gems/gems/rspec-expectations-2.13.0/lib/rspec/expectations/expectation_target.rb:34:in `to'
     # /builddir/build/BUILD/rubygem-multi_json-1.7.7/usr/share/gems/gems/multi_json-1.7.7/spec/adapter_shared_example.rb:125:in `block (3 levels) in <top (required)>'
     # /usr/share/gems/gems/rspec-core-2.13.1/lib/rspec/core/example.rb:114:in `instance_eval'
     # /usr/share/gems/gems/rspec-core-2.13.1/lib/rspec/core/example.rb:114:in `block in run'
     # /usr/share/gems/gems/rspec-core-2.13.1/lib/rspec/core/example.rb:254:in `with_around_each_hooks'
     # /usr/share/gems/gems/rspec-core-2.13.1/lib/rspec/core/example.rb:111:in `run'
     # /usr/share/gems/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:390:in `block in run_examples'
     # /usr/share/gems/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:386:in `map'
     # /usr/share/gems/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:386:in `run_examples'
     # /usr/share/gems/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:371:in `run'
     # /usr/share/gems/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:372:in `block in run'
     # /usr/share/gems/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:372:in `map'
     # /usr/share/gems/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:372:in `run'
     # /usr/share/gems/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:372:in `block in run'
     # /usr/share/gems/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:372:in `map'
     # /usr/share/gems/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:372:in `run'
     # /usr/share/gems/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:372:in `block in run'
     # /usr/share/gems/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:372:in `map'
     # /usr/share/gems/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:372:in `run'
     # /usr/share/gems/gems/rspec-core-2.13.1/lib/rspec/core/command_line.rb:28:in `block (2 levels) in run'
     # /usr/share/gems/gems/rspec-core-2.13.1/lib/rspec/core/command_line.rb:28:in `map'
     # /usr/share/gems/gems/rspec-core-2.13.1/lib/rspec/core/command_line.rb:28:in `block in run'
     # /usr/share/gems/gems/rspec-core-2.13.1/lib/rspec/core/reporter.rb:34:in `report'
     # /usr/share/gems/gems/rspec-core-2.13.1/lib/rspec/core/command_line.rb:25:in `run'
     # /usr/share/gems/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:80:in `run'
     # /usr/share/gems/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:17:in `block in autorun'

Usage of English locales $ LANG=en_US.utf8 rspec ./spec/multi_json_spec.rb solves the issue.

Interestingly enough, executing just the specific case such as $ LANG=C rspec ./spec/multi_json_spec.rb:200, it works just perfect.

I am running the test suite on Fedora Rawhide using Ruby 2.0.0-p195

@sferik
Copy link
Member

sferik commented Jun 14, 2013

I suspect this is related to kr/okjson#16. I'll dive in when I have more time.

@rwz
Copy link
Member

rwz commented Aug 23, 2013

@voxik is the error still present in 1.7.8 or 1.7.9?

@rwz rwz closed this as completed Sep 8, 2013
@voxik
Copy link
Contributor Author

voxik commented Feb 12, 2014

Sorry for my late reponse, but testing with 1.8.4, I still observe this issue.

@rwz
Copy link
Member

rwz commented Feb 12, 2014

Ok, what system are you on? What version of ruby are you using?

@voxik
Copy link
Contributor Author

voxik commented Feb 13, 2014

$ uname -a
Linux unused-4-191.brq.redhat.com 3.12.9-301.fc20.x86_64 #1 SMP Wed Jan 29 15:56:22 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

$ cat /etc/fedora-release 
Fedora release 21 (Rawhide)

$ ruby -v
ruby 2.0.0p353 (2013-11-22) [x86_64-linux]

$ rpm -q ruby
ruby-2.0.0.353-17.fc21.x86_64

@rwz rwz reopened this Feb 17, 2014
@rwz
Copy link
Member

rwz commented Feb 17, 2014

Can you please provide a step-by-step instruction of how to trigger the error on the most recent version of the gem? It'd be nice if you attach your Gemfile as well, both lock and non-lock.

@rwz
Copy link
Member

rwz commented Apr 27, 2014

Ok, closing again. Will reopen when more information is available.

@rwz rwz closed this as completed Apr 27, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants