Debian Codegraph @

tests/git-rename-issue22/run-test

raw
1 #!/bin/sh
2
3 # Test for GitHub Issue #22: File moves are ignored by filterdiff
4 # This test case reproduces the exact scenario from the issue
5
6 . ${top_srcdir-.}/tests/common.sh
7
8 cat << EOF > git-rename.patch
9 diff --git a/tests/wpt/web-platform-tests/2dcontext/transformations/2d.transformation.order.html b/tests/wpt/web-platform-tests/2dcontext/transformations/2d.transformation.order-new.html
10 similarity index 100%
11 rename from tests/wpt/web-platform-tests/2dcontext/transformations/2d.transformation.order.html
12 rename to tests/wpt/web-platform-tests/2dcontext/transformations/2d.transformation.order-new.html
13 EOF
14
15 # Test that filterdiff includes the rename when it matches the filter
16 ${FILTERDIFF} --git-extended-diffs=include --git-prefixes=strip -i "*wpt*" git-rename.patch 2>errors >result || exit 1
17 [ -s errors ] && exit 1
18
19 # The result should contain the complete git diff block
20 cat << EOF | cmp - result || exit 1
21 diff --git a/tests/wpt/web-platform-tests/2dcontext/transformations/2d.transformation.order.html b/tests/wpt/web-platform-tests/2dcontext/transformations/2d.transformation.order-new.html
22 similarity index 100%
23 rename from tests/wpt/web-platform-tests/2dcontext/transformations/2d.transformation.order.html
24 rename to tests/wpt/web-platform-tests/2dcontext/transformations/2d.transformation.order-new.html
25 EOF
26
27 # Test that filterdiff excludes the rename when it doesn't match the filter
28 ${FILTERDIFF} --git-extended-diffs=include --git-prefixes=strip -i something-else git-rename.patch 2>errors2 >result2 || exit 1
29 [ -s errors2 ] && exit 1
30
31 # The result should be empty
32 [ -s result2 ] && exit 1
33
34 # Test lsdiff works with renames
35 ${LSDIFF} --git-extended-diffs=include --git-extended-diffs=include --git-prefixes=strip git-rename.patch 2>errors3 >result3 || exit 1
36 [ -s errors3 ] && exit 1
37
38 cat << EOF | cmp - result3 || exit 1
39 tests/wpt/web-platform-tests/2dcontext/transformations/2d.transformation.order.html
40 EOF
41
42 exit 0