Skip to content

Commit

Permalink
Add complex object test with default colors
Browse files Browse the repository at this point in the history
  • Loading branch information
haguenau committed Jan 18, 2019
1 parent 98a672b commit 0d53abc
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/shtest
Original file line number Diff line number Diff line change
Expand Up @@ -274,12 +274,36 @@ if [ "$($VALGRIND $Q $JQ -n '"xyz\n"|halt_error(1)' 2>&1)" != xyz ]; then
fi

# Check $JQ_COLORS
## Default colors, null input
$JQ -Ccn . > $d/color
printf '\033[1;30mnull\033[0m\n' > $d/expect
cmp $d/color $d/expect

## Set non-default color, null input
JQ_COLORS='4;31' $JQ -Ccn . > $d/color
printf '\033[4;31mnull\033[0m\n' > $d/expect
cmp $d/color $d/expect

## Default colors, complex input
$JQ -Ccn '[{"a":true,"b":false},123,null]' > $d/color
(
printf '\033[1;39m[\033[1;39m{'
printf '\033[0m\033[1;34m"a"\033['
printf '0m\033[1;39m:\033[0m\033['
printf '0;39mtrue\033[0m\033[1'
printf ';39m,\033[0m\033[1;34m'
printf '"b"\033[0m\033[1;39m:\033'
printf '[0m\033[0;39mfalse\033'
printf '[0m\033[1;39m\033[1;39'
printf 'm}\033[0m\033[1;39m,\033['
printf '0;39m123\033[0m\033[1;'
printf '39m,\033[1;30mnull\033'
printf '[0m\033[1;39m\033[1;39'
printf 'm]\033[0m\n'
) > $d/expect
cmp -b $d/color $d/expect

## Set non-default colors, complex input
JQ_COLORS='1;30:0;31:0;32:0;33:0;34:1;35:1;36:1;30' \
$JQ -Ccn '[{"a":true,"b":false},123,null]' > $d/color
(
Expand Down

0 comments on commit 0d53abc

Please sign in to comment.