Coder Social home page Coder Social logo

jsonp-test-suite's People

Contributors

leadpony avatar ssilverman avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

jsonp-test-suite's Issues

Hex escapes should allow lower- or upper-case letters A-F

I'm checking an implementation of JsonP I'm writing based on Jackson and got these two errors:

Expected :"hello\u000bworld"
Actual   :"hello\u000Bworld"

Expected :"hello\u001bworld"
Actual   :"hello\u001Bworld"

Both of these should be correct, I think.

I can't change the escaping because I'm relying on the underlying Jackson code.

Empty JSON should cause an exception, according to the grammar

According to the JSON grammar, there needs to be at least one thing, be it an object, value, or array. Shouldn't a parsing exception (EOF) be thrown for these? hasNext(), in addition to next(), throws a JsonParsingException when it advances to the next event, and since the parser encounters an EOF before the next event, it's technically invalid JSON.

Ref: https://tools.ietf.org/html/rfc8259#section-2

JSON-text = ws value ws

Two possible outputs for Double?

Referring to these cases in JsonGeneratorTest

    enum DoubleTestCase {
        ZERO(0.0, "0.0"),
        E(Math.E, "2.718281828459045"),
        PI(Math.PI, "3.141592653589793"),
        MAX_VALUE(Double.MAX_VALUE, "1.7976931348623157E308"),
        MIN_VALUE(Double.MIN_VALUE, "4.9E-324");

isn't the MAX_VALUE one also legal if there's a + between the E and 308?

It looks like the JSON grammar allows no character, a plus, or a minus.

String comparisons should normalize to ASCII

Some implementations output "\uXXXX" variants for non-ASCII characters (eg. the "G-clef" example, "\ud834\udd1e"). It might be more useful, in the tests that compare strings, to normalize to ASCII-only before the comparison. Another example: the em-dash (U+2014) in atom-api.json.

The JsonPointer tests should expect the target to be modified

The Javadocs for JsonPointer don't say that the target can't be modified. What leads me to believe this isn't an oversight is that the JsonPatch Javadocs say explicitly that the target isn't modified, so my thinking is that the omission was on purpose.

I've written my JsonPointer implementation to modify the target, and I think this behaviour is the intended one, at least it's my working assumption.

I wish the failing tests used zero-based indexes

It would be nice if the failing/errored tests used zero-based indexes when printing which data caused the failure (instead of 1-based indexes). Or is this in the test container and not in your code?

thrown.getMessage() should first check if thrown is null

There are a number of places where thrown is retrieved from the test and then thrown.getMessage() is called. These places should first check for thrown == null to avoid a possible NullPointerException; these cases will result in a test error but should instead result in a failure.

JsonExclusiveBadTerminationTestCase and EOF behaviour, expect exception?

END_AFTER_ITEM_SEPARATOR("[1,", 2, true),
EOI_AFTER_COLON("{\"a\":", 2, true),
EOI_AFTER_PROPERTY_SEPARATOR("{\"a\": 1,", 3, true);

Similar to #9, since hasNext() is used to check for a next event, and since there's no next event because of an unexpected EOF, shouldn't a JsonParsingException be thrown instead? I'm wondering why this behaviour should be any different than the exceptions expected from the other test cases in these lists (JsonExclusiveBadTerminationTestCase and BadTerminationTestCase).

Open question: When should hasNext() return false and when should it throw an exception due to malformed JSON, i.e. EOF?
Personally, I believe that an unexpected EOF violates the JSON grammar and should cause a parsing exception, and the only time hasNext() should return false is at the end of input.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.