diff options
author | Thomas De Schampheleire <thomas.de_schampheleire@nokia.com> | 2018-09-13 15:01:45 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2018-09-22 19:40:35 +0200 |
commit | e0f617699f7f1dfa1e56ded54bb1d70fd91c225e (patch) | |
tree | 4bf7bfe431da5f66ece69c20bf0beae4bc6ec20b | |
parent | 426aff88a0802b8da18292079f60f56388d0cdad (diff) | |
download | busybox-w32-e0f617699f7f1dfa1e56ded54bb1d70fd91c225e.tar.gz busybox-w32-e0f617699f7f1dfa1e56ded54bb1d70fd91c225e.tar.bz2 busybox-w32-e0f617699f7f1dfa1e56ded54bb1d70fd91c225e.zip |
head: add test case for negative -n invocation
Commit 2da9724b56169f00bd7fb6b9a11c9409a7620981 broke 'head -n -1' and was
later reverted with 0d598ab9f03dbf320f7b81c05e4a94cb303dfbc7.
This commit adds a test case to avoid future breakage.
Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rwxr-xr-x | testsuite/head.tests | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/testsuite/head.tests b/testsuite/head.tests new file mode 100755 index 000000000..1feecf990 --- /dev/null +++ b/testsuite/head.tests | |||
@@ -0,0 +1,31 @@ | |||
1 | #!/bin/sh | ||
2 | # Copyright 2018 Thomas De Schampheleire <thomas.de_schampheleire@nokia.com> | ||
3 | # Licensed under GPLv2 or later, see file LICENSE in this source tree. | ||
4 | |||
5 | . ./testing.sh | ||
6 | |||
7 | # testing "test name" "command" "expected result" "file input" "stdin" | ||
8 | |||
9 | cat <<EOF > head.input | ||
10 | line 1 | ||
11 | line 2 | ||
12 | line 3 | ||
13 | line 4 | ||
14 | line 5 | ||
15 | line 6 | ||
16 | line 7 | ||
17 | line 8 | ||
18 | line 9 | ||
19 | line 10 | ||
20 | line 11 | ||
21 | line 12 | ||
22 | EOF | ||
23 | |||
24 | testing "head -n <negative number>" \ | ||
25 | "head -n -9 head.input" \ | ||
26 | "line 1\nline 2\nline 3\n" \ | ||
27 | "" "" | ||
28 | |||
29 | rm head.input | ||
30 | |||
31 | exit $FAILCOUNT | ||