diff options
Diffstat (limited to 'usr.bin/diff3/tests')
25 files changed, 423 insertions, 0 deletions
diff --git a/usr.bin/diff3/tests/1.out b/usr.bin/diff3/tests/1.out new file mode 100644 index 000000000000..9b872bf3a880 --- /dev/null +++ b/usr.bin/diff3/tests/1.out @@ -0,0 +1,14 @@ +==== +1:2,3c + which multiple lines + and a few typ0s to fix +2:2,3c + which multiple lines + and a few typos to fix +3:2c + and a few typ0s to fix +====2 +1:4a +3:3a +2:5c + New line diff --git a/usr.bin/diff3/tests/1.txt b/usr.bin/diff3/tests/1.txt new file mode 100644 index 000000000000..f0cd8062a6f1 --- /dev/null +++ b/usr.bin/diff3/tests/1.txt @@ -0,0 +1,6 @@ +This is a more complete test +which multiple lines +and a few typ0s to fix +also I plan to add few lines + and to remove +other lines diff --git a/usr.bin/diff3/tests/1cr.txt b/usr.bin/diff3/tests/1cr.txt new file mode 100644 index 000000000000..c24bf241e68a --- /dev/null +++ b/usr.bin/diff3/tests/1cr.txt @@ -0,0 +1,6 @@ +This is a more complete test
+which multiple lines
+and a few typ0s to fix
+also I plan to add few lines
+ and to remove
+other lines
diff --git a/usr.bin/diff3/tests/1t.out b/usr.bin/diff3/tests/1t.out new file mode 100644 index 000000000000..fc54ce50286f --- /dev/null +++ b/usr.bin/diff3/tests/1t.out @@ -0,0 +1,14 @@ +==== +1:2,3c + which multiple lines + and a few typ0s to fix +2:2,3c + which multiple lines + and a few typos to fix +3:2c + and a few typ0s to fix +====2 +1:4a +3:3a +2:5c + New line diff --git a/usr.bin/diff3/tests/2.out b/usr.bin/diff3/tests/2.out new file mode 100644 index 000000000000..420dc4784b80 --- /dev/null +++ b/usr.bin/diff3/tests/2.out @@ -0,0 +1,3 @@ +2,3c +and a few typ0s to fix +. diff --git a/usr.bin/diff3/tests/2.txt b/usr.bin/diff3/tests/2.txt new file mode 100644 index 000000000000..990aa6f345c6 --- /dev/null +++ b/usr.bin/diff3/tests/2.txt @@ -0,0 +1,7 @@ +This is a more complete test +which multiple lines +and a few typos to fix +also I plan to add few lines +New line + and to remove +other lines diff --git a/usr.bin/diff3/tests/3.out b/usr.bin/diff3/tests/3.out new file mode 100644 index 000000000000..81509d4ca510 --- /dev/null +++ b/usr.bin/diff3/tests/3.out @@ -0,0 +1,8 @@ +3a +======= +and a few typ0s to fix +>>>>>>> 3 +. +1a +<<<<<<< 1 +. diff --git a/usr.bin/diff3/tests/3.txt b/usr.bin/diff3/tests/3.txt new file mode 100644 index 000000000000..104466e49690 --- /dev/null +++ b/usr.bin/diff3/tests/3.txt @@ -0,0 +1,5 @@ +This is a more complete test +and a few typ0s to fix +also I plan to add few lines + and to remove +other lines diff --git a/usr.bin/diff3/tests/4.out b/usr.bin/diff3/tests/4.out new file mode 100644 index 000000000000..81509d4ca510 --- /dev/null +++ b/usr.bin/diff3/tests/4.out @@ -0,0 +1,8 @@ +3a +======= +and a few typ0s to fix +>>>>>>> 3 +. +1a +<<<<<<< 1 +. diff --git a/usr.bin/diff3/tests/5.out b/usr.bin/diff3/tests/5.out new file mode 100644 index 000000000000..420dc4784b80 --- /dev/null +++ b/usr.bin/diff3/tests/5.out @@ -0,0 +1,3 @@ +2,3c +and a few typ0s to fix +. diff --git a/usr.bin/diff3/tests/6.out b/usr.bin/diff3/tests/6.out new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/usr.bin/diff3/tests/6.out diff --git a/usr.bin/diff3/tests/7.out b/usr.bin/diff3/tests/7.out new file mode 100644 index 000000000000..9b872bf3a880 --- /dev/null +++ b/usr.bin/diff3/tests/7.out @@ -0,0 +1,14 @@ +==== +1:2,3c + which multiple lines + and a few typ0s to fix +2:2,3c + which multiple lines + and a few typos to fix +3:2c + and a few typ0s to fix +====2 +1:4a +3:3a +2:5c + New line diff --git a/usr.bin/diff3/tests/8.out b/usr.bin/diff3/tests/8.out new file mode 100644 index 000000000000..5d02326ed7d1 --- /dev/null +++ b/usr.bin/diff3/tests/8.out @@ -0,0 +1,19 @@ +4a +>>>>>>> 3 +. +4a +<<<<<<< 2 +New line +======= +. +3a +||||||| 2 +which multiple lines +and a few typos to fix +======= +and a few typ0s to fix +>>>>>>> 3 +. +1a +<<<<<<< 1 +. diff --git a/usr.bin/diff3/tests/9.out b/usr.bin/diff3/tests/9.out new file mode 100644 index 000000000000..2071bab4ce07 --- /dev/null +++ b/usr.bin/diff3/tests/9.out @@ -0,0 +1,17 @@ +This is a more complete test +<<<<<<< 1 +which multiple lines +and a few typ0s to fix +||||||| 2 +which multiple lines +and a few typos to fix +======= +and a few typ0s to fix +>>>>>>> 3 +also I plan to add few lines +<<<<<<< 2 +New line +======= +>>>>>>> 3 + and to remove +other lines diff --git a/usr.bin/diff3/tests/Makefile b/usr.bin/diff3/tests/Makefile new file mode 100644 index 000000000000..864f27beede8 --- /dev/null +++ b/usr.bin/diff3/tests/Makefile @@ -0,0 +1,28 @@ +PACKAGE= tests + +ATF_TESTS_SH= diff3_test +${PACKAGE}FILES+= \ + 1.txt \ + 1cr.txt \ + 2.txt \ + 3.txt \ + long-m.txt \ + long-o.txt \ + long-y.txt \ + 1.out \ + 1t.out \ + 2.out \ + 3.out \ + 4.out \ + 5.out \ + 6.out \ + 7.out \ + 8.out \ + 9.out \ + long-ed.out \ + long-A.out \ + long-merge.out \ + fbsdid1.txt \ + fbsdid2.txt + +.include <bsd.test.mk> diff --git a/usr.bin/diff3/tests/Makefile.depend b/usr.bin/diff3/tests/Makefile.depend new file mode 100644 index 000000000000..11aba52f82cf --- /dev/null +++ b/usr.bin/diff3/tests/Makefile.depend @@ -0,0 +1,10 @@ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/usr.bin/diff3/tests/diff3_test.sh b/usr.bin/diff3/tests/diff3_test.sh new file mode 100755 index 000000000000..3cbd7dac1ed9 --- /dev/null +++ b/usr.bin/diff3/tests/diff3_test.sh @@ -0,0 +1,108 @@ + +atf_test_case diff3 +atf_test_case diff3_lesssimple +atf_test_case diff3_ed +atf_test_case diff3_A +atf_test_case diff3_merge +atf_test_case diff3_E_merge + +diff3_body() +{ + atf_check -o file:$(atf_get_srcdir)/1.out \ + diff3 $(atf_get_srcdir)/1.txt $(atf_get_srcdir)/2.txt $(atf_get_srcdir)/3.txt + + atf_check -o file:$(atf_get_srcdir)/1.out \ + diff3 --strip-trailing-cr $(atf_get_srcdir)/1cr.txt $(atf_get_srcdir)/2.txt $(atf_get_srcdir)/3.txt + + atf_check -o file:$(atf_get_srcdir)/1t.out \ + diff3 -T $(atf_get_srcdir)/1.txt $(atf_get_srcdir)/2.txt $(atf_get_srcdir)/3.txt + + atf_check -o file:$(atf_get_srcdir)/2.out \ + diff3 -e $(atf_get_srcdir)/1.txt $(atf_get_srcdir)/2.txt $(atf_get_srcdir)/3.txt + + atf_check -o file:$(atf_get_srcdir)/3.out \ + diff3 -E -L 1 -L 2 -L 3 $(atf_get_srcdir)/1.txt $(atf_get_srcdir)/2.txt $(atf_get_srcdir)/3.txt + + atf_check -o file:$(atf_get_srcdir)/4.out \ + diff3 -X -L 1 -L 2 -L 3 $(atf_get_srcdir)/1.txt $(atf_get_srcdir)/2.txt $(atf_get_srcdir)/3.txt + + atf_check -o file:$(atf_get_srcdir)/5.out \ + diff3 -x $(atf_get_srcdir)/1.txt $(atf_get_srcdir)/2.txt $(atf_get_srcdir)/3.txt + + atf_check -o file:$(atf_get_srcdir)/6.out \ + diff3 -3 $(atf_get_srcdir)/1.txt $(atf_get_srcdir)/2.txt $(atf_get_srcdir)/3.txt + + atf_check -o file:$(atf_get_srcdir)/7.out \ + diff3 -i $(atf_get_srcdir)/1.txt $(atf_get_srcdir)/2.txt $(atf_get_srcdir)/3.txt +} + +diff3_lesssimple_body() +{ + atf_check -s exit:1 -o file:$(atf_get_srcdir)/10.out \ + diff3 -m -L 1 -L 2 -L 3 $(atf_get_srcdir)/4.txt $(atf_get_srcdir)/5.txt $(atf_get_srcdir)/6.txt +} + +diff3_ed_body() +{ + atf_check -s exit:0 -o file:$(atf_get_srcdir)/long-ed.out \ + diff3 -e $(atf_get_srcdir)/long-m.txt $(atf_get_srcdir)/long-o.txt $(atf_get_srcdir)/long-y.txt +} + +diff3_A_body() +{ + atf_check -s exit:1 -o file:$(atf_get_srcdir)/8.out \ + diff3 -A -L 1 -L 2 -L 3 $(atf_get_srcdir)/1.txt $(atf_get_srcdir)/2.txt $(atf_get_srcdir)/3.txt + + atf_check -s exit:1 -o file:$(atf_get_srcdir)/long-A.out \ + 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 +} + + +diff3_merge_body() +{ + atf_check -s exit:1 -o file:$(atf_get_srcdir)/9.out \ + diff3 -m -L 1 -L 2 -L 3 $(atf_get_srcdir)/1.txt $(atf_get_srcdir)/2.txt $(atf_get_srcdir)/3.txt + + atf_check -s exit:1 -o file:$(atf_get_srcdir)/long-merge.out \ + 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 +} + +diff3_E_merge_body() +{ + +expected="<<<<<<< 2 +# \$FreeBSD: head/local 12000 jhb \$ +======= +# \$FreeBSD: head/local 12345 jhb \$ +>>>>>>> 3 +# \$FreeBSD: head/local 12345 jhb \$ + +this is a file + +these are some local mods to the file +" + # first test the regular test + cp $(atf_get_srcdir)/fbsdid2.txt out.txt + atf_check -s exit:1 -o inline:"${expected}" \ + diff3 -m -L 1 -L 2 -L 3 out.txt $(atf_get_srcdir)/fbsdid1.txt $(atf_get_srcdir)/fbsdid2.txt + +merged="# \$FreeBSD: head/local 12345 jhb \$ + +this is a file + +these are some local mods to the file +" + atf_check -s exit:0 -o inline:"${merged}" \ + diff3 -E -m out.txt $(atf_get_srcdir)/fbsdid1.txt $(atf_get_srcdir)/fbsdid2.txt +} + + +atf_init_test_cases() +{ + atf_add_test_case diff3 +# atf_add_test_case diff3_lesssimple + atf_add_test_case diff3_ed + atf_add_test_case diff3_A + atf_add_test_case diff3_merge + atf_add_test_case diff3_E_merge +} diff --git a/usr.bin/diff3/tests/fbsdid1.txt b/usr.bin/diff3/tests/fbsdid1.txt new file mode 100644 index 000000000000..9f94660bda97 --- /dev/null +++ b/usr.bin/diff3/tests/fbsdid1.txt @@ -0,0 +1,5 @@ +# $FreeBSD: head/local 12000 jhb $ + +this is a file + +these are some local mods to the file diff --git a/usr.bin/diff3/tests/fbsdid2.txt b/usr.bin/diff3/tests/fbsdid2.txt new file mode 100644 index 000000000000..420ad975868b --- /dev/null +++ b/usr.bin/diff3/tests/fbsdid2.txt @@ -0,0 +1,5 @@ +# $FreeBSD: head/local 12345 jhb $ + +this is a file + +these are some local mods to the file diff --git a/usr.bin/diff3/tests/long-A.out b/usr.bin/diff3/tests/long-A.out new file mode 100644 index 000000000000..2a2e4cbb112d --- /dev/null +++ b/usr.bin/diff3/tests/long-A.out @@ -0,0 +1,22 @@ +24d +16a +||||||| long-o.txt +This line is different in yours and mine, but the different in each +======= +This line is different in yours and mine, but the best in yours +>>>>>>> long-y.txt +. +15a +<<<<<<< long-m.txt +. +11a +>>>>>>> long-y.txt +. +10a +<<<<<<< long-o.txt +This line is different in yours and mine, but the same +======= +. +8c +This line is different in yours, much butter +. diff --git a/usr.bin/diff3/tests/long-ed.out b/usr.bin/diff3/tests/long-ed.out new file mode 100644 index 000000000000..8814a3518d60 --- /dev/null +++ b/usr.bin/diff3/tests/long-ed.out @@ -0,0 +1,7 @@ +24d +16c +This line is different in yours and mine, but the best in yours +. +8c +This line is different in yours, much butter +. diff --git a/usr.bin/diff3/tests/long-m.txt b/usr.bin/diff3/tests/long-m.txt new file mode 100644 index 000000000000..327bf8c225f7 --- /dev/null +++ b/usr.bin/diff3/tests/long-m.txt @@ -0,0 +1,26 @@ +This is a long file +These lines are the same in all three files +These lines are the same in all three files +This line is different in mine, not better +These lines are the same in all three files +These lines are the same in all three files +These lines are the same in all three files +This line is different in yours +These lines are the same in all three files +These lines are the same in all three files +This line is different in yours and mine, the same is in both +These lines are the same in all three files +These lines are the same in all three files +These lines are the same in all three files +These lines are the same in all three files +This line is different in yours and mine, best change in mine +These lines are the same in all three files +These lines are the same in all three files +These lines are the same in all three files +These lines are the same in all three files +These lines are the same in all three files +These lines are the same in all three files +These lines are the same in all three files +This line is deleted in yours +These lines are the same in all three files +These lines are the same in all three files diff --git a/usr.bin/diff3/tests/long-merge.out b/usr.bin/diff3/tests/long-merge.out new file mode 100644 index 000000000000..5139a48fa429 --- /dev/null +++ b/usr.bin/diff3/tests/long-merge.out @@ -0,0 +1,35 @@ +This is a long file +These lines are the same in all three files +These lines are the same in all three files +This line is different in mine, not better +These lines are the same in all three files +These lines are the same in all three files +These lines are the same in all three files +This line is different in yours, much butter +These lines are the same in all three files +These lines are the same in all three files +<<<<<<< long-o.txt +This line is different in yours and mine, but the same +======= +This line is different in yours and mine, the same is in both +>>>>>>> long-y.txt +These lines are the same in all three files +These lines are the same in all three files +These lines are the same in all three files +These lines are the same in all three files +<<<<<<< long-m.txt +This line is different in yours and mine, best change in mine +||||||| long-o.txt +This line is different in yours and mine, but the different in each +======= +This line is different in yours and mine, but the best in yours +>>>>>>> long-y.txt +These lines are the same in all three files +These lines are the same in all three files +These lines are the same in all three files +These lines are the same in all three files +These lines are the same in all three files +These lines are the same in all three files +These lines are the same in all three files +These lines are the same in all three files +These lines are the same in all three files diff --git a/usr.bin/diff3/tests/long-o.txt b/usr.bin/diff3/tests/long-o.txt new file mode 100644 index 000000000000..b4085d1d98c0 --- /dev/null +++ b/usr.bin/diff3/tests/long-o.txt @@ -0,0 +1,27 @@ +This is a long file +These lines are the same in all three files +These lines are the same in all three files +This line is different in mine +These lines are the same in all three files +These lines are the same in all three files +These lines are the same in all three files +This line is different in yours +These lines are the same in all three files +These lines are the same in all three files +This line is different in yours and mine, but the same +These lines are the same in all three files +These lines are the same in all three files +These lines are the same in all three files +These lines are the same in all three files +This line is different in yours and mine, but the different in each +These lines are the same in all three files +These lines are the same in all three files +These lines are the same in all three files +These lines are the same in all three files +This line is deleted in mine +These lines are the same in all three files +These lines are the same in all three files +These lines are the same in all three files +This line is deleted in yours +These lines are the same in all three files +These lines are the same in all three files diff --git a/usr.bin/diff3/tests/long-y.txt b/usr.bin/diff3/tests/long-y.txt new file mode 100644 index 000000000000..1bb25004924e --- /dev/null +++ b/usr.bin/diff3/tests/long-y.txt @@ -0,0 +1,26 @@ +This is a long file +These lines are the same in all three files +These lines are the same in all three files +This line is different in mine +These lines are the same in all three files +These lines are the same in all three files +These lines are the same in all three files +This line is different in yours, much butter +These lines are the same in all three files +These lines are the same in all three files +This line is different in yours and mine, the same is in both +These lines are the same in all three files +These lines are the same in all three files +These lines are the same in all three files +These lines are the same in all three files +This line is different in yours and mine, but the best in yours +These lines are the same in all three files +These lines are the same in all three files +These lines are the same in all three files +These lines are the same in all three files +This line is deleted in mine +These lines are the same in all three files +These lines are the same in all three files +These lines are the same in all three files +These lines are the same in all three files +These lines are the same in all three files |