Thread (79 messages) 79 messages, 3 authors, 2022-09-05
STALE1376d
Revisions (2)
  1. v1 current
  2. v2 [diff vs current]

[PATCH 03/20] t5505-remote.sh: check the behavior without a subcommand

From: SZEDER Gábor <hidden>
Date: 2022-07-25 12:39:19
Subsystem: the rest · Maintainer: Linus Torvalds

'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 <redacted>
---
 t/t5505-remote.sh | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh
index 6c7370f87f..f075dd4afa 100755
--- a/t/t5505-remote.sh
+++ b/t/t5505-remote.sh
@@ -241,6 +241,35 @@ test_expect_success 'add invalid foreign_vcs remote' '
 	test_cmp expect actual
 '
 
+test_expect_success 'without subcommand' '
+	(
+		cd test &&
+		git remote >actual &&
+		echo origin >expect &&
+		test_cmp expect actual
+	)
+'
+
+test_expect_success 'without subcommand accepts -v' '
+	cat >test/expect <<-EOF &&
+	origin	$(pwd)/one (fetch)
+	origin	$(pwd)/one (push)
+	EOF
+	(
+		cd test &&
+		git remote -v >actual &&
+		test_cmp expect actual
+	)
+'
+
+test_expect_success 'without subcommand does not take arguments' '
+	(
+		cd test &&
+		test_expect_code 129 git remote origin 2>err &&
+		grep "^error: Unknown subcommand:" err
+	)
+'
+
 cat >test/expect <<EOF
 * remote origin
   Fetch URL: $(pwd)/one
-- 
2.37.1.633.g6a0fa73e39
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help