@matheusbsbs / matheus-bagliano / commits / cd3c095caa
Fork 0

tests: move convenience regexp to match object names to test-lib.sh

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Sep 20, 2009 at 11:10 UTC cd3c095caa6f61b4a2952e7ea167938c5b69bc3d
9 files changed +6 -18
t/diff-lib.sh
-2
@@ -1,7 +1,5 @@
1 :
2
3 -_x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
4 -_x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
3 sanitize_diff_raw='/^:/s/ '"$_x40"' '"$_x40"' \([A-Z]\)[0-9]* / X X \1# /'
4 compare_diff_raw () {
5 # When heuristics are improved, the score numbers would change.
t/t1000-read-tree-m-3way.sh
-3
@@ -126,9 +126,6 @@ cat >expected <<\EOF
126 100644 X 0 Z/NN
127 EOF
128
129 -_x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
130 -_x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
131 -
129 check_result () {
130 git ls-files --stage | sed -e 's/ '"$_x40"' / X /' >current &&
131 test_cmp expected current
t/t1001-read-tree-m-2way.sh
-2
@@ -26,8 +26,6 @@ read_tree_twoway () {
26 git read-tree -m "$1" "$2" && git ls-files --stage
27 }
28
29 -_x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
30 -_x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
29 compare_change () {
30 sed -n >current \
31 -e '/^--- /d; /^+++ /d; /^@@ /d;' \
t/t1002-read-tree-m-u-2way.sh
-2
@@ -10,8 +10,6 @@ This is identical to t1001, but uses -u to update the work tree as well.
10 '
11 . ./test-lib.sh
12
13 -_x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
14 -_x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
13 compare_change () {
14 sed >current \
15 -e '1{/^diff --git /d;}' \
t/t3100-ls-tree-restrict.sh
-2
@@ -43,8 +43,6 @@ test_expect_success \
43 tree=`git write-tree` &&
44 echo $tree'
45
46 -_x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
47 -_x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
46 test_output () {
47 sed -e "s/ $_x40 / X /" <current >check
48 test_cmp expected check
t/t3101-ls-tree-dirname.sh
-2
@@ -39,8 +39,6 @@ test_expect_success \
39 tree=`git write-tree` &&
40 echo $tree'
41
42 -_x05='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
43 -_x40="$_x05$_x05$_x05$_x05$_x05$_x05$_x05$_x05"
42 test_output () {
43 sed -e "s/ $_x40 / X /" <current >check
44 test_cmp expected check
t/t4006-diff-mode.sh
-2
@@ -20,8 +20,6 @@ test_expect_success \
20 'test_chmod +x rezrov &&
21 git diff-index $tree >current'
22
23 -_x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
24 -_x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
23 sed -e 's/\(:100644 100755\) \('"$_x40"'\) \2 /\1 X X /' <current >check
24 echo ":100644 100755 X X M rezrov" >expected
25
t/t6012-rev-list-simplify.sh
-3
@@ -8,9 +8,6 @@ note () {
8 git tag "$1"
9 }
10
11 -_x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
12 -_x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
13 -
11 unnote () {
12 git name-rev --tags --stdin | sed -e "s|$_x40 (tags/\([^)]*\)) |\1 |g"
13 }
t/test-lib.sh
+6
@@ -74,6 +74,12 @@ case $(echo $GIT_TRACE |tr "[A-Z]" "[a-z]") in
74 ;;
75 esac
76
77 +# Convenience
78 +#
79 +# A regexp to match 5 and 40 hexdigits
80 +_x05='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
81 +_x40="$_x05$_x05$_x05$_x05$_x05$_x05$_x05$_x05"
82 +
83 # Each test should start with something like this, after copyright notices:
84 #
85 # test_description='Description of this test...