diff --git a/quickrun b/quickrun index 4bdf8eb..84846e1 100755 --- a/quickrun +++ b/quickrun @@ -3,3 +3,10 @@ # This allows testing changes without recompiling. runghc -isrc -idist/build/autogen shellcheck.hs "$@" + +# Note: with new-build you can +# +# % cabal new-run --disable-optimization -- shellcheck "$@" +# +# This does build the executable, but as the optimisation is disabled, +# the build is quite fast. diff --git a/quicktest b/quicktest index f4ed0b3..7d7cb05 100755 --- a/quicktest +++ b/quicktest @@ -1,22 +1,21 @@ #!/bin/bash -# quicktest runs the ShellCheck unit tests in an interpreted mode. -# This allows running tests without compiling, which can be faster. +# shellcheck disable=SC2091 + +# quicktest runs the ShellCheck unit tests. +# Once `doctests` test executable is build, we can just run it +# This allows running tests without compiling library, which is faster. # 'cabal test' remains the source of truth. -( - var=$(echo 'liftM and $ sequence [ - ShellCheck.Analytics.runTests - ,ShellCheck.Parser.runTests - ,ShellCheck.Checker.runTests - ,ShellCheck.Checks.Commands.runTests - ,ShellCheck.Checks.ShellSupport.runTests - ,ShellCheck.AnalyzerLib.runTests - ]' | tr -d '\n' | cabal repl 2>&1 | tee /dev/stderr) -if [[ $var == *$'\nTrue'* ]] -then - exit 0 -else - grep -C 3 -e "Fail" -e "Tracing" <<< "$var" - exit 1 -fi -) 2>&1 +$(find dist -type f -name doctests) + +# Note: if you have build the project with new-build +# +# % cabal new-build -w ghc-8.4.3 --enable-tests +# +# and have cabal-plan installed (e.g. with cabal new-install cabal-plan), +# then you can quicktest with +# +# % $(cabal-plan list-bin doctests) +# +# Once the test executable exists, we can simply run it to perform doctests +# which use GHCi under the hood.