diff options
author | Ron Yorston <rmy@pobox.com> | 2022-10-12 10:43:26 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2022-10-12 10:43:26 +0100 |
commit | 49c6f079acb4edae84b4496bd941cdbb5048ba01 (patch) | |
tree | ac54ecaad45050f7bfe274a11db29882aa32a9a8 /testsuite | |
parent | a55cf07365ec2ff51749a77e09ae9edac79a99fe (diff) | |
parent | c8c1fcdba163f264a503380bc63485aacd09214c (diff) | |
download | busybox-w32-49c6f079acb4edae84b4496bd941cdbb5048ba01.tar.gz busybox-w32-49c6f079acb4edae84b4496bd941cdbb5048ba01.tar.bz2 busybox-w32-49c6f079acb4edae84b4496bd941cdbb5048ba01.zip |
Merge branch 'busybox' into merge
Diffstat (limited to 'testsuite')
-rwxr-xr-x | testsuite/awk.tests | 6 | ||||
-rwxr-xr-x | testsuite/sha1sum.tests | 10 | ||||
-rwxr-xr-x | testsuite/sort.tests | 21 | ||||
-rwxr-xr-x | testsuite/tree.tests | 100 | ||||
-rwxr-xr-x | testsuite/xxd.tests | 23 |
5 files changed, 160 insertions, 0 deletions
diff --git a/testsuite/awk.tests b/testsuite/awk.tests index 93e25d8c1..bbf0fbff1 100755 --- a/testsuite/awk.tests +++ b/testsuite/awk.tests | |||
@@ -479,4 +479,10 @@ testing 'awk backslash+newline eaten with no trace' \ | |||
479 | "Hello world\n" \ | 479 | "Hello world\n" \ |
480 | '' '' | 480 | '' '' |
481 | 481 | ||
482 | testing 'awk assign while test' \ | ||
483 | "awk '\$1==\$1=\"foo\" {print \$1}'" \ | ||
484 | "foo\n" \ | ||
485 | "" \ | ||
486 | "foo" | ||
487 | |||
482 | exit $FAILCOUNT | 488 | exit $FAILCOUNT |
diff --git a/testsuite/sha1sum.tests b/testsuite/sha1sum.tests index a968fa87c..7ad1334c3 100755 --- a/testsuite/sha1sum.tests +++ b/testsuite/sha1sum.tests | |||
@@ -1,3 +1,13 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | 2 | ||
3 | . ./testing.sh | ||
4 | |||
5 | # testing "test name" "cmd" "expected result" "file input" "stdin" | ||
6 | >EMPTY | ||
7 | testing "sha1sum: one-space separated input for -c" \ | ||
8 | 'echo "da39a3ee5e6b4b0d3255bfef95601890afd80709 EMPTY" | sha1sum -c' \ | ||
9 | "EMPTY: OK\n" \ | ||
10 | "" "" | ||
11 | rm EMPTY | ||
12 | |||
3 | . ./md5sum.tests sha1sum d41337e834377140ae7f98460d71d908598ef04f | 13 | . ./md5sum.tests sha1sum d41337e834377140ae7f98460d71d908598ef04f |
diff --git a/testsuite/sort.tests b/testsuite/sort.tests index ff33e21b4..8dbadbdae 100755 --- a/testsuite/sort.tests +++ b/testsuite/sort.tests | |||
@@ -219,4 +219,25 @@ testing "sort -h" \ | |||
219 | 219 | ||
220 | # testing "description" "command(s)" "result" "infile" "stdin" | 220 | # testing "description" "command(s)" "result" "infile" "stdin" |
221 | 221 | ||
222 | testing "sort -k2,2M" \ | ||
223 | "sort -k2,2M input" "\ | ||
224 | 3 March | ||
225 | 2 April | ||
226 | 1 May | ||
227 | " "\ | ||
228 | 2 April | ||
229 | 1 May | ||
230 | 3 March | ||
231 | " "" | ||
232 | |||
233 | testing "sort -s -u" \ | ||
234 | "sort -s -u -k 2 input" "\ | ||
235 | z a | ||
236 | z b | ||
237 | " "\ | ||
238 | z b | ||
239 | a b | ||
240 | z a | ||
241 | a a" "" | ||
242 | |||
222 | exit $FAILCOUNT | 243 | exit $FAILCOUNT |
diff --git a/testsuite/tree.tests b/testsuite/tree.tests new file mode 100755 index 000000000..4f4a9e30b --- /dev/null +++ b/testsuite/tree.tests | |||
@@ -0,0 +1,100 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # Copyright 2022 by Roger Knecht <rknecht@pm.me> | ||
4 | # Licensed under GPLv2, see file LICENSE in this source tree. | ||
5 | |||
6 | . ./testing.sh -v | ||
7 | |||
8 | # testing "description" "command" "result" "infile" "stdin" | ||
9 | |||
10 | testing "tree error opening dir" \ | ||
11 | "tree tree.tempdir" \ | ||
12 | "\ | ||
13 | tree.tempdir [error opening dir]\n\ | ||
14 | \n\ | ||
15 | 0 directories, 0 files\n" \ | ||
16 | "" "" | ||
17 | |||
18 | mkdir -p tree2.tempdir | ||
19 | touch tree2.tempdir/testfile | ||
20 | |||
21 | testing "tree single file" \ | ||
22 | "cd tree2.tempdir && tree" \ | ||
23 | "\ | ||
24 | .\n\ | ||
25 | └── testfile\n\ | ||
26 | \n\ | ||
27 | 0 directories, 1 files\n" \ | ||
28 | "" "" | ||
29 | |||
30 | mkdir -p tree3.tempdir/test1 \ | ||
31 | tree3.tempdir/test2/a \ | ||
32 | tree3.tempdir/test2/b \ | ||
33 | tree3.tempdir/test3/c \ | ||
34 | tree3.tempdir/test3/d | ||
35 | |||
36 | touch tree3.tempdir/test2/a/testfile1 \ | ||
37 | tree3.tempdir/test2/a/testfile2 \ | ||
38 | tree3.tempdir/test2/a/testfile3 \ | ||
39 | tree3.tempdir/test2/b/testfile4 \ | ||
40 | tree3.tempdir/test3/c/testfile5 \ | ||
41 | tree3.tempdir/test3/d/testfile6 \ | ||
42 | tree3.tempdir/test3/d/.testfile7 | ||
43 | |||
44 | (cd tree3.tempdir/test2/a && ln -s ../b/testfile4 .) | ||
45 | (cd tree3.tempdir/test2/b && ln -s ../../test3 .) | ||
46 | |||
47 | testing "tree nested directories and files" \ | ||
48 | "cd tree3.tempdir && tree" \ | ||
49 | "\ | ||
50 | .\n\ | ||
51 | ├── test1\n\ | ||
52 | ├── test2\n\ | ||
53 | │ ├── a\n\ | ||
54 | │ │ ├── testfile1\n\ | ||
55 | │ │ ├── testfile2\n\ | ||
56 | │ │ ├── testfile3\n\ | ||
57 | │ │ └── testfile4 -> ../b/testfile4\n\ | ||
58 | │ └── b\n\ | ||
59 | │ ├── test3 -> ../../test3\n\ | ||
60 | │ └── testfile4\n\ | ||
61 | └── test3\n\ | ||
62 | ├── c\n\ | ||
63 | │ └── testfile5\n\ | ||
64 | └── d\n\ | ||
65 | └── testfile6\n\ | ||
66 | \n\ | ||
67 | 7 directories, 8 files\n" \ | ||
68 | "" "" | ||
69 | #note: tree v2.0.1 says "8 directories, 7 files": | ||
70 | #it counts "test3 -> ../../test3" as a directory, even though it does not follow this symlink | ||
71 | |||
72 | testing "tree multiple directories" \ | ||
73 | "tree tree2.tempdir tree3.tempdir" \ | ||
74 | "\ | ||
75 | tree2.tempdir\n\ | ||
76 | └── testfile\n\ | ||
77 | tree3.tempdir\n\ | ||
78 | ├── test1\n\ | ||
79 | ├── test2\n\ | ||
80 | │ ├── a\n\ | ||
81 | │ │ ├── testfile1\n\ | ||
82 | │ │ ├── testfile2\n\ | ||
83 | │ │ ├── testfile3\n\ | ||
84 | │ │ └── testfile4 -> ../b/testfile4\n\ | ||
85 | │ └── b\n\ | ||
86 | │ ├── test3 -> ../../test3\n\ | ||
87 | │ └── testfile4\n\ | ||
88 | └── test3\n\ | ||
89 | ├── c\n\ | ||
90 | │ └── testfile5\n\ | ||
91 | └── d\n\ | ||
92 | └── testfile6\n\ | ||
93 | \n\ | ||
94 | 7 directories, 9 files\n" \ | ||
95 | "" "" | ||
96 | #note: tree v2.0.1 says "8 directories, 7 files" (not "8 files", probably a/testfile4 -> ../b/testfile4 and b/testfile4 are counted as one file, not 2?) | ||
97 | |||
98 | rm -rf tree.tempdir tree2.tempdir tree3.tempdir | ||
99 | |||
100 | exit $FAILCOUNT | ||
diff --git a/testsuite/xxd.tests b/testsuite/xxd.tests index 76fa96af9..2c740abc8 100755 --- a/testsuite/xxd.tests +++ b/testsuite/xxd.tests | |||
@@ -37,4 +37,27 @@ testing 'xxd -p -r' \ | |||
37 | '' \ | 37 | '' \ |
38 | '30313233343536373736353433323130 30313233343536373736353433323130' | 38 | '30313233343536373736353433323130 30313233343536373736353433323130' |
39 | 39 | ||
40 | testing 'xxd -r skips leading whitespace and truncates at two spaces' \ | ||
41 | 'xxd -r' \ | ||
42 | '0123456789:;<=>?@' \ | ||
43 | '' "\ | ||
44 | 00000000: 3031 3233 3435 3637 3839 3a3b 3c3d 3e3f 0123456789:;<=>? | ||
45 | 00000010: 40 @ | ||
46 | " | ||
47 | |||
48 | testing 'xxd -p -r skips one bad char, truncates at two bad chars' \ | ||
49 | 'xxd -p -r' \ | ||
50 | '01' \ | ||
51 | '' "\ | ||
52 | 30 !31 !!32 | ||
53 | " | ||
54 | |||
55 | testing 'xxd -p -r ignores the nibble with 2nd char bad' \ | ||
56 | 'xxd -p -r' \ | ||
57 | '3C6' \ | ||
58 | '' "\ | ||
59 | 33 3!4 3!!5 | ||
60 | 36 | ||
61 | " | ||
62 | |||
40 | exit $FAILCOUNT | 63 | exit $FAILCOUNT |