Thomas De Schampheleire | e0f6176 | 2018-09-13 15:01:45 +0200 | [diff] [blame] | 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 | |
Thomas De Schampheleire | 6608879 | 2018-09-13 15:01:46 +0200 | [diff] [blame] | 24 | testing "head (without args)" \ |
| 25 | "head head.input" \ |
| 26 | "line 1\nline 2\nline 3\nline 4\nline 5\nline 6\nline 7\nline 8\nline 9\nline 10\n" \ |
| 27 | "" "" |
| 28 | |
| 29 | testing "head -n <positive number>" \ |
| 30 | "head -n 2 head.input" \ |
| 31 | "line 1\nline 2\n" \ |
| 32 | "" "" |
| 33 | |
Denys Vlasenko | 1476760 | 2018-12-27 22:52:13 +0100 | [diff] [blame] | 34 | optional FEATURE_FANCY_HEAD |
Thomas De Schampheleire | e0f6176 | 2018-09-13 15:01:45 +0200 | [diff] [blame] | 35 | testing "head -n <negative number>" \ |
| 36 | "head -n -9 head.input" \ |
| 37 | "line 1\nline 2\nline 3\n" \ |
| 38 | "" "" |
Denys Vlasenko | 1476760 | 2018-12-27 22:52:13 +0100 | [diff] [blame] | 39 | SKIP= |
Thomas De Schampheleire | e0f6176 | 2018-09-13 15:01:45 +0200 | [diff] [blame] | 40 | |
| 41 | rm head.input |
| 42 | |
| 43 | exit $FAILCOUNT |