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_lex.html for '.' fails #44

Open
gregglind opened this issue Jul 25, 2013 · 1 comment
Open

test_lex.html for '.' fails #44

gregglind opened this issue Jul 25, 2013 · 1 comment

Comments

@gregglind
Copy link

Which part of the regex is this supposed to match?

Failed example:
JSONSelect._lex(".");
Expected:
[1, "."]

@gregglind
Copy link
Author



Failed example:
    JSONSelect._lex(".");
Expected:
    [1, "."]

Got:
    (nothing)
Failed example:
    JSONSelect._lex('\"not terminated');
Expected:
    Error: unclosed json string
Got:
    Error: unclosed json string in '"not terminated'

Failed example:
    JSONSelect._lex('"invalid escape: \\y"');
Expected:
    Error: invalid json string

Got:
    Error: invalid json string in 'JSON.parse: bad escaped character'

Failed example:
    JSONSelect._lex("foo");
Expected:
    [3, 4, "foo"]
Got:
    (nothing)
Failed example:
    JSONSelect._lex("foo\\ bar");
Expected:
    [8, 4, "foo bar"]
Got:
    (nothing)
Failed example:
    JSONSelect._lex("_aB129bcde-\\:foo\\@$");
Expected:
    [18, 4, "_aB129bcde-:foo@"]

Got:
    (nothing)
Failed example:
    JSONSelect._lex("обичам\\ те\\!");
Expected:
    [12, 4, "обичам те!"]

Got:
    (nothing)
28 tests in 0 items.
21 tests of 28 passed, 7 failed.

Tests of the JSONSelect lexer
Simple tokens

$ JSONSelect._lex(">");
[1, ">"]
$ JSONSelect._lex("*");
[1, "*"]
$ JSONSelect._lex(",");
[1, ","]
$ JSONSelect._lex(".");
[1, "."]

Actual output:

Offsets

$ JSONSelect._lex("foobar>",6);
[7, ">"]

Types

$ JSONSelect._lex("string");
[6, 3, "string"]
$ JSONSelect._lex("boolean");
[7, 3, "boolean"]
$ JSONSelect._lex("null");
[4, 3, "null"]
$ JSONSelect._lex("array");
[5, 3, "array"]
$ JSONSelect._lex("object");
[6, 3, "object"]
$ JSONSelect._lex("number");
[6, 3, "number"]

Whitespace

$ JSONSelect._lex("\r");
[1, " "]
$ JSONSelect._lex("\n");
[1, " "]
$ JSONSelect._lex("\t");
[1, " "]
$ JSONSelect._lex(" ");
[1, " "]
$ JSONSelect._lex("     \t   \r\n  !");
[13, " "]

pseudo classes

$ JSONSelect._lex(":root");
[5, 1, ":root"]
$ JSONSelect._lex(":first-child");
[12, 1, ":first-child"]
$ JSONSelect._lex(":last-child");
[11, 1, ":last-child"]
$ JSONSelect._lex(":only-child");
[11, 1, ":only-child"]

json strings

$ JSONSelect._lex('"foo bar baz"');
[13, 4, "foo bar baz"]
$ JSONSelect._lex('"\\u0020"');
[8, 4, " "]
$ JSONSelect._lex('\"not terminated');
Error: unclosed json string
Actual output:
Error: unclosed json string in '"not terminated'
$ JSONSelect._lex('"invalid escape: \\y"');
Error: invalid json string

Actual output:
Error: invalid json string in 'JSON.parse: bad escaped character'

identifiers (like after '.')

$ JSONSelect._lex("foo");
[3, 4, "foo"]
Actual output:
$ JSONSelect._lex("foo\\ bar");
[8, 4, "foo bar"]
Actual output:
$ JSONSelect._lex("_aB129bcde-\\:foo\\@$");
[18, 4, "_aB129bcde-:foo@"]

Actual output:

non-ascii

$ JSONSelect._lex("обичам\\ те\\!");
[12, 4, "обичам те!"]

Actual output:



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

1 participant