@@ -548,17 +548,37 @@ function test_jsoncols(){
548
548
assert_empty " test_jsoncols (result3)" " $R "
549
549
550
550
E=" 1"
551
- R=$( bin/jsoncols -i how-to/jsoncols/blob2.json ' .id' )
551
+ R=$( bin/jsoncols -i " how-to/jsoncols/blob2.json" ' .id' )
552
552
assert_equal " test_jsoncols (.id)" " $E " " $R "
553
553
E=" 8"
554
- R=$( bin/jsoncols -i how-to/jsoncols/blob2.json ' .counts[2]' )
554
+ R=$( bin/jsoncols -i " how-to/jsoncols/blob2.json" ' .counts[2]' )
555
555
assert_equal " test_jsoncols (.counts[2])" " $E " " $R "
556
+ E=" 1"
557
+ R=$( bin/jsoncols -i " how-to/jsoncols/blob2.json" ' .map.one' )
558
+ assert_equal " test_jsoncols (.map.two)" " $E " " $R "
556
559
E=" 2"
557
- R=$( bin/jsoncols -i how-to/jsoncols/blob2.json ' .map.two' )
560
+ R=$( bin/jsoncols -i " how-to/jsoncols/blob2.json" ' .map.two' )
558
561
assert_equal " test_jsoncols (.map.two)" " $E " " $R "
562
+ E=" 3"
563
+ R=$( bin/jsoncols -i " how-to/jsoncols/blob2.json" ' .map.three' )
564
+ assert_equal " test_jsoncols (.map.two)" " $E " " $R "
565
+
559
566
E=' {"one":1,"two":2,"three":3}'
560
- R=$( bin/jsoncols -i how-to/jsoncols/blob2.json ' .map' )
561
- assert_equal " test_jsoncols (.map)" " $E " " $R "
567
+ R1=$( bin/jsoncols -i " how-to/jsoncols/blob2.json" ' .map' )
568
+ echo " ${E} " | jsonrange -i - | while read K; do
569
+ R2=$( echo " $R1 " | bin/jsoncols -i - " .$K " )
570
+ case " $K " in
571
+ " one" )
572
+ assert_equal " test_jsoncols (.$K )" " 1" " $R2 "
573
+ ;;
574
+ " two" )
575
+ assert_equal " test_jsoncols (.$K )" " 2" " $R2 "
576
+ ;;
577
+ " three" )
578
+ assert_equal " test_jsoncols (.$K )" " 3" " $R2 "
579
+ ;;
580
+ esac
581
+ done
562
582
563
583
564
584
if [ -f temp.txt ]; then rm temp.txt; fi
@@ -801,6 +821,7 @@ function test_xlsx2json(){
801
821
assert_equal " test_xlsx2json (3)" " $EXPECTED " " $RESULT "
802
822
803
823
if [ -f temp.txt ]; then rm temp.txt; fi
824
+ if [ -f expected1.json ]; then rm expected1.json; fi
804
825
echo " test_xlsx2json OK" ;
805
826
}
806
827
0 commit comments