xref: /freebsd/usr.bin/diff3/tests/diff3_test.sh (revision 22cf89c938886d14f5796fc49f9f020c23ea8eaf)
1
2atf_test_case diff3
3atf_test_case diff3_lesssimple
4atf_test_case diff3_ed
5atf_test_case diff3_A
6atf_test_case diff3_merge
7
8diff3_body()
9{
10	atf_check -o file:$(atf_get_srcdir)/1.out \
11		diff3 $(atf_get_srcdir)/1.txt $(atf_get_srcdir)/2.txt $(atf_get_srcdir)/3.txt
12
13	atf_check -o file:$(atf_get_srcdir)/1.out \
14		diff3 --strip-trailing-cr $(atf_get_srcdir)/1cr.txt $(atf_get_srcdir)/2.txt $(atf_get_srcdir)/3.txt
15
16	atf_check -o file:$(atf_get_srcdir)/1t.out \
17		diff3 -T $(atf_get_srcdir)/1.txt $(atf_get_srcdir)/2.txt $(atf_get_srcdir)/3.txt
18
19	atf_check -o file:$(atf_get_srcdir)/2.out \
20		diff3 -e $(atf_get_srcdir)/1.txt $(atf_get_srcdir)/2.txt $(atf_get_srcdir)/3.txt
21
22	atf_check -o file:$(atf_get_srcdir)/3.out \
23		diff3 -E -L 1 -L 2 -L 3 $(atf_get_srcdir)/1.txt $(atf_get_srcdir)/2.txt $(atf_get_srcdir)/3.txt
24
25	atf_check -o file:$(atf_get_srcdir)/4.out \
26		diff3 -X -L 1 -L 2 -L 3 $(atf_get_srcdir)/1.txt $(atf_get_srcdir)/2.txt $(atf_get_srcdir)/3.txt
27
28	atf_check -o file:$(atf_get_srcdir)/5.out \
29		diff3 -x $(atf_get_srcdir)/1.txt $(atf_get_srcdir)/2.txt $(atf_get_srcdir)/3.txt
30
31	atf_check -o file:$(atf_get_srcdir)/6.out \
32		diff3 -3 $(atf_get_srcdir)/1.txt $(atf_get_srcdir)/2.txt $(atf_get_srcdir)/3.txt
33
34	atf_check -o file:$(atf_get_srcdir)/7.out \
35		diff3 -i $(atf_get_srcdir)/1.txt $(atf_get_srcdir)/2.txt $(atf_get_srcdir)/3.txt
36}
37
38diff3_lesssimple_body()
39{
40	atf_check -s exit:1 -o file:$(atf_get_srcdir)/10.out \
41		diff3 -m -L 1 -L 2 -L 3 $(atf_get_srcdir)/4.txt $(atf_get_srcdir)/5.txt $(atf_get_srcdir)/6.txt
42}
43
44diff3_ed_body()
45{
46	atf_check -s exit:0 -o file:$(atf_get_srcdir)/long-ed.out \
47		diff3 -e $(atf_get_srcdir)/long-m.txt $(atf_get_srcdir)/long-o.txt $(atf_get_srcdir)/long-y.txt
48}
49
50diff3_A_body()
51{
52	atf_check -s exit:1 -o file:$(atf_get_srcdir)/8.out \
53		diff3 -A -L 1 -L 2 -L 3 $(atf_get_srcdir)/1.txt $(atf_get_srcdir)/2.txt $(atf_get_srcdir)/3.txt
54
55	atf_check -s exit:1 -o file:$(atf_get_srcdir)/long-A.out \
56		diff3 -A -L long-m.txt -L long-o.txt -L long-y.txt $(atf_get_srcdir)/long-m.txt $(atf_get_srcdir)/long-o.txt $(atf_get_srcdir)/long-y.txt
57}
58
59
60diff3_merge_body()
61{
62	atf_check -s exit:1 -o file:$(atf_get_srcdir)/9.out \
63		diff3 -m -L 1 -L 2 -L 3 $(atf_get_srcdir)/1.txt $(atf_get_srcdir)/2.txt $(atf_get_srcdir)/3.txt
64
65	atf_check -s exit:1 -o file:$(atf_get_srcdir)/long-merge.out \
66		diff3 -m -L long-m.txt -L long-o.txt -L long-y.txt $(atf_get_srcdir)/long-m.txt $(atf_get_srcdir)/long-o.txt $(atf_get_srcdir)/long-y.txt
67}
68
69atf_init_test_cases()
70{
71	atf_add_test_case diff3
72#	atf_add_test_case diff3_lesssimple
73	atf_add_test_case diff3_ed
74	atf_add_test_case diff3_A
75	atf_add_test_case diff3_merge
76}
77