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