annotate tests/xargs.test @ 1499:319e79bab052 draft

Separate more commands so single.sh can build them standalone.
author Rob Landley <rob@landley.net>
date Fri, 26 Sep 2014 18:42:23 -0500
parents 8700cbe1cb29
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
416
e9f6e7f25854 More work on xargs: bugfix and tests.
Rob Landley <rob@landley.net>
parents:
diff changeset
1 #!/bin/bash
e9f6e7f25854 More work on xargs: bugfix and tests.
Rob Landley <rob@landley.net>
parents:
diff changeset
2
e9f6e7f25854 More work on xargs: bugfix and tests.
Rob Landley <rob@landley.net>
parents:
diff changeset
3 [ -f testing.sh ] && . testing.sh
e9f6e7f25854 More work on xargs: bugfix and tests.
Rob Landley <rob@landley.net>
parents:
diff changeset
4
e9f6e7f25854 More work on xargs: bugfix and tests.
Rob Landley <rob@landley.net>
parents:
diff changeset
5 #testing "name" "command" "result" "infile" "stdin"
e9f6e7f25854 More work on xargs: bugfix and tests.
Rob Landley <rob@landley.net>
parents:
diff changeset
6
e9f6e7f25854 More work on xargs: bugfix and tests.
Rob Landley <rob@landley.net>
parents:
diff changeset
7 testing "xargs" "xargs && echo yes" "hello\nyes\n" "" "hello"
e9f6e7f25854 More work on xargs: bugfix and tests.
Rob Landley <rob@landley.net>
parents:
diff changeset
8 testing "xargs spaces" "xargs" \
e9f6e7f25854 More work on xargs: bugfix and tests.
Rob Landley <rob@landley.net>
parents:
diff changeset
9 "one two three four\n" "" "one two\tthree \nfour\n\n"
e9f6e7f25854 More work on xargs: bugfix and tests.
Rob Landley <rob@landley.net>
parents:
diff changeset
10
e9f6e7f25854 More work on xargs: bugfix and tests.
Rob Landley <rob@landley.net>
parents:
diff changeset
11 testing "xargs -n 0" "xargs -n 0 2>/dev/null || echo ok" "ok\n" \
e9f6e7f25854 More work on xargs: bugfix and tests.
Rob Landley <rob@landley.net>
parents:
diff changeset
12 "" "one \ntwo\n three"
e9f6e7f25854 More work on xargs: bugfix and tests.
Rob Landley <rob@landley.net>
parents:
diff changeset
13 testing "xargs -n 2" "xargs -n 2" "one two\nthree\n" "" "one \ntwo\n three"
e9f6e7f25854 More work on xargs: bugfix and tests.
Rob Landley <rob@landley.net>
parents:
diff changeset
14 testing "xargs -n exact match" "xargs -n 3" "one two three\n" "" "one two three"
e9f6e7f25854 More work on xargs: bugfix and tests.
Rob Landley <rob@landley.net>
parents:
diff changeset
15 testing "xargs2" "xargs -n2" "one two\nthree four\nfive\n" "" \
e9f6e7f25854 More work on xargs: bugfix and tests.
Rob Landley <rob@landley.net>
parents:
diff changeset
16 "one two three four five"
e9f6e7f25854 More work on xargs: bugfix and tests.
Rob Landley <rob@landley.net>
parents:
diff changeset
17 testing "xargs -s too long" "xargs -s 9 echo 2>/dev/null || echo ok" \
e9f6e7f25854 More work on xargs: bugfix and tests.
Rob Landley <rob@landley.net>
parents:
diff changeset
18 "one\ntwo\nok\n" "" "one two three"
e9f6e7f25854 More work on xargs: bugfix and tests.
Rob Landley <rob@landley.net>
parents:
diff changeset
19 testing "xargs -s 13" "xargs -s 13 echo" "one two\nthree\n" "" "one \ntwo\n three"
e9f6e7f25854 More work on xargs: bugfix and tests.
Rob Landley <rob@landley.net>
parents:
diff changeset
20 testing "xargs -s 12" "xargs -s 12 echo" "one\ntwo\nthree\n" "" "one \ntwo\n three"
e9f6e7f25854 More work on xargs: bugfix and tests.
Rob Landley <rob@landley.net>
parents:
diff changeset
21
e9f6e7f25854 More work on xargs: bugfix and tests.
Rob Landley <rob@landley.net>
parents:
diff changeset
22 touch one two three
e9f6e7f25854 More work on xargs: bugfix and tests.
Rob Landley <rob@landley.net>
parents:
diff changeset
23 testing "xargs command -opt" "xargs -n2 ls -1" "one\ntwo\nthree\n" "" \
e9f6e7f25854 More work on xargs: bugfix and tests.
Rob Landley <rob@landley.net>
parents:
diff changeset
24 "one two three"
e9f6e7f25854 More work on xargs: bugfix and tests.
Rob Landley <rob@landley.net>
parents:
diff changeset
25 rm one two three
e9f6e7f25854 More work on xargs: bugfix and tests.
Rob Landley <rob@landley.net>
parents:
diff changeset
26
e9f6e7f25854 More work on xargs: bugfix and tests.
Rob Landley <rob@landley.net>
parents:
diff changeset
27 exit
e9f6e7f25854 More work on xargs: bugfix and tests.
Rob Landley <rob@landley.net>
parents:
diff changeset
28
694
786841fdb1e0 Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
Rob Landley <rob@landley.net>
parents: 416
diff changeset
29 testing "xargs -n exact match"
416
e9f6e7f25854 More work on xargs: bugfix and tests.
Rob Landley <rob@landley.net>
parents:
diff changeset
30 testing "xargs -s exact match"
e9f6e7f25854 More work on xargs: bugfix and tests.
Rob Landley <rob@landley.net>
parents:
diff changeset
31 testing "xargs -s 0"
e9f6e7f25854 More work on xargs: bugfix and tests.
Rob Landley <rob@landley.net>
parents:
diff changeset
32 testing "xargs -s impossible"
e9f6e7f25854 More work on xargs: bugfix and tests.
Rob Landley <rob@landley.net>
parents:
diff changeset
33
e9f6e7f25854 More work on xargs: bugfix and tests.
Rob Landley <rob@landley.net>
parents:
diff changeset
34 # xargs command_not_found - returns 127
e9f6e7f25854 More work on xargs: bugfix and tests.
Rob Landley <rob@landley.net>
parents:
diff changeset
35 # xargs false - returns 1