3 # Small test file to check different --word-diff-regex settings in Git.
5 # Copyright (C) 2012-2014 Simon Ruderich
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
24 git diff --color=never --word-diff=plain --word-diff-regex="$1" \
25 | grep -v '^index ' >"result-$2.txt"
26 diff -u "../expected-$2.txt" "result-$2.txt"
30 # Setup test directory/files.
39 Simple sentence with a few words.
41 Longer sentence with even more words .. ain't that nice?
43 And another one, just testing.
47 option-three: value-three
64 git commit -m 'Initial commit.' >/dev/null
70 Short sentence with words!
72 Longer sentence even more words, ain't that nice!
74 And other one, just testing.
77 option-two: new-value-two
78 option-three: "value-three"
84 third_call() && fourth_call() \\
91 allow = \$0 \$! \$? \$.
99 git_diff '[^[:space:]]+' nonspaces
101 git_diff '[a-zA-Z0-9_]|[^a-zA-Z0-9_]' word-nonword
102 git_diff '[a-zA-Z0-9_]+|[^a-zA-Z0-9_]' words-nonword
103 git_diff '[a-zA-Z0-9_]+|[^a-zA-Z0-9_]+' words-nonwords
104 git_diff '[a-zA-Z0-9_]+|[^a-zA-Z0-9_ ]+' words-nonwordspaces
106 git_diff '[a-zA-Z0-9_]+|[^a-zA-Z0-9_]+|[ ]+' words-nonwords-spaces
107 git_diff '[a-zA-Z0-9_]+|[^a-zA-Z0-9_ ]+|[ ]+' words-nonwordspaces-spaces
110 # Remove test directory after successful testing.