Fix quicktest, add note to it and quickrun

This commit is contained in:
Oleg Grenrus 2018-09-10 19:08:44 +03:00
parent 9e7539c10b
commit 5516596b26
2 changed files with 25 additions and 19 deletions

View File

@ -3,3 +3,10 @@
# This allows testing changes without recompiling. # This allows testing changes without recompiling.
runghc -isrc -idist/build/autogen shellcheck.hs "$@" 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.

View File

@ -1,22 +1,21 @@
#!/bin/bash #!/bin/bash
# quicktest runs the ShellCheck unit tests in an interpreted mode. # shellcheck disable=SC2091
# This allows running tests without compiling, which can be faster.
# 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. # 'cabal test' remains the source of truth.
( $(find dist -type f -name doctests)
var=$(echo 'liftM and $ sequence [
ShellCheck.Analytics.runTests # Note: if you have build the project with new-build
,ShellCheck.Parser.runTests #
,ShellCheck.Checker.runTests # % cabal new-build -w ghc-8.4.3 --enable-tests
,ShellCheck.Checks.Commands.runTests #
,ShellCheck.Checks.ShellSupport.runTests # and have cabal-plan installed (e.g. with cabal new-install cabal-plan),
,ShellCheck.AnalyzerLib.runTests # then you can quicktest with
]' | tr -d '\n' | cabal repl 2>&1 | tee /dev/stderr) #
if [[ $var == *$'\nTrue'* ]] # % $(cabal-plan list-bin doctests)
then #
exit 0 # Once the test executable exists, we can simply run it to perform doctests
else # which use GHCi under the hood.
grep -C 3 -e "Fail" -e "Tracing" <<< "$var"
exit 1
fi
) 2>&1