From 7e3d6d11fc210db15fd601826ccac8e7f76b4d2c Mon Sep 17 00:00:00 2001 From: Pedro Botolli Santos Date: Mon, 9 Sep 2024 15:53:42 -0300 Subject: [PATCH] Update hamming.bats A test was added to fail if the script accepts more than two arguments, because the exercise description specifies that exactly two arguments of equal length must be passed. --- exercises/practice/hamming/hamming.bats | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/exercises/practice/hamming/hamming.bats b/exercises/practice/hamming/hamming.bats index 4aacf9a3..d5c1713b 100644 --- a/exercises/practice/hamming/hamming.bats +++ b/exercises/practice/hamming/hamming.bats @@ -82,6 +82,13 @@ load bats-extra assert_output "Usage: hamming.sh " } +@test "invalid input (more than 2 arguments)" { + [[ $BATS_RUN_SKIPPED == "true" ]] || skip + run bash hamming.sh 'A' 'A' 'A' + assert_failure + assert_output "Usage: hamming.sh " +} + # Within [[...]] the == operator is a _pattern matching_ operator. # To test for string equality, the right-hand side must be # quoted to prevent interpretation as a glob-style pattern.