~sircmpwn/ctools

ref: cc69324393fda9bcbc73d30d1bda022263f012a8 ctools/test/head -rwxr-xr-x 493 bytes
cc693243 — Gabor Koszegi Correct tee SIGINT test 1 year, 11 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