summaryrefslogtreecommitdiff
path: root/tests/usr.bin/col/t_col.sh
blob: d0c73e35738054536528d107fd75df1fa6f54616 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/usr/bin/atf-sh
# $FreeBSD: head/usr.bin/col/tests/col_test.sh 366577 2020-10-09 15:27:37Z markj $

atf_test_case nl

nl_head()
{
	atf_set "descr" "testing just newlines"
}
nl_body()
{
	atf_check \
		-o inline:"a\nb\n" \
		-e empty \
		-s exit:0 \
		col < $(atf_get_srcdir)/nl.in

	atf_check \
		-o inline:"a\nb\n" \
		-e empty \
		-s exit:0 \
		col -f < $(atf_get_srcdir)/nl.in

	atf_check \
		-o inline:"a\nb\n" \
		-e empty \
		-s exit:0 \
		col < $(atf_get_srcdir)/nl2.in

	atf_check \
		-o inline:"a\nb\n" \
		-e empty \
		-s exit:0 \
		col -f < $(atf_get_srcdir)/nl2.in

	atf_check \
		-o inline:"a\n\nb\n\n" \
		-e empty \
		-s exit:0 \
		col < $(atf_get_srcdir)/nl3.in
}

atf_test_case rlf

rlf_head()
{
	atf_set "descr" "testing reverse line feed"
}
rlf_body()
{
	atf_check \
		-o inline:"a b\n" \
		-e empty \
		-s exit:0 \
		col < $(atf_get_srcdir)/rlf.in

	atf_check \
		-o inline:"a	b\n" \
		-e empty \
		-s exit:0 \
		col < $(atf_get_srcdir)/rlf2.in

	atf_check \
		-o inline:"a       b\n" \
		-e empty \
		-s exit:0 \
		col -x < $(atf_get_srcdir)/rlf2.in

	atf_check \
		-o inline:" b\na\n" \
		-e empty \
		-s exit:0 \
		col < $(atf_get_srcdir)/rlf3.in
}

atf_test_case hlf

hlf_head()
{
	atf_set "descr" "testing half line feed"
}
hlf_body()
{
	atf_check \
		-o inline:"a f\naf\n" \
		-e empty \
		-s exit:0 \
		col < $(atf_get_srcdir)/hlf.in

	atf_check \
		-o inline:"a f9
 f9
a\n" \
		-e empty \
		-s exit:0 \
		col -f < $(atf_get_srcdir)/hlf.in

	atf_check \
		-o inline:"a\n f\n" \
		-e empty \
		-s exit:0 \
		col < $(atf_get_srcdir)/hlf2.in

	atf_check \
		-o inline:"a9
 f\n9"  \
		-e empty \
		-s exit:0 \
		col -f < $(atf_get_srcdir)/hlf2.in
}

atf_init_test_cases()
{
	atf_add_test_case nl
	atf_add_test_case rlf
	atf_add_test_case hlf
}