Mercurial > hg > toybox
comparison tests/seq.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/seq.test@143a9729fec8 |
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 "seq (exit with error)" "seq 2> /dev/null || echo yes" "yes\n" "" "" | |
8 testing "seq (exit with error)" "seq 1 2 3 4 2> /dev/null || echo yes" \ | |
9 "yes\n" "" "" | |
10 testing "seq one argument" "seq 3" "1\n2\n3\n" "" "" | |
11 testing "seq two arguments" "seq 5 7" "5\n6\n7\n" "" "" | |
12 testing "seq two arguments reversed" "seq 7 5" "" "" "" | |
13 testing "seq two arguments equal" "seq 3 3" "3\n" "" "" | |
14 testing "seq two arguments equal, arbitrary negative step" "seq 1 -15 1" \ | |
15 "1\n" "" "" | |
16 testing "seq two arguments equal, arbitrary positive step" "seq 1 +15 1" \ | |
17 "1\n" "" "" | |
18 testing "seq count up by 2" "seq 4 2 8" "4\n6\n8\n" "" "" | |
19 testing "seq count down by 2" "seq 8 -2 4" "8\n6\n4\n" "" "" | |
20 testing "seq count wrong way #1" "seq 4 -2 8" "" "" "" | |
21 testing "seq count wrong way #2" "seq 8 2 4" "" "" "" | |
22 testing "seq count by .3" "seq 3 .3 4" "3\n3.3\n3.6\n3.9\n" "" "" | |
23 testing "seq count by -.9" "seq .7 -.9 -2.2" "0.7\n-0.2\n-1.1\n-2\n" "" "" | |
24 testing "seq count by zero" "seq 4 0 8 | head -n 10" "" "" "" | |
25 testing "seq separator -" "seq -s - 1 3" "1-2-3\n" "" "" | |
26 testing "seq format string" 'seq -f %+01g -10 5 10' "-10\n-5\n+0\n+5\n+10\n" "" "" | |
27 testing "seq separator and format string" "seq -f \%03g -s \; 5 -1 0" "005;004;003;002;001;000\n" "" "" | |
28 |