comparison tests/xargs.test @ 1485:8700cbe1cb29 draft

Move testsuite out of scripts/test into its own top level tests directory, and make ctrl-c kill "make test" more reliably.
author Rob Landley <rob@landley.net>
date Sat, 20 Sep 2014 13:09:14 -0500
parents scripts/test/xargs.test@786841fdb1e0
children
comparison
equal deleted inserted replaced
1484:19435f12ec63 1485:8700cbe1cb29
1 #!/bin/bash
2
3 [ -f testing.sh ] && . testing.sh
4
5 #testing "name" "command" "result" "infile" "stdin"
6
7 testing "xargs" "xargs && echo yes" "hello\nyes\n" "" "hello"
8 testing "xargs spaces" "xargs" \
9 "one two three four\n" "" "one two\tthree \nfour\n\n"
10
11 testing "xargs -n 0" "xargs -n 0 2>/dev/null || echo ok" "ok\n" \
12 "" "one \ntwo\n three"
13 testing "xargs -n 2" "xargs -n 2" "one two\nthree\n" "" "one \ntwo\n three"
14 testing "xargs -n exact match" "xargs -n 3" "one two three\n" "" "one two three"
15 testing "xargs2" "xargs -n2" "one two\nthree four\nfive\n" "" \
16 "one two three four five"
17 testing "xargs -s too long" "xargs -s 9 echo 2>/dev/null || echo ok" \
18 "one\ntwo\nok\n" "" "one two three"
19 testing "xargs -s 13" "xargs -s 13 echo" "one two\nthree\n" "" "one \ntwo\n three"
20 testing "xargs -s 12" "xargs -s 12 echo" "one\ntwo\nthree\n" "" "one \ntwo\n three"
21
22 touch one two three
23 testing "xargs command -opt" "xargs -n2 ls -1" "one\ntwo\nthree\n" "" \
24 "one two three"
25 rm one two three
26
27 exit
28
29 testing "xargs -n exact match"
30 testing "xargs -s exact match"
31 testing "xargs -s 0"
32 testing "xargs -s impossible"
33
34 # xargs command_not_found - returns 127
35 # xargs false - returns 1