Mercurial > hg > toybox
annotate scripts/test/nl.test @ 1178:f8432a8872e0 draft
More work on the cleanup page, partway through describing ifconfig.
author | Rob Landley <rob@landley.net> |
---|---|
date | Wed, 01 Jan 2014 15:00:44 -0600 |
parents | b50e00c9df4b |
children |
rev | line source |
---|---|
1100
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
1 #!/bin/bash |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
2 |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
3 [ -f testing.sh ] && . testing.sh |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
4 |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
5 #testing "name" "command" "result" "infile" "stdin" |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
6 |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
7 testing "nl" "nl" " 1\tone\n 2\ttwo\n 3\tthree\n" \ |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
8 "" "one\ntwo\nthree\n" |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
9 |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
10 testing "nl explicit defaults" "nl -nrn -b a" \ |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
11 " 1\tone\n 2\ttwo\n 3\tthree\n" "" "one\ntwo\nthree\n" |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
12 |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
13 # -n ln rn rz |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
14 |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
15 testing "nl -nln" "nl -nln" "1 \tone\n2 \ttwo\n3 \tthree\n" \ |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
16 "" "one\ntwo\nthree\n" |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
17 testing "nl -nln -w" "nl -nln -w 8" \ |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
18 "1 \tone\n2 \ttwo\n3 \tthree\n" "" "one\ntwo\nthree\n" |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
19 |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
20 testing "nl -nrz" "nl -nrz" "000001\tone\n000002\ttwo\n000003\tthree\n" \ |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
21 "" "one\ntwo\nthree\n" |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
22 |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
23 testing "nl -nrz -w" "nl -w3 -nrz" "001\tone\n002\ttwo\n003\tthree\n" \ |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
24 "" "one\ntwo\nthree\n" |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
25 |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
26 |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
27 # For non-matching lines the separator is "suppressed" meaning it... |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
28 # turns into spaces! And the tab turns into one space, and -d boom turns |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
29 # into 4 spaces, but these: |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
30 # nl -s"$(echo -e 'bo\tom')" -bpand README |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
31 # nl -w 3 -bpthe README |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
32 # Yeah. And I doubt utf8 fontmetrics are used either. |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
33 |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
34 testing "nl -b t" "nl -b t" " \n 1\tone\n \n 2\ttwo\n" \ |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
35 "" "\none\n\ntwo\n" |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
36 testing "nl -b n" "nl -b n" " one\n two\n three\n" \ |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
37 "" "one\ntwo\nthree\n" |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
38 testing "nl -sook -b p" "nl -sook -bpoing" \ |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
39 " one\n 1ookboing\n 2ooksproingy\n" \ |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
40 "" "one\nboing\nsproingy\n" |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
41 |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
42 testing "nl -v" "nl -v 42" " 42\tone\n 43\ttwo\n 44\tthree\n" \ |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
43 "" "one\ntwo\nthree\n" |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
44 testing "nl -l" "nl -ba -l2 -w2 - input" \ |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
45 " 1\tone\n \n 2\t\n 3\ttwo\n \n 4\t\n \n 5\tthree\n 6\tfour\n \n 7\t\n \n 8\tbang\n \n" \ |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
46 "\n\nbang\n\n" "one\n\n\ntwo\n\n\n\nthree\nfour\n\n" |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
47 testing "nl no space" "nl -w 1 -v 42" "42\tline\n" "" "line\n" |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
48 |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
49 # Should test for -E but no other implementation seems to have it? |
b50e00c9df4b
Promote nl from pending to posix, and add tests.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
50 #testing "nl -E" "nl -w2 -sx -Ebp'(one|two)'" " 1x" "one\nand\ntwo\n" |