t5505-remote.sh: check the behavior without a subcommand
'git remote' without a subcommand defaults to listing all remotes and doesn't accept any arguments except the '-v|--verbose' option. We are about to teach parse-options to handle subcommands, and update 'git remote' to make use of that new feature. So let's add some tests to make sure that the upcoming changes don't inadvertently change the behavior in these cases. Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
SZEDER Gábor committed
Aug 19, 2022 at 18:03 UTC
31a66c196435d12e9562ce89da8646016ec8b1e7
1 file changed
+20
t/t5505-remote.sh
+20
@@ -241,6 +241,26 @@ test_expect_success 'add invalid foreign_vcs remote' '
241
test_cmp expect actual
242
'
243
244
+test_expect_success 'without subcommand' '
245
+ echo origin >expect &&
246
+ git -C test remote >actual &&
247
+ test_cmp expect actual
248
+'
249
+
250
+test_expect_success 'without subcommand accepts -v' '
251
+ cat >expect <<-EOF &&
252
+ origin $(pwd)/one (fetch)
253
+ origin $(pwd)/one (push)
254
+ EOF
255
+ git -C test remote -v >actual &&
256
+ test_cmp expect actual
257
+'
258
+
259
+test_expect_success 'without subcommand does not take arguments' '
260
+ test_expect_code 129 git -C test remote origin 2>err &&
261
+ grep "^error: Unknown subcommand:" err
262
+'
263
+
264
cat >test/expect <<EOF
265
* remote origin
266
Fetch URL: $(pwd)/one