-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathrun-test
More file actions
executable file
·66 lines (56 loc) · 1.1 KB
/
Copy pathrun-test
File metadata and controls
executable file
·66 lines (56 loc) · 1.1 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/sh
# This is a lsdiff(1) testcase for --lines option.
# Test: Select files containing hunks that touch specific line numbers
. ${top_srcdir-.}/tests/common.sh
cat << EOF > diff
--- file1
+++ file1
@@ -1 +1,2 @@
-A
+a
+b
@@ -10 +11,2 @@
-C
+c
+d
--- file2
+++ file2
@@ -5 +5,2 @@
-E
+e
+f
@@ -20 +21,2 @@
-G
+g
+h
--- file3
+++ file3
@@ -15 +15,2 @@
-I
+i
+j
EOF
# Test --lines 1 (files with hunks touching line 1)
${LSDIFF} --lines 1 diff 2>errors >lines1 || exit 1
[ -s errors ] && exit 1
cat << EOF | cmp - lines1 || exit 1
file1
EOF
# Test --lines 5 (files with hunks touching line 5)
${LSDIFF} --lines 5 diff 2>errors >lines5 || exit 1
[ -s errors ] && exit 1
cat << EOF | cmp - lines5 || exit 1
file2
EOF
# Test --lines 10-15 (range: files with hunks touching lines 10-15)
${LSDIFF} --lines 10-15 diff 2>errors >lines10-15 || exit 1
[ -s errors ] && exit 1
cat << EOF | cmp - lines10-15 || exit 1
file1
file3
EOF
# Test --lines 100 (line that doesn't exist - should be empty)
${LSDIFF} --lines 100 diff 2>errors >lines100 || exit 1
[ -s errors ] && exit 1
[ -s lines100 ] && exit 1 # Should be empty
exit 0