diff --git a/Makefile.am b/Makefile.am index a69aa654..71a9c765 100644 --- a/Makefile.am +++ b/Makefile.am @@ -268,7 +268,9 @@ TESTS = tests/newline1/run-test \ tests/whitespace-regression/run-test \ tests/interdiff-whitespace-w/run-test \ tests/patch-ignore-whitespace/run-test \ - tests/whitespace-w/run-test + tests/whitespace-w/run-test \ + tests/filterdiff-inplace1/run-test \ + tests/rediff-inplace1/run-test # These ones don't work yet. # Feel free to send me patches. :-) diff --git a/tests/filterdiff-inplace1/run-test b/tests/filterdiff-inplace1/run-test new file mode 100755 index 00000000..a78ebb92 --- /dev/null +++ b/tests/filterdiff-inplace1/run-test @@ -0,0 +1,36 @@ +#!/bin/sh + +# This is a filterdiff(1) testcase. +# Test: --in-place option with --include filter + +. ${top_srcdir-.}/tests/common.sh + +cat << "EOF" > test.patch +--- a/file1.txt 2023-01-01 00:00:00.000000000 +0000 ++++ b/file1.txt 2023-01-01 00:00:01.000000000 +0000 +@@ -1,3 +1,3 @@ + line 1 +-line 2 ++line 2 modified + line 3 +--- a/file2.txt 2023-01-01 00:00:00.000000000 +0000 ++++ b/file2.txt 2023-01-01 00:00:01.000000000 +0000 +@@ -1,2 +1,2 @@ +-old content ++new content + another line +EOF + +# Test --in-place with --include +${FILTERDIFF} --include="*file1*" --in-place test.patch || exit 1 + +# Check that file was modified in place and contains only file1.txt +cmp - test.patch << "EOF" || exit 1 +--- a/file1.txt 2023-01-01 00:00:00.000000000 +0000 ++++ b/file1.txt 2023-01-01 00:00:01.000000000 +0000 +@@ -1,3 +1,3 @@ + line 1 +-line 2 ++line 2 modified + line 3 +EOF diff --git a/tests/rediff-inplace1/run-test b/tests/rediff-inplace1/run-test new file mode 100755 index 00000000..48fac97c --- /dev/null +++ b/tests/rediff-inplace1/run-test @@ -0,0 +1,34 @@ +#!/bin/sh + +# This is a rediff(1) testcase. +# Test: --in-place option + +. ${top_srcdir-.}/tests/common.sh + +cat << "EOF" > patch.orig +--- file ++++ file +@@ -3,3 +3,4 @@ + 1 + 2 + 3 ++4.5 +EOF + +cat << "EOF" > patch.mod +--- file ++++ file +@@ -3,3 +3,4 @@ ++4.5 +EOF + +# Test --in-place +${REDIFF} --in-place patch.orig patch.mod || exit 1 + +# Check that patch.mod was modified in place +cmp - patch.mod << "EOF" || exit 1 +--- file ++++ file +@@ -6,0 +6 @@ ++4.5 +EOF