aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/diff3/tests
diff options
context:
space:
mode:
authorTom Jones <thj@FreeBSD.org>2022-04-19 15:20:24 +0000
committerTom Jones <thj@FreeBSD.org>2022-04-19 15:20:24 +0000
commit034dd2d54f2e7e33897cfd5ede7c50b3d67d18d3 (patch)
tree31cd37cadc9fc1776bcc9ea4dab98ee6c10b6509 /usr.bin/diff3/tests
parentf45f90c5d6f0f0d53998476281d42d857adf98c7 (diff)
Diffstat (limited to 'usr.bin/diff3/tests')
-rw-r--r--usr.bin/diff3/tests/Makefile3
-rwxr-xr-xusr.bin/diff3/tests/diff3_test.sh13
-rw-r--r--usr.bin/diff3/tests/long-merge.out35
3 files changed, 50 insertions, 1 deletions
diff --git a/usr.bin/diff3/tests/Makefile b/usr.bin/diff3/tests/Makefile
index fc69dea260e8..0785e78aaee3 100644
--- a/usr.bin/diff3/tests/Makefile
+++ b/usr.bin/diff3/tests/Makefile
@@ -22,6 +22,7 @@ ${PACKAGE}FILES+= \
8.out \
9.out \
long-ed.out \
- long-A.out
+ long-A.out \
+ long-merge.out \
.include <bsd.test.mk>
diff --git a/usr.bin/diff3/tests/diff3_test.sh b/usr.bin/diff3/tests/diff3_test.sh
index 8df84b0d8ff2..c30f258128af 100755
--- a/usr.bin/diff3/tests/diff3_test.sh
+++ b/usr.bin/diff3/tests/diff3_test.sh
@@ -4,6 +4,7 @@ atf_test_case diff3
atf_test_case diff3_lesssimple
atf_test_case diff3_ed
atf_test_case diff3_A
+atf_test_case diff3_merge
diff3_body()
{
@@ -56,10 +57,22 @@ diff3_A_body()
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)/tao-merge.out \
+ diff3 -m -L lao.txt -L tzu.txt -L tao.txt $(atf_get_srcdir)/lao.txt $(atf_get_srcdir)/tzu.txt $(atf_get_srcdir)/tao.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
+}
+
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
}
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