File: run-test

package info (click to toggle)
patchutils 0.4.3-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 3,976 kB
  • sloc: ansic: 20,804; sh: 11,956; xml: 2,831; perl: 419; makefile: 300; python: 23
file content (36 lines) | stat: -rwxr-xr-x 852 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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