Commit e3a46353dce2f604254675a385e8871bee794d32

Stefan Sperling 2021-09-14T16:37:50

verify that 'got status -s' and 'got status -S' cannot be used together

diff --git a/regress/cmdline/status.sh b/regress/cmdline/status.sh
index 77a893c..47f3fb7 100755
--- a/regress/cmdline/status.sh
+++ b/regress/cmdline/status.sh
@@ -821,6 +821,44 @@ test_status_suppress() {
 	echo "new file" > $testroot/wt/new
 	(cd $testroot/wt && got add new >/dev/null)
 
+	(cd $testroot/wt && got status -S A -s M \
+		> $testroot/stdout 2> $testroot/stderr)
+	ret="$?"
+	if [ "$ret" = "0" ]; then
+		echo "status succeeded unexpectedly" >&2
+		test_done "$testroot" "1"
+		return 1
+	fi
+
+	echo "got: -s and -S options are mutually exclusive" \
+		> $testroot/stderr.expected
+	cmp -s $testroot/stderr.expected $testroot/stderr
+	ret="$?"
+	if [ "$ret" != "0" ]; then
+		diff -u $testroot/stderr.expected $testroot/stderr
+		test_done "$testroot" "$ret"
+		return 1
+	fi
+
+	(cd $testroot/wt && got status -s A -S M \
+		> $testroot/stdout 2> $testroot/stderr)
+	ret="$?"
+	if [ "$ret" = "0" ]; then
+		echo "status succeeded unexpectedly" >&2
+		test_done "$testroot" "1"
+		return 1
+	fi
+
+	echo "got: -S and -s options are mutually exclusive" \
+		> $testroot/stderr.expected
+	cmp -s $testroot/stderr.expected $testroot/stderr
+	ret="$?"
+	if [ "$ret" != "0" ]; then
+		diff -u $testroot/stderr.expected $testroot/stderr
+		test_done "$testroot" "$ret"
+		return 1
+	fi
+
 	(cd $testroot/wt && got status -S xDM \
 		> $testroot/stdout 2> $testroot/stderr)
 	ret="$?"