From dd2ac8ed250d4a41cffde46e7c301b549e7e61d1 Mon Sep 17 00:00:00 2001 From: Paul Pacheco Date: Sat, 25 Sep 2021 12:00:07 -0500 Subject: [PATCH] fix unary operator expected error The if comparisons can sometimes compare an empty variable, which gives errors like this: ``` /steps/run_tests.sh: line 71: [: =: unary operator expected ``` This PR should fix the script to address that problem. See an explanation of why this error happens here: https://codefather.tech/blog/bash-unary-operator-expected/ --- action/steps/run_tests.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/action/steps/run_tests.sh b/action/steps/run_tests.sh index 36be50e..518a5fd 100644 --- a/action/steps/run_tests.sh +++ b/action/steps/run_tests.sh @@ -67,8 +67,9 @@ ls -alh $UNITY_PROJECT_PATH # # Testing in EditMode # +EDIT_MODE_EXIT_CODE=0 -if [ $EDIT_MODE = true ]; then +if [ "$EDIT_MODE" == "true" ]; then echo "" echo "###########################" echo "# Testing in EditMode #" @@ -104,8 +105,8 @@ fi # # Testing in PlayMode # - -if [ $PLAY_MODE = true ]; then +PLAY_MODE_EXIT_CODE=0 +if [ "$PLAY_MODE" == "true" ]; then echo "" echo "###########################" echo "# Testing in PlayMode #" @@ -149,7 +150,7 @@ echo "###########################" echo "" ls -alh $UNITY_PROJECT_PATH -if [ $EDIT_MODE = true ]; then +if [ "$EDIT_MODE" == "true" ]; then echo "" echo "###########################" echo "# Edit Mode Results #" @@ -159,7 +160,7 @@ if [ $EDIT_MODE = true ]; then cat "$FULL_ARTIFACTS_PATH/editmode-results.xml" | grep test-run | grep Passed fi -if [ $PLAY_MODE = true ]; then +if [ "$PLAY_MODE" == "true ]; then echo "" echo "###########################" echo "# Play Mode Results #"