From 390b41bc2630c9e3fb9fe270247b2f9ee14d8646 Mon Sep 17 00:00:00 2001 From: James Shubin Date: Mon, 21 Jun 2021 18:28:05 -0400 Subject: [PATCH] test: Add small test for weird bash spacing --- test.sh | 6 +++--- test/test-bashfmt.sh | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/test.sh b/test.sh index 7486a5f5..9fec17a6 100755 --- a/test.sh +++ b/test.sh @@ -29,7 +29,7 @@ label-block() { function run-testsuite() { testname="$(basename "$1" .sh)" # if not running all tests or if this test is not explicitly selected, skip it - if test -z "$testsuite" || test "test-$testsuite" = "$testname";then + if test -z "$testsuite" || test "test-$testsuite" = "$testname"; then fold_start "$testname" "$@" || failures=$([ -n "$failures" ] && echo "$failures\\n$@" || echo "$@") fold_end "$testname" @@ -40,12 +40,12 @@ function run-testsuite() { function skip-testsuite() { testname=$(basename "$1" .sh) # show skip message only when running full suite - if test -z "$testsuite";then + if test -z "$testsuite"; then echo skipping "$@" "($REASON)" echo 'SKIP' else # if a skipped suite is explicity called, run it anyway - if test "test-$testsuite" == "$testname";then + if test "test-$testsuite" == "$testname"; then run-testsuite "$@" fi fi diff --git a/test/test-bashfmt.sh b/test/test-bashfmt.sh index aceaf136..cbd3c265 100755 --- a/test/test-bashfmt.sh +++ b/test/test-bashfmt.sh @@ -26,6 +26,11 @@ bad_files=$( if grep -q '^ ' "$i"; then echo "$i" fi + + # search for files with weird semicolon, then pattern + if grep -q ';''then' "$i"; then + echo "$i" + fi done )