xref: /freebsd/usr.bin/col/tests/col_test.sh (revision d0b2dbfa)
1458cbf0aSEnji Cooper
26b43126fSMark Johnstonatf_test_case nl
36b43126fSMark Johnston
46b43126fSMark Johnstonnl_head()
56b43126fSMark Johnston{
66b43126fSMark Johnston	atf_set "descr" "testing just newlines"
76b43126fSMark Johnston}
86b43126fSMark Johnstonnl_body()
96b43126fSMark Johnston{
106b43126fSMark Johnston	atf_check \
116b43126fSMark Johnston		-o inline:"a\nb\n" \
126b43126fSMark Johnston		-e empty \
136b43126fSMark Johnston		-s exit:0 \
146b43126fSMark Johnston		col < $(atf_get_srcdir)/nl.in
156b43126fSMark Johnston
166b43126fSMark Johnston	atf_check \
176b43126fSMark Johnston		-o inline:"a\nb\n" \
186b43126fSMark Johnston		-e empty \
196b43126fSMark Johnston		-s exit:0 \
206b43126fSMark Johnston		col -f < $(atf_get_srcdir)/nl.in
216b43126fSMark Johnston
226b43126fSMark Johnston	atf_check \
236b43126fSMark Johnston		-o inline:"a\nb\n" \
246b43126fSMark Johnston		-e empty \
256b43126fSMark Johnston		-s exit:0 \
266b43126fSMark Johnston		col < $(atf_get_srcdir)/nl2.in
276b43126fSMark Johnston
286b43126fSMark Johnston	atf_check \
296b43126fSMark Johnston		-o inline:"a\nb\n" \
306b43126fSMark Johnston		-e empty \
316b43126fSMark Johnston		-s exit:0 \
326b43126fSMark Johnston		col -f < $(atf_get_srcdir)/nl2.in
336b43126fSMark Johnston
346b43126fSMark Johnston	atf_check \
356b43126fSMark Johnston		-o inline:"a\n\nb\n\n" \
366b43126fSMark Johnston		-e empty \
376b43126fSMark Johnston		-s exit:0 \
386b43126fSMark Johnston		col < $(atf_get_srcdir)/nl3.in
396b43126fSMark Johnston}
406b43126fSMark Johnston
41458cbf0aSEnji Cooperatf_test_case rlf
42458cbf0aSEnji Cooper
43458cbf0aSEnji Cooperrlf_head()
44458cbf0aSEnji Cooper{
45458cbf0aSEnji Cooper	atf_set "descr" "testing reverse line feed"
46458cbf0aSEnji Cooper}
47458cbf0aSEnji Cooperrlf_body()
48458cbf0aSEnji Cooper{
49458cbf0aSEnji Cooper	atf_check \
50458cbf0aSEnji Cooper		-o inline:"a b\n" \
51458cbf0aSEnji Cooper		-e empty \
52458cbf0aSEnji Cooper		-s exit:0 \
53458cbf0aSEnji Cooper		col < $(atf_get_srcdir)/rlf.in
54458cbf0aSEnji Cooper
55458cbf0aSEnji Cooper	atf_check \
56458cbf0aSEnji Cooper		-o inline:"a	b\n" \
57458cbf0aSEnji Cooper		-e empty \
58458cbf0aSEnji Cooper		-s exit:0 \
59458cbf0aSEnji Cooper		col < $(atf_get_srcdir)/rlf2.in
60458cbf0aSEnji Cooper
61458cbf0aSEnji Cooper	atf_check \
62458cbf0aSEnji Cooper		-o inline:"a       b\n" \
63458cbf0aSEnji Cooper		-e empty \
64458cbf0aSEnji Cooper		-s exit:0 \
65458cbf0aSEnji Cooper		col -x < $(atf_get_srcdir)/rlf2.in
666b43126fSMark Johnston
676b43126fSMark Johnston	atf_check \
686b43126fSMark Johnston		-o inline:" b\na\n" \
696b43126fSMark Johnston		-e empty \
706b43126fSMark Johnston		-s exit:0 \
716b43126fSMark Johnston		col < $(atf_get_srcdir)/rlf3.in
726b43126fSMark Johnston}
736b43126fSMark Johnston
746b43126fSMark Johnstonatf_test_case hlf
756b43126fSMark Johnston
766b43126fSMark Johnstonhlf_head()
776b43126fSMark Johnston{
786b43126fSMark Johnston	atf_set "descr" "testing half line feed"
796b43126fSMark Johnston}
806b43126fSMark Johnstonhlf_body()
816b43126fSMark Johnston{
826b43126fSMark Johnston	atf_check \
836b43126fSMark Johnston		-o inline:"a f\naf\n" \
846b43126fSMark Johnston		-e empty \
856b43126fSMark Johnston		-s exit:0 \
866b43126fSMark Johnston		col < $(atf_get_srcdir)/hlf.in
876b43126fSMark Johnston
886b43126fSMark Johnston	atf_check \
896b43126fSMark Johnston		-o inline:"a f9
906b43126fSMark Johnston f9
916b43126fSMark Johnstona\n" \
926b43126fSMark Johnston		-e empty \
936b43126fSMark Johnston		-s exit:0 \
946b43126fSMark Johnston		col -f < $(atf_get_srcdir)/hlf.in
956b43126fSMark Johnston
966b43126fSMark Johnston	atf_check \
976b43126fSMark Johnston		-o inline:"a\n f\n" \
986b43126fSMark Johnston		-e empty \
996b43126fSMark Johnston		-s exit:0 \
1006b43126fSMark Johnston		col < $(atf_get_srcdir)/hlf2.in
1016b43126fSMark Johnston
1026b43126fSMark Johnston	atf_check \
1036b43126fSMark Johnston		-o inline:"a9
1046b43126fSMark Johnston f\n9"  \
105458cbf0aSEnji Cooper		-e empty \
106458cbf0aSEnji Cooper		-s exit:0 \
107458cbf0aSEnji Cooper		col -f < $(atf_get_srcdir)/hlf2.in
108458cbf0aSEnji Cooper}
1096b43126fSMark Johnston
110458cbf0aSEnji Cooperatf_init_test_cases()
1116b43126fSMark Johnston{
112458cbf0aSEnji Cooper	atf_add_test_case nl
113	atf_add_test_case rlf
114	atf_add_test_case hlf
115}
116