]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - usr.bin/col/tests/col_test.sh
THIS BRANCH IS OBSOLETE, PLEASE READ:
[FreeBSD/FreeBSD.git] / usr.bin / col / tests / col_test.sh
1 # $FreeBSD$
2
3 atf_test_case nl
4
5 nl_head()
6 {
7         atf_set "descr" "testing just newlines"
8 }
9 nl_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
42 atf_test_case rlf
43
44 rlf_head()
45 {
46         atf_set "descr" "testing reverse line feed"
47 }
48 rlf_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
75 atf_test_case hlf
76
77 hlf_head()
78 {
79         atf_set "descr" "testing half line feed"
80 }
81 hlf_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 f\e9\r f\e9\ra\n" \
91                 -e empty \
92                 -s exit:0 \
93                 col -f < $(atf_get_srcdir)/hlf.in
94
95         atf_check \
96                 -o inline:"a\n f\n" \
97                 -e empty \
98                 -s exit:0 \
99                 col < $(atf_get_srcdir)/hlf2.in
100
101         atf_check \
102                 -o inline:"a\e9\r f\n\e9"  \
103                 -e empty \
104                 -s exit:0 \
105                 col -f < $(atf_get_srcdir)/hlf2.in
106 }
107
108 atf_init_test_cases()
109 {
110         atf_add_test_case nl
111         atf_add_test_case rlf
112         atf_add_test_case hlf
113 }