diff --git a/run-tests.sh b/run-tests.sh index 6fc4d0cb5..bf1874422 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -22,54 +22,72 @@ function expect() { fi } +# General information echo ---------------------------------------------------------------------- echo $ASEPRITE --version $ASEPRITE --version -echo ---------------------------------------------------------------------- -echo Temp dir +filter="$*" +if [[ "$filter" != "" ]]; then + echo Filter: $filter +fi + t=$(mktemp -d) -echo $t +echo Temp dir: $t -echo ---------------------------------------------------------------------- -echo "Testing console..." -$ASEPRITE -b --script scripts/console_assert.lua >$t/tmp 2>$t/tmp_err -! grep -q "this should be in the output" $t/tmp && fail "print() text not found in output" -! grep -q "assertion failed" $t/tmp && fail "assert() text not found in output" -grep -q "this should not be in the output" $t/tmp && fail "text that shouldn't be in the output is" +if [[ "$filter" == "" ]] || [[ "console" =~ $filter ]]; then + echo ---------------------------------------------------------------------- + echo "Testing console..." -if [[ "$(uname)" =~ "MINGW32" ]] || [[ "$(uname)" =~ "MSYS_NT-10.0" ]] ; then - echo Ignore console tests on Windows -else - $ASEPRITE -b --script scripts/console_print.lua >$t/tmp 2>$t/tmp_err - cat >$t/tmp_expected <$t/tmp 2>$t/tmp_err + ! grep -q "this should be in the output" $t/tmp && fail "print() text not found in output" + ! grep -q "assertion failed" $t/tmp && fail "assert() text not found in output" + grep -q "this should not be in the output" $t/tmp && fail "text that shouldn't be in the output is" + + if [[ "$(uname)" =~ "MINGW32" ]] || [[ "$(uname)" =~ "MSYS_NT-10.0" ]] ; then + echo Ignore console tests on Windows + else + $ASEPRITE -b --script scripts/console_print.lua >$t/tmp 2>$t/tmp_err + cat >$t/tmp_expected <$t/tmp 2>$t/tmp_err ; then - echo FAILED - echo STDOUT && cat $t/tmp - echo STDERR && cat $t/tmp_err - result=1 + echo FAILED + echo STDOUT && cat $t/tmp + echo STDERR && cat $t/tmp_err + result=1 fi done -echo ---------------------------------------------------------------------- -echo "Testing CLI..." - +first=0 for script in cli/*.sh ; do - echo "Running $script" - source $script + if [[ "$filter" == "" ]] || [[ $script =~ $filter ]]; then + if [ $first == 0 ]; then + echo ---------------------------------------------------------------------- + echo "Testing CLI..." + first=1 + fi + echo "Running $script" + source $script + fi done echo ----------------------------------------------------------------------