Skip to content

Commit 2acc194

Browse files
szedergitster
authored andcommitted
completion: add a test for __git_remotes() helper function
The test checks that both remotes under '$GIT_DIR/remotes' and remotes in the config file are listed. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 9874fca commit 2acc194

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

t/t9902-completion.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,25 @@ test_expect_success '__gitcomp_nl - doesnt fail because of invalid variable name
351351
__gitcomp_nl "$invalid_variable_name"
352352
'
353353

354+
test_expect_success '__git_remotes - list remotes from $GIT_DIR/remotes and from config file' '
355+
cat >expect <<-EOF &&
356+
remote_from_file_1
357+
remote_from_file_2
358+
remote_in_config_1
359+
remote_in_config_2
360+
EOF
361+
test_when_finished "rm -rf .git/remotes" &&
362+
mkdir -p .git/remotes &&
363+
>.git/remotes/remote_from_file_1 &&
364+
>.git/remotes/remote_from_file_2 &&
365+
test_when_finished "git remote remove remote_in_config_1" &&
366+
git remote add remote_in_config_1 git://remote_1 &&
367+
test_when_finished "git remote remove remote_in_config_2" &&
368+
git remote add remote_in_config_2 git://remote_2 &&
369+
__git_remotes >actual &&
370+
test_cmp expect actual
371+
'
372+
354373
test_expect_success 'basic' '
355374
run_completion "git " &&
356375
# built-in

0 commit comments

Comments
 (0)