From 909c851dcc0fda20b24571225311d30ce273093f Mon Sep 17 00:00:00 2001 From: freestrings Date: Mon, 17 Jun 2019 12:21:32 +0900 Subject: [PATCH] Results do not match other implementations - js unit test --- Cargo.toml | 2 +- nodejs/native/Cargo.toml | 2 +- nodejs/test/index.spec.js | 9 +++++++++ src/parser/parser.rs | 2 +- wasm/Cargo.toml | 2 +- wasm/tests/test/index.spec.js | 9 +++++++++ 6 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3daccb5..afda4ad 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "jsonpath_lib" -version = "0.2.0" +version = "0.2.2" authors = ["Changseok Han "] description = "It is JsonPath engine written in Rust. it provide a similar API interface in Webassembly and Javascript also. - Webassembly Demo: https://freestrings.github.io/jsonpath" diff --git a/nodejs/native/Cargo.toml b/nodejs/native/Cargo.toml index 2c52d00..37e3440 100644 --- a/nodejs/native/Cargo.toml +++ b/nodejs/native/Cargo.toml @@ -14,7 +14,7 @@ exclude = ["artifacts.json", "index.node"] neon-build = "0.2.0" [dependencies] -jsonpath_lib = "0.2.0" +jsonpath_lib = "0.2.2" #jsonpath_lib = { path = "../../" } neon = "0.2.0" neon-serde = "0.1.1" diff --git a/nodejs/test/index.spec.js b/nodejs/test/index.spec.js index c948aae..a5130bb 100644 --- a/nodejs/test/index.spec.js +++ b/nodejs/test/index.spec.js @@ -797,4 +797,13 @@ describe('README test', () => { done(); } }); +}); + +describe('ISSUE test', () => { + it('Results do not match other implementations #6', (done) => { + let result = jsonpath.select(["first", "second"], "$[:]"); + if (JSON.stringify(result) === JSON.stringify(["first", "second"])) { + done(); + } + }); }); \ No newline at end of file diff --git a/src/parser/parser.rs b/src/parser/parser.rs index bdd2184..15fd49a 100644 --- a/src/parser/parser.rs +++ b/src/parser/parser.rs @@ -377,7 +377,7 @@ impl Parser { debug!("#range_to"); match tokenizer.peek_token() { Ok(Token::CloseArray(_)) => { - return Ok(Self::node(ParseToken::Range(None, None))) + return Ok(Self::node(ParseToken::Range(None, None))); } _ => {} } diff --git a/wasm/Cargo.toml b/wasm/Cargo.toml index c089ee4..5517b21 100644 --- a/wasm/Cargo.toml +++ b/wasm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "jsonpath-wasm" -version = "0.2.1" +version = "0.2.2" authors = ["Changseok Han "] description = "It is Webassembly version of jsonpath_lib that is JsonPath engine written in Rust - Demo: https://freestrings.github.io/jsonpath" keywords = ["jsonpath", "json", "webassembly", "parsing", "rust"] diff --git a/wasm/tests/test/index.spec.js b/wasm/tests/test/index.spec.js index 97d7dc7..7d08690 100644 --- a/wasm/tests/test/index.spec.js +++ b/wasm/tests/test/index.spec.js @@ -821,4 +821,13 @@ describe('README test', () => { done(); } }); +}); + +describe('ISSUE test', () => { + it('Results do not match other implementations #6', (done) => { + let result = jsonpath.select(["first", "second"], "$[:]"); + if (JSON.stringify(result) === JSON.stringify(["first", "second"])) { + done(); + } + }); }); \ No newline at end of file