xref: /freebsd/usr.bin/col/tests/col_test.sh (revision dd41de95a84d979615a2ef11df6850622bf6184e)
1# $FreeBSD$
2
3atf_test_case nl
4
5nl_head()
6{
7	atf_set "descr" "testing just newlines"
8}
9nl_body()
10{
11	atf_check \
12		-o inline:"a\nb\n" \
13		-e empty \
14		-s exit:0 \
15		col < $(atf_get_srcdir)/nl.in
16
17	atf_check \
18		-o inline:"a\nb\n" \
19		-e empty \
20		-s exit:0 \
21		col -f < $(atf_get_srcdir)/nl.in
22
23	atf_check \
24		-o inline:"a\nb\n" \
25		-e empty \
26		-s exit:0 \
27		col < $(atf_get_srcdir)/nl2.in
28
29	atf_check \
30		-o inline:"a\nb\n" \
31		-e empty \
32		-s exit:0 \
33		col -f < $(atf_get_srcdir)/nl2.in
34
35	atf_check \
36		-o inline:"a\n\nb\n\n" \
37		-e empty \
38		-s exit:0 \
39		col < $(atf_get_srcdir)/nl3.in
40}
41
42atf_test_case rlf
43
44rlf_head()
45{
46	atf_set "descr" "testing reverse line feed"
47}
48rlf_body()
49{
50	atf_check \
51		-o inline:"a b\n" \
52		-e empty \
53		-s exit:0 \
54		col < $(atf_get_srcdir)/rlf.in
55
56	atf_check \
57		-o inline:"a	b\n" \
58		-e empty \
59		-s exit:0 \
60		col < $(atf_get_srcdir)/rlf2.in
61
62	atf_check \
63		-o inline:"a       b\n" \
64		-e empty \
65		-s exit:0 \
66		col -x < $(atf_get_srcdir)/rlf2.in
67
68	atf_check \
69		-o inline:" b\na\n" \
70		-e empty \
71		-s exit:0 \
72		col < $(atf_get_srcdir)/rlf3.in
73}
74
75atf_test_case hlf
76
77hlf_head()
78{
79	atf_set "descr" "testing half line feed"
80}
81hlf_body()
82{
83	atf_check \
84		-o inline:"a f\naf\n" \
85		-e empty \
86		-s exit:0 \
87		col < $(atf_get_srcdir)/hlf.in
88
89	atf_check \
90		-o inline:"a f9
91 f9
92a\n" \
93		-e empty \
94		-s exit:0 \
95		col -f < $(atf_get_srcdir)/hlf.in
96
97	atf_check \
98		-o inline:"a\n f\n" \
99		-e empty \
100		-s exit:0 \
101		col < $(atf_get_srcdir)/hlf2.in
102
103	atf_check \
104		-o inline:"a9
105 f\n9"  \
106		-e empty \
107		-s exit:0 \
108		col -f < $(atf_get_srcdir)/hlf2.in
109}
110
111atf_init_test_cases()
112{
113	atf_add_test_case nl
114	atf_add_test_case rlf
115	atf_add_test_case hlf
116}
117