From e1910ebda4d5972aef64aaf67ea7bcbbba16fa4f Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Thu, 25 May 2017 17:45:50 +0000 Subject: Import working progress BSD diff3 import bsd diff3 from OpenBSD. Differences with OpenBSD: - lots of warning fixed - no shell wrapper with diff3 actually living in libexec - capsicumized Keep it disconnected as it is not yet good enough to replace GNU diff The motivation to import it now it to allow other people to jump in and also to have an open development on it Obtained from: OpenBSD --- usr.bin/diff3/tests/1.out | 14 ++++++++++++ usr.bin/diff3/tests/1.txt | 6 +++++ usr.bin/diff3/tests/2.out | 3 +++ usr.bin/diff3/tests/2.txt | 7 ++++++ usr.bin/diff3/tests/3.out | 8 +++++++ usr.bin/diff3/tests/3.txt | 5 +++++ usr.bin/diff3/tests/4.out | 8 +++++++ usr.bin/diff3/tests/5.out | 3 +++ usr.bin/diff3/tests/6.out | 0 usr.bin/diff3/tests/7.out | 14 ++++++++++++ usr.bin/diff3/tests/8.out | 19 ++++++++++++++++ usr.bin/diff3/tests/9.out | 17 +++++++++++++++ usr.bin/diff3/tests/Makefile | 21 ++++++++++++++++++ usr.bin/diff3/tests/diff3_test.sh | 46 +++++++++++++++++++++++++++++++++++++++ 14 files changed, 171 insertions(+) create mode 100644 usr.bin/diff3/tests/1.out create mode 100644 usr.bin/diff3/tests/1.txt create mode 100644 usr.bin/diff3/tests/2.out create mode 100644 usr.bin/diff3/tests/2.txt create mode 100644 usr.bin/diff3/tests/3.out create mode 100644 usr.bin/diff3/tests/3.txt create mode 100644 usr.bin/diff3/tests/4.out create mode 100644 usr.bin/diff3/tests/5.out create mode 100644 usr.bin/diff3/tests/6.out create mode 100644 usr.bin/diff3/tests/7.out create mode 100644 usr.bin/diff3/tests/8.out create mode 100644 usr.bin/diff3/tests/9.out create mode 100644 usr.bin/diff3/tests/Makefile create mode 100755 usr.bin/diff3/tests/diff3_test.sh (limited to 'usr.bin/diff3/tests') diff --git a/usr.bin/diff3/tests/1.out b/usr.bin/diff3/tests/1.out new file mode 100644 index 0000000000000..9b872bf3a8800 --- /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 0000000000000..f0cd8062a6f1e --- /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/2.out b/usr.bin/diff3/tests/2.out new file mode 100644 index 0000000000000..420dc4784b804 --- /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 0000000000000..990aa6f345c6f --- /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 0000000000000..81509d4ca5101 --- /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 0000000000000..104466e496908 --- /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 0000000000000..81509d4ca5101 --- /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 0000000000000..420dc4784b804 --- /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 0000000000000..e69de29bb2d1d diff --git a/usr.bin/diff3/tests/7.out b/usr.bin/diff3/tests/7.out new file mode 100644 index 0000000000000..9b872bf3a8800 --- /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 0000000000000..5d02326ed7d18 --- /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 0000000000000..2071bab4ce078 --- /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 0000000000000..dd75be1ca02aa --- /dev/null +++ b/usr.bin/diff3/tests/Makefile @@ -0,0 +1,21 @@ +# $FreeBSD$ + +PACKAGE= tests + +ATF_TESTS_SH= diff3_test + +${PACKAGE}FILES+= \ + 1.txt \ + 2.txt \ + 3.txt \ + 1.out \ + 2.out \ + 3.out \ + 4.out \ + 5.out \ + 6.out \ + 7.out \ + 8.out \ + 9.out + +.include diff --git a/usr.bin/diff3/tests/diff3_test.sh b/usr.bin/diff3/tests/diff3_test.sh new file mode 100755 index 0000000000000..9911e7c164323 --- /dev/null +++ b/usr.bin/diff3/tests/diff3_test.sh @@ -0,0 +1,46 @@ +# $FreeBSD$ + +atf_test_case diff3 +atf_test_case diff3_lesssimple + +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)/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 + + atf_check -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)/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 +} + +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 +} + +atf_init_test_cases() +{ + atf_add_test_case diff3 + atf_add_test_case diff3_lesssimple +} -- cgit v1.3