bashtools / JSONPath.sh

JSONPath implementation in Bash for filtering, merging and modifying JSON
https://bashtools.github.io/JSONPath.sh/
Other
54 stars 14 forks source link

Failing test case related to case insensitivity #8

Closed cburgmer closed 4 years ago

cburgmer commented 5 years ago

I can reproduce the following two queries failing when running ./all-tests.sh:

$ cat test/valid/goessner.net.expanded.argp20
$.store.book[?(@.title<"j")].title
$ cat test/valid/goessner.net.expanded.argp21
$.store.book[?(@.title>"j")].title

It seems all the entries missing in the latter query (i.e. greater than j) turn up in the previous one instead (i.e. lighter than j). This would be correct if case sensitivity is respected.

Output:

TEST: test/valid-test.sh
1..73
ok 1 - valid/api.github.com.argp1
... snip ...
ok 22 - valid/goessner.net.expanded.argp2
--- -   2019-09-29 20:51:08.000000000 +0200
+++ valid/goessner.net.expanded_argp20.parsed   2019-09-29 14:01:19.000000000 +0200
@@ -1,25 +1,11 @@
-["store","book",0,"title"] "Sayings of the Century"
-["store","book",1,"title"] "Sword of Honour"
-["store","book",2,"title"] "Moby Dick"
-["store","book",3,"title"] "The Lord of the Rings"
-["store","book",4,"title"] "Planet Urth"
 ["store","book",5,"title"] "Girl From Above: Betrayal (The 1000 Revolution)"
 ["store","book",6,"title"] "Girl From Above: Escape (The 1000 Revolution Book 2)"
 ["store","book",7,"title"] "Girl From Above: Trapped (The 1000 Revolution Book 3)"
 ["store","book",8,"title"] "Girl From Above: Trust (The 1000 Revolution Book 4)"
-["store","book",9,"title"] "Leviathan Wakes: Book 1 of the Expanse"
 ["store","book",10,"title"]    "Caliban's War: Book 2 of the Expanse"
 ["store","book",11,"title"]    "Abaddon's Gate: Book 3 of the Expanse"
-["store","book",12,"title"]    "The Reality Dysfunction (Nights Dawn Book 1)"
-["store","book",13,"title"]    "The Naked God (Nights Dawn Book 3)"
-["store","book",14,"title"]    "The Neutronium Alchemist (Nights Dawn Book 2)"
-["store","book",15,"title"]    "The Abyss Beyond Dreams (Chronicle of the Fallers Book 1)"
-["store","book",16,"title"]    "Night Without Stars (Chronicle of the Fallers Book 2)"
 ["store","book",17,"title"]    "Dark Space: The Original Trilogy (Books 1-3) (Dark Space Trilogies)"
 ["store","book",18,"title"]    "Dark Space (Book 4): Revenge"
 ["store","book",19,"title"]    "Dark Space (Book 5): Avilon"
 ["store","book",20,"title"]    "Dark Space (Book 6): Armageddon"
-["store","book",21,"title"]    "The Honour of the Knights (Battle for the Solar System, #1)"
-["store","book",22,"title"]    "The Third Side (Battle for the Solar System, #2)"
-["store","book",23,"title"]    "Split Second"
 ["store","book",24,"title"]    "BrainWeb"
not ok 23 - valid/goessner.net.expanded.argp20
--- -   2019-09-29 20:51:09.000000000 +0200
+++ valid/goessner.net.expanded_argp21.parsed   2019-09-29 14:01:19.000000000 +0200
@@ -0,0 +1,14 @@
+["store","book",0,"title"] "Sayings of the Century"
+["store","book",1,"title"] "Sword of Honour"
+["store","book",2,"title"] "Moby Dick"
+["store","book",3,"title"] "The Lord of the Rings"
+["store","book",4,"title"] "Planet Urth"
+["store","book",9,"title"] "Leviathan Wakes: Book 1 of the Expanse"
+["store","book",12,"title"]    "The Reality Dysfunction (Nights Dawn Book 1)"
+["store","book",13,"title"]    "The Naked God (Nights Dawn Book 3)"
+["store","book",14,"title"]    "The Neutronium Alchemist (Nights Dawn Book 2)"
+["store","book",15,"title"]    "The Abyss Beyond Dreams (Chronicle of the Fallers Book 1)"
+["store","book",16,"title"]    "Night Without Stars (Chronicle of the Fallers Book 2)"
+["store","book",21,"title"]    "The Honour of the Knights (Battle for the Solar System, #1)"
+["store","book",22,"title"]    "The Third Side (Battle for the Solar System, #2)"
+["store","book",23,"title"]    "Split Second"
not ok 24 - valid/goessner.net.expanded.argp21
ok 25 - valid/goessner.net.expanded.argp3
... snip ...
2 test(s) failed
FAIL: test/valid-test.sh 1

I can reproduce this consistently on macOS, Ubuntu (Docker's latest) and Alpine 3.10.