shelltestrunner 1.9 → 1.9.0.1
raw patch · 5 files changed
+48/−29 lines, 5 filesdep ~basenew-uploader
Dependency ranges changed: base
Files
- CHANGES +4/−0
- README.md +22/−21
- shelltestrunner.cabal +18/−4
- src/Utils/Debug.hs +1/−1
- src/shelltest.hs +3/−3
CHANGES view
@@ -1,3 +1,7 @@+1.9.0.1 (2023/8/21)++* fix build with base-4.18 shipped with GHC 9.6 (Andreas Abel)+ 1.9 (2018/1/14) * two new test file formats have been added, allowing input re-use and lighter syntax
README.md view
@@ -15,7 +15,7 @@ commands, released under GPLv3+. It reads simple test specifications defining a command to run, some input, and the expected output, stderr, and exit status. It can run tests in parallel, selectively,-with a timeout, in color, etc. +with a timeout, in color, etc. Projects using it include [hledger](http://hledger.org), [Agda](http://wiki.portal.chalmers.se/agda),@@ -24,7 +24,7 @@ ## Install -There may be a new-enough +There may be a new-enough [packaged version](https://repology.org/metapackage/shelltestrunner/badges) on your platform. Eg: @@ -37,8 +37,8 @@ ||| |----------------|----------------------------------------| stack: | **[get stack](https://haskell-lang.org/get-started)**, **`stack install shelltestrunner-1.9`**-| cabal: | **`cabal update; cabal install shelltestrunner-1.9`**+| stack: | **[get stack](https://haskell-lang.org/get-started)**, **`stack install shelltestrunner-1.9.0.1`**+| cabal: | **`cabal update; cabal install shelltestrunner-1.9.0.1`** ## Usage @@ -50,11 +50,11 @@ They're called "shell test" because any shell (`/bin/sh` on POSIX, `CMD` on Windows) command line can be tested.-Each test begins with the command to test, followed by optional stdin input, +Each test begins with the command to test, followed by optional stdin input, expected stdout and/or stderr output, and ends with the expected exit status. Here's another file containing two tests: - # Test that the "cat" program copies its input to stdout, + # Test that the "cat" program copies its input to stdout, # nothing appears on stderr, and exit status is 0. cat <<<@@ -63,7 +63,7 @@ foo >>>2 >>>= 0- + # Test that cat prints an error containing "unrecognized option" or # "illegal option" and exits with non-zero status if given a bad flag. cat --no-such-flag@@ -77,21 +77,21 @@ :cat.test:1: [OK] :cat.test:2: [OK] - Test Cases Total - Passed 3 3 - Failed 0 0 - Total 3 3 + Test Cases Total+ Passed 3 3+ Failed 0 0+ Total 3 3 -That's the basics! +That's the basics! There are also some alternate test formats you'll read about below. ## Options $ shelltest --help- shelltest 1.9- + shelltest 1.9.0.1+ shelltest [OPTIONS] [TESTFILES|TESTDIRS]- + Common flags: -l --list List all parsed tests and stop -a --all Don't truncate output, even if large@@ -115,7 +115,7 @@ -? --help Display help message -V --version Print version information --numeric-version Print just the version number- + `shelltest` accepts one or more test file or directory arguments. A directory means all files below it named `*.test` (customisable with `--extension`). @@ -138,8 +138,8 @@ `--hide-successes` gives quieter output, reporting only failed tests. Long flags can be abbreviated to a unique prefix.- + For example, the command: $ shelltest tests -i args -c -j8 -o1 -DCONF_FILE=test/myconf.cfq --hide@@ -186,7 +186,7 @@ When not specified, stdout/stderr are ignored. A space before the command protects it from -w/--with. -Examples: +Examples: [above](#usage), [shelltestrunner](https://github.com/simonmichael/shelltestrunner/tree/master/tests/format1), [hledger](https://github.com/simonmichael/hledger/tree/master/tests),@@ -195,13 +195,13 @@ ### Format 2 -(shelltestrunner 1.9+) +(shelltestrunner 1.9+) This improves on format 1 in two ways: it allows tests to reuse the same input, and it allows delimiters to often be omitted. -Test files contain one or more test groups. +Test files contain one or more test groups. A test group consists of some optional standard input and one or more tests.-Each test is a one-line shell command followed by optional expected standard output, +Each test is a one-line shell command followed by optional expected standard output, error output and/or numeric exit status, separated by delimiters. # COMMENTS OR BLANK LINES@@ -346,6 +346,7 @@ | Code | https://github.com/simonmichael/shelltestrunner | Issues | https://github.com/simonmichael/shelltestrunner/issues | IRC | http://webchat.freenode.net?channels=shelltestrunner <!-- or /msg sm -->+ <!-- | Email | [simon@joyful.com](mailto:simon@joyful.com?subject=[shelltestrunner]) --> [2012 user survey](https://docs.google.com/spreadsheet/pub?key=0Au47MrJax8HpdGpZSzdhWHlCUkJpR2hjX1MwMWFoUEE&single=true&gid=3&output=html).
shelltestrunner.cabal view
@@ -1,5 +1,6 @@+cabal-version: >= 1.10 name: shelltestrunner-version: 1.9+version: 1.9.0.1 category: Testing synopsis: Easy, repeatable testing of CLI programs/commands @@ -9,7 +10,7 @@ commands, released under GPLv3+. It reads simple test specifications defining a command to run, some input, and the expected output, stderr, and exit status. It can run tests in parallel, selectively,- with a timeout, in color, etc. + with a timeout, in color, etc. license: GPL license-file: LICENSE@@ -18,10 +19,22 @@ homepage: https://github.com/simonmichael/shelltestrunner bug-reports: https://github.com/simonmichael/shelltestrunner/issues stability: stable-tested-with: GHC==7.10.3, GHC==8.0.2, GHC==8.2.2-cabal-version: >= 1.6 build-type: Simple +tested-with:+ GHC == 9.8.0+ GHC == 9.6.2+ GHC == 9.4.5+ GHC == 9.2.8+ GHC == 9.0.2+ GHC == 8.10.7+ GHC == 8.8.4+ GHC == 8.6.5+ GHC == 8.4.4+ GHC == 8.2.2+ GHC == 8.0.2+ GHC == 7.10.3+ extra-tmp-files: extra-source-files: README.md@@ -39,6 +52,7 @@ tests/examples/*.test executable shelltest+ default-language: Haskell2010 ghc-options: -threaded -W -fwarn-tabs main-is: shelltest.hs hs-source-dirs: src
src/Utils/Debug.hs view
@@ -30,7 +30,7 @@ ) where -import Debug.Trace+import Debug.Trace (trace) import Control.Monad (when) import Data.List import Safe (readDef)
src/shelltest.hs view
@@ -33,15 +33,15 @@ progname, progversion :: String progname = "shelltest"-progversion = progname ++ " " ++ "1.9"+progversion = progname ++ " " ++ "1.9.0.1" proghelpsuffix :: [String] proghelpsuffix = [ "shelltest file formats, tried in this order:" ,""- ,"Description Delimiters, in order" + ,"Description Delimiters, in order" ,"------------------------------------------------------ ------------------------" ,"v2 input then multiple tests; some delimiters optional <<< $$$ >>> >>>2 >>>="- ,"v3 same as v2, but with short delimiters < $ > >2 >=" + ,"v3 same as v2, but with short delimiters < $ > >2 >=" ,"v1 command first; exit status is required (none) <<< >>> >>>2 >>>=" ,"" ]