aboutsummaryrefslogtreecommitdiff
path: root/test/002-test-key-name.test/run.sh
diff options
context:
space:
mode:
Diffstat (limited to 'test/002-test-key-name.test/run.sh')
-rwxr-xr-xtest/002-test-key-name.test/run.sh27
1 files changed, 15 insertions, 12 deletions
diff --git a/test/002-test-key-name.test/run.sh b/test/002-test-key-name.test/run.sh
index cdd0004..aa2adca 100755
--- a/test/002-test-key-name.test/run.sh
+++ b/test/002-test-key-name.test/run.sh
@@ -15,9 +15,9 @@ stderr="$(mktemp)"
# Four character search should be a < 1 second CPU burst for CI runner
${EXECUTABLE} -s site > $key 2>$stderr
-found="$(tr '\r' '\n' < $stderr | grep Found | cut -d ' ' -f 3)"
+found=($(tr '\r' '\n' < $stderr | grep Found | cut -d ' ' -f 3))
-echo "sand-leek says it found $found..."
+echo "sand-leek says it found ${found[*]}..."
# Trick adapted to py3 from https://swehack.org/viewtopic.php?f=37&p=6978
real="$( \
@@ -30,13 +30,16 @@ real="$( \
echo "Key analysis shows it's for ${real}"
-if [ "$found" = "$real" ] ; then
- echo "It's a match, I'm happy"
- rm $key
- rm $stderr
- exit 0
-else
- echo "Error: No match. Key file contents:"
- cat "$key"
- exit 1
-fi
+for f in "${found[@]}" ; do
+ if [ "$f" == "$real" ] ; then
+ echo "Found a match, I'm happy"
+ rm $key
+ rm $stderr
+ exit 0
+ fi
+done
+
+# fallthrough: not found
+echo "Error: No match. Key file contents:"
+cat "$key"
+exit 1