~sircmpwn/ctools

ref: 16cab053e27d4a7046c005b5becae9b0564d8211 ctools/test/head -rwxr-xr-x 493 bytes
16cab053 — Christopher Vittal Make test scripts POSIX compliant 1 year, 6 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh
tool="head"
. "$HARNESS"

should_read_from_stdin() (
	[ "$(echo Test Statement | head)" = "Test Statement" ]
)

should_print_10_from_stdin() (
	[ $(largefile | head | wc -l) -eq 10 ]
)

should_handle_largefile_from_stdin() (
	[ $(largefile | head -n 200 | wc -l) -eq 200 ]
)

should_handle_non_existent_file() (
	[ ! $(head inexistantfile) ]
)

runtests \
	should_read_from_stdin \
	should_handle_non_existent_file \
	should_print_10_from_stdin \
	should_handle_largefile_from_stdin