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

JSON::Parser does not reject inputs that it should #4283

Closed
headius opened this issue Nov 14, 2016 · 3 comments
Closed

JSON::Parser does not reject inputs that it should #4283

headius opened this issue Nov 14, 2016 · 3 comments

Comments

@headius
Copy link
Member

headius commented Nov 14, 2016

Environment

JRuby master running updated Ruby 2.3.1 tests.

Expected Behavior

The following test was added:

  def test_wrong_inputs
    assert_raise(ParserError) { JSON.parse('"foo"') }
    assert_raise(ParserError) { JSON.parse('123') }
    assert_raise(ParserError) { JSON.parse('[] bla') }
    assert_raise(ParserError) { JSON.parse('[] 1') }
    assert_raise(ParserError) { JSON.parse('[] []') }
    assert_raise(ParserError) { JSON.parse('[] {}') }
    assert_raise(ParserError) { JSON.parse('{} []') }
    assert_raise(ParserError) { JSON.parse('{} {}') }
    assert_raise(ParserError) { JSON.parse('[NULL]') }
    assert_raise(ParserError) { JSON.parse('[FALSE]') }
    assert_raise(ParserError) { JSON.parse('[TRUE]') }
    assert_raise(ParserError) { JSON.parse('[07]    ') }
    assert_raise(ParserError) { JSON.parse('[0a]') }
    assert_raise(ParserError) { JSON.parse('[1.]') }
    assert_raise(ParserError) { JSON.parse('     ') }
  end

Actual Behavior

We fail immediately on the first line.

@headius
Copy link
Member Author

headius commented Dec 13, 2016

Copy @flori since he still maintains the json library.

@headius headius modified the milestones: JRuby 9.2.0.0, JRuby 9.1.7.0 Dec 13, 2016
@flori
Copy link

flori commented Dec 13, 2016

According to RFC 7159 the first two assertions are incorrect now and can be deleted.

@headius headius closed this as completed May 15, 2018
@headius
Copy link
Member Author

headius commented May 15, 2018

Updated json gem + tests no longer has this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants