diff options
author | Leah Neukirchen <leah@vuxu.org> | 2017-11-01 17:43:44 +0100 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2017-11-01 17:43:44 +0100 |
commit | 2afc62578a26989713acebe085bbdcb8616069d6 (patch) | |
tree | 208d1f2aafd6e8f9070509df987f31a7c1357cb1 /t/simple.t | |
parent | 478beee7c496dee2b21cfa22c7d984e376954f7b (diff) | |
download | xe-2afc62578a26989713acebe085bbdcb8616069d6.tar.gz xe-2afc62578a26989713acebe085bbdcb8616069d6.tar.xz xe-2afc62578a26989713acebe085bbdcb8616069d6.zip |
convert test suite to tap3 and split into multiple files
Diffstat (limited to 't/simple.t')
-rwxr-xr-x | t/simple.t | 269 |
1 files changed, 269 insertions, 0 deletions
diff --git a/t/simple.t b/t/simple.t new file mode 100755 index 0000000..b418d39 --- /dev/null +++ b/t/simple.t @@ -0,0 +1,269 @@ +#!/bin/sh +export "PATH=.:$PATH" + +printf '1..27\n' +printf '# simple tests\n' + +tap3 'single argument run' <<'EOF' +xe echo +<<< +1 +2 +3 +>>> +1 +2 +3 +EOF + +tap3 'dual argument run' <<'EOF' +xe -N2 echo +<<< +1 +2 +3 +4 +5 +>>> +1 2 +3 4 +5 +EOF + +tap3 'unlimited argument run' <<'EOF' +xe -N0 echo +<<< +1 +2 +3 +4 +5 +>>> +1 2 3 4 5 +EOF + +tap3 'empty input run' <<'EOF' +true | xe echo a +>>> +EOF + +tap3 'dry run' <<'EOF' +xe -n echo x +<<< +a +b +c +>>>2 +echo x a +echo x b +echo x c +EOF + +tap3 'dry run quoting' <<'EOF' +xe -n echo x +<<< +a +b b +c +>>>2 +echo x a +echo x 'b b' +echo x c +EOF + +tap3 'verbose run' <<'EOF' +xe -v echo x +<<< +a +b +c +>>> +x a +x b +x c +>>>2 +echo x a +echo x b +echo x c +EOF + +tap3 'with no command' <<'EOF' +xe -N2 +<<< +1 +2 +3 +>>> +1 +2 +3 +EOF + +tap3 'using {}' <<'EOF' +xe echo a {} x +<<< +1 +2 +3 +>>> +a 1 x +a 2 x +a 3 x +EOF + +tap3 'using {} twice' <<'EOF' +xe echo {} x {} +<<< +1 +2 +3 +>>> +1 x {} +2 x {} +3 x {} +EOF + +tap3 'using -I%' <<'EOF' +xe -I% echo {} x % +<<< +1 +2 +3 +>>> +{} x 1 +{} x 2 +{} x 3 +EOF + +tap3 'using -I "" to disable' <<'EOF' +xe -I "" echo {} x % +<<< +1 +2 +3 +>>> +{} x % 1 +{} x % 2 +{} x % 3 +EOF + +tap3 'using {} with multiple arguments' <<'EOF' +xe -N2 echo a {} x {} +<<< +1 +2 +3 +>>> +a 1 2 x {} +a 3 x {} +EOF + +tap3 'using -0' <<'EOF' +printf "foo\0bar\0quux" | xe -0 echo +>>> +foo +bar +quux +EOF + +tap3 'using -a' <<'EOF' +xe -a echo -- 1 2 3 +>>> +1 +2 +3 +EOF + +tap3 'using -a with no arguments' <<'EOF' +xe -a echo +>>> +EOF + +tap3 'using -a with no command' <<'EOF' +xe -N2 -a -- 1 2 3 +>>> +1 +2 +3 +EOF + +tap3 'using -A%' <<'EOF' +xe -A% echo -- % 1 2 3 +>>> +-- 1 +-- 2 +-- 3 +EOF + +tap3 'using -A% with no arguments' <<'EOF' +xe -A% echo +>>>2 +xe: '-A %' used but no separator '%' found in command line. +EOF + +tap3 'using -A% with no command' <<'EOF' +xe -N2 -A% % 1 2 3 +>>> +1 +2 +3 +EOF + +tap3 'using -f' <<'EOF' +echo notme | xe -f Makefile echo +>>> /DESTDIR/ +EOF + +tap3 'using -s' <<'EOF' +xe -s 'echo x$1' +<<< +1 +2 +3 +>>> +x1 +x2 +x3 +EOF + +tap3 'using -s with -N0' <<'EOF' +xe -N0 -s 'echo x$@' +<<< +1 +2 +3 +>>> +x1 2 3 +EOF + +tap3 'using -s with -a' <<'EOF' +xe -s 'echo x$@' -a 1 2 3 +>>> +x1 +x2 +x3 +EOF + +tap3 'using -s with -a' <<'EOF' +xe -a -s 'echo x$@' 1 2 3 +>>> +x1 +x2 +x3 +EOF + +tap3 'using -s with -a' <<'EOF' +xe -a -s 'echo x$@' -- 1 2 3 +>>> +x1 +x2 +x3 +EOF + +tap3 'with ITER' <<'EOF' +xe -a -s 'echo $ITER' -- a b c +>>> +1 +2 +3 +EOF |