File tree 3 files changed +13
-4
lines changed
3 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -122,7 +122,7 @@ JSON._dump() {
122
122
fi
123
123
done
124
124
prev=(" ${line[@]} " )
125
- done < <( sort -k1,1V -u; )
125
+ done < <( sort -k ' 1,1 ' -u )
126
126
local indent=$(( ${# stack} - 1 ))
127
127
for (( i= 0 ; i< ${# stack} ; i++ )) ; do
128
128
if [ " ${stack: $i : 1} " = " a" ]; then
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ test_dump() {
28
28
dbg json2
29
29
is " $json2 " " $json1 " " dump | load | dump produces same result as dump"
30
30
31
- is " $( grep -o : <<< " $json1" | wc -l) " \
31
+ is $( grep -o : <<< " $json1" | wc -l) \
32
32
" $( grep -oE ' /[^/ ]*' test/dump.data | sort -u | grep -cvE ' /[0-9]*$' ) " \
33
33
" dumped result contains correct number of keys"
34
34
Original file line number Diff line number Diff line change @@ -15,14 +15,23 @@ is "$(JSON.get '/files/file 2.txt/type' tree1)" \
15
15
16
16
file_object=$( JSON.object ' /files' tree1)
17
17
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
+
18
27
keys=" $( JSON.keys ' /' file_object) "
19
28
is " $keys " \
20
- " file1.txt " $' \n ' " file 2.txt " \
29
+ " $expect " \
21
30
" JSON.keys '/'" # '
22
31
23
32
keys=" $( JSON.keys ' /files' tree1) "
24
33
is " $keys " \
25
- " file1.txt " $' \n ' " file 2.txt " \
34
+ " $expect " \
26
35
" JSON.keys '/files'" # '
27
36
28
37
keys=" $( JSON.keys ' /' tree1) "
You can’t perform that action at this time.
0 commit comments