Skip to contentSkip to conversation

t7811 (grep-open): remove test_config() redefinition

PATCH In review Ramkumar Ramachandra 3 participants 6 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 t7811 (grep-open): remove test_config() redefinition

test_config() is already a well-defined function in test-lib-functions.sh. Don't duplicate it unnecessarily.

---
Found this while randomly grep'ping around.

 t/t7811-grep-open.sh | 5 -----
 1 file changed, 5 deletions(-)
t/t7811-grep-open.sh +0 -5
index a895778..e1951a5 100755
@@ -125,11 +125,6 @@ test_expect_success 'modified file' '
 	test_cmp empty out
 '
 
-test_config() {
-	git config "$1" "$2" &&
-	test_when_finished "git config --unset $1"
-}
-
 test_expect_success 'copes with color settings' '
 	rm -f actual &&
 	echo grep.h >expect &&
Signature · 1 line
1.8.2
#1 lore raw
Quoted 2 lines · Ramkumar Ramachandra

test_config() is already a well-defined function in test-lib-functions.sh. Don't duplicate it unnecessarily.

There are other instances of it in t7810 and t4018, with slightly different styles.

t/t4018-diff-funcname.sh:test_config () {
t/t7810-grep.sh:test_config() {
t/t7811-grep-open.sh:test_config() {
t/test-lib-functions.sh:test_config () {

Incidentally, this is why a consistent coding style helps. It should be possible to catch all ofhtme with a single

git grep 'test_config () {' t/

but the ones in t78xx wouldn't have been found.

Quoted 23 lines

---
Found this while randomly grep'ping around.

 t/t7811-grep-open.sh | 5 -----
 1 file changed, 5 deletions(-)
t/t7811-grep-open.sh +0 -5
index a895778..e1951a5 100755
@@ -125,11 +125,6 @@ test_expect_success 'modified file' '
 	test_cmp empty out
 '
 
-test_config() {
-	git config "$1" "$2" &&
-	test_when_finished "git config --unset $1"
-}
-
 test_expect_success 'copes with color settings' '
 	rm -f actual &&
 	echo grep.h >expect &&
#2 lore raw

PATCH 1/1 t: don't redefine test_config() in various places

test_config() is already a well-defined function in test-lib-functions.sh. Don't duplicate it unnecessarily in:

t4018-diff-funcname.sh
t7810-grep.sh
t7811-grep-open.sh

---
Thanks, Junio.

 t/t4018-diff-funcname.sh | 5 -----
 t/t7810-grep.sh          | 5 -----
 t/t7811-grep-open.sh     | 5 -----
 3 files changed, 15 deletions(-)
t/t4018-diff-funcname.sh +0 -5
index 082d3e8..38a092a 100755
@@ -93,11 +93,6 @@ sed -e '
 	s/song;/song();/
 ' <Beer.perl >Beer-correct.perl
 
-test_config () {
-	git config "$1" "$2" &&
-	test_when_finished "git config --unset $1"
-}
-
 test_expect_funcname () {
 	lang=${2-java}
 	test_expect_code 1 git diff --no-index -U1 \
t/t7810-grep.sh +0 -5
index f698001..500eb50 100755
@@ -1084,11 +1084,6 @@ test_expect_success 'grep -E pattern with grep.patternType=fixed' '
 	test_cmp expected actual
 '
 
-test_config() {
-	git config "$1" "$2" &&
-	test_when_finished "git config --unset $1"
-}
-
 cat >expected <<EOF
 hello.c<RED>:<RESET>int main(int argc, const char **argv)
 hello.c<RED>-<RESET>{
t/t7811-grep-open.sh +0 -5
index a895778..e1951a5 100755
@@ -125,11 +125,6 @@ test_expect_success 'modified file' '
 	test_cmp empty out
 '
 
-test_config() {
-	git config "$1" "$2" &&
-	test_when_finished "git config --unset $1"
-}
-
 test_expect_success 'copes with color settings' '
 	rm -f actual &&
 	echo grep.h >expect &&
Signature · 1 line
1.8.2
#4 lore raw

Re: [PATCH] t: don't redefine test_config() in various places

In reply to Ramkumar Ramachandra
Quoted 10 lines · Ramkumar Ramachandra

test_config() is already a well-defined function in test-lib-functions.sh. Don't duplicate it unnecessarily in:

t4018-diff-funcname.sh
t7810-grep.sh
t7811-grep-open.sh

---
Thanks, Junio.

Heh, I've pushed out the original one after fixing them up myself last night.

#5 lore raw

Re: [PATCH] t: don't redefine test_config() in various places

Quoted 9 lines · Junio C Hamano
Quoted 7 lines · Ramkumar Ramachandra

test_config() is already a well-defined function in test-lib-functions.sh. Don't duplicate it unnecessarily in:

t4018-diff-funcname.sh
t7810-grep.sh
t7811-grep-open.sh

Quoted 6 lines
Quoted 3 lines

---
Thanks, Junio.

Heh, I've pushed out the original one after fixing them up myself last night.

Doing a fine job as the editor, as always. I need to watch pu more closely.