File tree Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -122,7 +122,7 @@ JSON._dump() {
122122 fi
123123 done
124124 prev=(" ${line[@]} " )
125- done < <( sort -k1,1V -u; )
125+ done < <( sort -k ' 1,1 ' -u )
126126 local indent=$(( ${# stack} - 1 ))
127127 for (( i= 0 ; i< ${# stack} ; i++ )) ; do
128128 if [ " ${stack: $i : 1} " = " a" ]; then
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ test_dump() {
2828 dbg json2
2929 is " $json2 " " $json1 " " dump | load | dump produces same result as dump"
3030
31- is " $( grep -o : <<< " $json1" | wc -l) " \
31+ is $( grep -o : <<< " $json1" | wc -l) \
3232 " $( grep -oE ' /[^/ ]*' test/dump.data | sort -u | grep -cvE ' /[0-9]*$' ) " \
3333 " dumped result contains correct number of keys"
3434
Original file line number Diff line number Diff line change @@ -15,14 +15,23 @@ is "$(JSON.get '/files/file 2.txt/type' tree1)" \
1515
1616file_object=$( JSON.object ' /files' tree1)
1717
18+ # XXX Can't get osx and linux to sort these the same. Workaround:
19+ {
20+ if [[ " $( uname) " == Darwin ]]; then
21+ expect=" file 2.txt" $' \n ' " file1.txt"
22+ else
23+ expect=" file1.txt" $' \n ' " file 2.txt"
24+ fi
25+ }
26+
1827keys=" $( JSON.keys ' /' file_object) "
1928is " $keys " \
20- " file1.txt " $' \n ' " file 2.txt " \
29+ " $expect " \
2130 " JSON.keys '/'" # '
2231
2332keys=" $( JSON.keys ' /files' tree1) "
2433is " $keys " \
25- " file1.txt " $' \n ' " file 2.txt " \
34+ " $expect " \
2635 " JSON.keys '/files'" # '
2736
2837keys=" $( JSON.keys ' /' tree1) "
You can’t perform that action at this time.
0 commit comments