1183234Ssimon#!/usr/bin/atf-sh
2183234Ssimon# $FreeBSD: head/usr.bin/col/tests/col_test.sh 366577 2020-10-09 15:27:37Z markj $
3238405Sjkim
4183234Ssimonatf_test_case nl
5183234Ssimon
6183234Ssimonnl_head()
7183234Ssimon{
8183234Ssimon	atf_set "descr" "testing just newlines"
9183234Ssimon}
10183234Ssimonnl_body()
11183234Ssimon{
12183234Ssimon	atf_check \
13183234Ssimon		-o inline:"a\nb\n" \
14183234Ssimon		-e empty \
15183234Ssimon		-s exit:0 \
16183234Ssimon		col < $(atf_get_srcdir)/nl.in
17183234Ssimon
18183234Ssimon	atf_check \
19183234Ssimon		-o inline:"a\nb\n" \
20183234Ssimon		-e empty \
21183234Ssimon		-s exit:0 \
22183234Ssimon		col -f < $(atf_get_srcdir)/nl.in
23183234Ssimon
24183234Ssimon	atf_check \
25183234Ssimon		-o inline:"a\nb\n" \
26183234Ssimon		-e empty \
27183234Ssimon		-s exit:0 \
28183234Ssimon		col < $(atf_get_srcdir)/nl2.in
29183234Ssimon
30183234Ssimon	atf_check \
31183234Ssimon		-o inline:"a\nb\n" \
32183234Ssimon		-e empty \
33183234Ssimon		-s exit:0 \
34183234Ssimon		col -f < $(atf_get_srcdir)/nl2.in
35183234Ssimon
36183234Ssimon	atf_check \
37183234Ssimon		-o inline:"a\n\nb\n\n" \
38183234Ssimon		-e empty \
39183234Ssimon		-s exit:0 \
40183234Ssimon		col < $(atf_get_srcdir)/nl3.in
41183234Ssimon}
42183234Ssimon
43183234Ssimonatf_test_case rlf
44183234Ssimon
45183234Ssimonrlf_head()
46183234Ssimon{
47183234Ssimon	atf_set "descr" "testing reverse line feed"
48183234Ssimon}
49183234Ssimonrlf_body()
50183234Ssimon{
51183234Ssimon	atf_check \
52183234Ssimon		-o inline:"a b\n" \
53183234Ssimon		-e empty \
54183234Ssimon		-s exit:0 \
55183234Ssimon		col < $(atf_get_srcdir)/rlf.in
56183234Ssimon
57183234Ssimon	atf_check \
58183234Ssimon		-o inline:"a	b\n" \
59183234Ssimon		-e empty \
60183234Ssimon		-s exit:0 \
61183234Ssimon		col < $(atf_get_srcdir)/rlf2.in
62183234Ssimon
63183234Ssimon	atf_check \
64183234Ssimon		-o inline:"a       b\n" \
65183234Ssimon		-e empty \
66183234Ssimon		-s exit:0 \
67183234Ssimon		col -x < $(atf_get_srcdir)/rlf2.in
68183234Ssimon
69183234Ssimon	atf_check \
70183234Ssimon		-o inline:" b\na\n" \
71183234Ssimon		-e empty \
72183234Ssimon		-s exit:0 \
73183234Ssimon		col < $(atf_get_srcdir)/rlf3.in
74183234Ssimon}
75183234Ssimon
76238405Sjkimatf_test_case hlf
77183234Ssimon
78183234Ssimonhlf_head()
79183234Ssimon{
80183234Ssimon	atf_set "descr" "testing half line feed"
81183234Ssimon}
82183234Ssimonhlf_body()
83183234Ssimon{
84183234Ssimon	atf_check \
85183234Ssimon		-o inline:"a f\naf\n" \
86183234Ssimon		-e empty \
87183234Ssimon		-s exit:0 \
88183234Ssimon		col < $(atf_get_srcdir)/hlf.in
89183234Ssimon
90183234Ssimon	atf_check \
91238405Sjkim		-o inline:"a f9
92183234Ssimon f9
93183234Ssimona\n" \
94183234Ssimon		-e empty \
95183234Ssimon		-s exit:0 \
96183234Ssimon		col -f < $(atf_get_srcdir)/hlf.in
97183234Ssimon
98183234Ssimon	atf_check \
99183234Ssimon		-o inline:"a\n f\n" \
100183234Ssimon		-e empty \
101183234Ssimon		-s exit:0 \
102183234Ssimon		col < $(atf_get_srcdir)/hlf2.in
103183234Ssimon
104183234Ssimon	atf_check \
105183234Ssimon		-o inline:"a9
106183234Ssimon f\n9"  \
107183234Ssimon		-e empty \
108183234Ssimon		-s exit:0 \
109183234Ssimon		col -f < $(atf_get_srcdir)/hlf2.in
110238405Sjkim}
111183234Ssimon
112183234Ssimonatf_init_test_cases()
113183234Ssimon{
114183234Ssimon	atf_add_test_case nl
115183234Ssimon	atf_add_test_case rlf
116183234Ssimon	atf_add_test_case hlf
117183234Ssimon}
118183234Ssimon