slitaz-base-files diff test-libtaz.sh @ rev 321
Update Vietnamese translations (thanks Anh B?nh)
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Mon Jan 16 09:10:51 2017 +0200 (2017-01-16) |
parents | |
children | 65248d132cd2 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/test-libtaz.sh Mon Jan 16 09:10:51 2017 +0200 1.3 @@ -0,0 +1,38 @@ 1.4 +#!/bin/sh 1.5 +# 1.6 +. rootfs/lib/libtaz.sh 1.7 + 1.8 +[ $# -eq 0 ] && title 'Check variables import using libtaz.sh' 1.9 + 1.10 +if [ "$1" == 'test' ]; then env; exit 0; fi 1.11 + 1.12 +ME=$(realpath $0); n=/tmp/n; echo 1 > $n; tests=18 1.13 + 1.14 +t() { 1.15 + i=$(cat $n) 1.16 + printf "%2d/%d: %-16s: test %s" "$i" "$tests" "$1" "$2 $3" >&2 1.17 + $ME test "$2" "$3" 1.18 + echo $((i + 1)) > $n 1.19 +} 1.20 + 1.21 +t 'without dashes' install | grep -qv '^install='; status 1.22 +t 'single dash' -install | grep -qv '^install='; status 1.23 +t 'with dashes' --install | grep -q '^install=yes$'; status 1.24 +t 'empty 1' --install= | grep -q '^install=$'; status 1.25 +t 'non-empty' --install=value | grep -q '^install=value$'; status 1.26 +t 'single quotes' --install='value' | grep -q '^install=value$'; status 1.27 +t 'double quotes' --install="value" | grep -q '^install=value$'; status 1.28 +t 'double "=" 1' --install=all=true | grep -q '^install=all=true$'; status 1.29 +t 'double "=" 2' --install==double | grep -q '^install==double$'; status 1.30 +t 'spaces 1' --install="a bb ccc" | grep -q '^install=a bb ccc$'; status 1.31 +t 'spaces 2' --install=a\ bb\ \ ccc | grep -q '^install=a bb ccc$'; status 1.32 +t 'start with digit' --7zip | grep -q '^_7zip=yes$'; status 1.33 +t 'extra dashes 1' ----install | grep -q '^__install=yes$'; status 1.34 +t 'extra dashes 2' --ins--tall | grep -q '^ins__tall=yes$'; status 1.35 +t 'extra dashes 3' --ins-tall | grep -q '^ins_tall=yes$'; status 1.36 +t 'extra dashes 4' --ins-tall=ins-tall | grep -q '^ins_tall=ins-tall$'; status 1.37 +t 'repeated' --abc=1 --abc=2 | grep -q '^abc=2$'; status 1.38 +t 'dollar sign' --a\$bc=a\$bc | grep -q '^a_bc=a\$bc$'; status 1.39 + 1.40 +footer 'Tests completed' 1.41 +rm $n