blob: 97bf889d88fd0afb4c76530a4678f829f4f2ebcf [file] [log] [blame]
Thomas De Schampheleiree0f61762018-09-13 15:01:45 +02001#!/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
9cat <<EOF > head.input
10line 1
11line 2
12line 3
13line 4
14line 5
15line 6
16line 7
17line 8
18line 9
19line 10
20line 11
21line 12
22EOF
23
Thomas De Schampheleire66088792018-09-13 15:01:46 +020024testing "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
29testing "head -n <positive number>" \
30 "head -n 2 head.input" \
31 "line 1\nline 2\n" \
32 "" ""
33
Denys Vlasenko14767602018-12-27 22:52:13 +010034optional FEATURE_FANCY_HEAD
Thomas De Schampheleiree0f61762018-09-13 15:01:45 +020035testing "head -n <negative number>" \
36 "head -n -9 head.input" \
37 "line 1\nline 2\nline 3\n" \
38 "" ""
Denys Vlasenko14767602018-12-27 22:52:13 +010039SKIP=
Thomas De Schampheleiree0f61762018-09-13 15:01:45 +020040
41rm head.input
42
43exit $FAILCOUNT