diff --git a/README.md b/README.md index 1081005b9794499cc85b29346c3bf6f2dabd1e86..c8eb17d5b520be2cfe173d008dac3cced3876d88 100644 --- a/README.md +++ b/README.md @@ -4,15 +4,57 @@ [![GitHub license](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://raw.githubusercontent.com/lwm/tasty-discover/master/LICENSE) # tasty-discover - Automatic test discovery and runner for the [tasty framework]. [tasty framework]: https://github.com/feuerbach/tasty -PS. There's also [tasty-auto]. +# Getting Started -[tasty-auto]: https://github.com/minad/tasty-auto +![](http://i.imgur.com/gpdHc6x.gif | =200x200) + +5 steps to tasty test discovery satori: + - Create a `Tasty.hs` in the `hs-source-dirs` of your test suite. + - Set your test suite `main-is` to the `Tasty.hs`. + - Create test modules in files with suffix `*Test.hs` or `*Spec.hs`. + - Write your tests with the following prefixes: + - `prop_`: [QuickCheck](http://hackage.haskell.org/package/tasty-quickcheck) properties. + - `scprop_`: [SmallCheck](http://hackage.haskell.org/package/tasty-smallcheck) properties. + - `case_`: [HUnit](http://hackage.haskell.org/package/tasty-hunit) test cases. + - `spec_`: [Hspec](http://hackage.haskell.org/package/tasty-hspec) specifications. + - `test_`: [Tasty](http://hackage.haskell.org/package/tasty) TestTrees. + +# Configuration + +Pass configuration options within your `Tasty.hs` like so: + +```haskell +{-# OPTIONS_GHC -F -pgmF tasty-discover -optF [OPTIONS] #-} +``` + +## No Arguments +Example: `{-# OPTIONS_GHC -F -pgmF tasty-discover -optF --debug #-}` -Hopefully I'll catch up from [#63] and we can merge the packages! + - `--no-module-suffix`: Collect all test modules, regardless of module suffix. + - `--debug`: Output the contents of the generated module while testing. -[#63]: https://github.com/lwm/tasty-discover/pull/63 +## With Arguments +Example: `{-# OPTIONS_GHC -F -pgmF tasty-discover -optF --moduleSuffix=FooBar #-}` + + - `--module-suffix`: Which test module suffix you wish to have discovered. + - `--generated-module`: The name of the generated test module. + - `--ignore-module`: Which test modules to ignore from discovery. + - `--ingredient`: Tasty ingredients to add to your test runner. + +# Change Log +See the [Change log] for the latest changes. + +[Change log]: https://github.com/lwm/tasty-discover/blob/master/CHANGELOG.md + +# Contributing +All contributions welcome! + +# Acknowledgements +Thanks to [hspec-discover] and [tasty-auto] for making this possible. + +[hspec-discover]: https://hspec.github.io/hspec-discover.html +[tasty-auto]: https://github.com/minad/tasty-auto diff --git a/example-usage/LICENSE.md b/example-usage/LICENSE.md deleted file mode 100644 index 4ea6806fe03842e62c8f7c89c274e4b110dcd4a6..0000000000000000000000000000000000000000 --- a/example-usage/LICENSE.md +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2016 Luke Murphy - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/example-usage/README.md b/example-usage/README.md deleted file mode 100644 index 32dba209473989eb15b5e606af86f40a13d93d88..0000000000000000000000000000000000000000 --- a/example-usage/README.md +++ /dev/null @@ -1,9 +0,0 @@ -### tasty-discover example - -Get a copy and run it yourself: - -```bash - $ git clone https://github.com/lwm/tasty-discover - $ cd tasty-discover/example-usage - $ stack test --install-ghc -``` diff --git a/example-usage/Setup.hs b/example-usage/Setup.hs deleted file mode 100644 index 9a994af677b0dfd41b4e3b76b3e7e604003d64e1..0000000000000000000000000000000000000000 --- a/example-usage/Setup.hs +++ /dev/null @@ -1,2 +0,0 @@ -import Distribution.Simple -main = defaultMain diff --git a/example-usage/example.cabal b/example-usage/example.cabal deleted file mode 100644 index 47fc948bb32ce6a43c449e4cd9f7db98de613e63..0000000000000000000000000000000000000000 --- a/example-usage/example.cabal +++ /dev/null @@ -1,32 +0,0 @@ --- This file has been generated from package.yaml by hpack version 0.17.0. --- --- see: https://github.com/sol/hpack - -name: example -version: 0.0.1 -synopsis: Example project for tasty-discover -description: Example project for tasty-discover -license: MIT -license-file: LICENSE.md -build-type: Simple -cabal-version: >= 1.10 - -test-suite example-test - type: exitcode-stdio-1.0 - main-is: Tasty.hs - hs-source-dirs: - test - build-depends: - base - , tasty - , tasty-discover - , tasty-hspec - , tasty-hunit - , tasty-quickcheck - , tasty-smallcheck - other-modules: - AllTheFolders.AnotherNestTest - BarTest - FooTest - Thing.AnotherThing.NestedTest - default-language: Haskell2010 diff --git a/example-usage/package.yaml b/example-usage/package.yaml deleted file mode 100644 index fa0535dd79b51046466cfa469b7029b16a5e67cd..0000000000000000000000000000000000000000 --- a/example-usage/package.yaml +++ /dev/null @@ -1,19 +0,0 @@ -name: "example" -version: "0.0.1" -synopsis: "Example project for tasty-discover" -description: "Example project for tasty-discover" -license: "MIT" -license-file: "LICENSE.md" - -tests: - example-test: - main: "Tasty.hs" - source-dirs: "test" - dependencies: - - "base" - - "tasty" - - "tasty-discover" - - "tasty-hspec" - - "tasty-hunit" - - "tasty-quickcheck" - - "tasty-smallcheck" diff --git a/example-usage/stack.yaml b/example-usage/stack.yaml deleted file mode 100644 index bdf1c5b4627de8137540753ecccfc06833588e39..0000000000000000000000000000000000000000 --- a/example-usage/stack.yaml +++ /dev/null @@ -1,7 +0,0 @@ -resolver: lts-8.5 -packages: -- '.' -- location: - git: "https://github.com/lwm/tasty-discover.git" - commit: "HEAD" - extra-dep: true diff --git a/example-usage/test/AllTheFolders/AnotherNestTest.hs b/example-usage/test/AllTheFolders/AnotherNestTest.hs deleted file mode 100644 index c0b12f8587600e0176378c0b5341c6c3abbe7570..0000000000000000000000000000000000000000 --- a/example-usage/test/AllTheFolders/AnotherNestTest.hs +++ /dev/null @@ -1,4 +0,0 @@ -module AllTheFolders.AnotherNestTest where - -prop_nineIsNine :: Bool -prop_nineIsNine = 9 == (9 :: Integer) diff --git a/example-usage/test/BarTest.hs b/example-usage/test/BarTest.hs deleted file mode 100644 index 8026be5b33f2154768fb0f8717e36a281ace4ade..0000000000000000000000000000000000000000 --- a/example-usage/test/BarTest.hs +++ /dev/null @@ -1,8 +0,0 @@ -module BarTest where - -import Test.Tasty.Hspec (hspec, describe, it, shouldBe) - -case_headIsWorking = hspec $ - describe "Does Prelude.head still work?" $ - it "returns the first element of a list" $ - head [23..] `shouldBe` (23 :: Int) diff --git a/example-usage/test/FooTest.hs b/example-usage/test/FooTest.hs deleted file mode 100644 index 27b95c3ab37dd345e56ea67b91a45f697fed72e3..0000000000000000000000000000000000000000 --- a/example-usage/test/FooTest.hs +++ /dev/null @@ -1,16 +0,0 @@ -module FooTest where - -import Test.Tasty (TestTree) -import Test.Tasty.HUnit (Assertion, (@?=), testCase) - -test_allMyTestsGrouped :: [TestTree] -test_allMyTestsGrouped = - [ testCase "Testing the meaning of life." case_theAnswer - , testCase "Testing the number of the beast." case_theNumberOfTheBeast - ] - -case_theAnswer :: Assertion -case_theAnswer = 42 @?= (42 :: Integer) - -case_theNumberOfTheBeast :: Assertion -case_theNumberOfTheBeast = 666 @?= (666 :: Integer) diff --git a/example-usage/test/Tasty.hs b/example-usage/test/Tasty.hs deleted file mode 100644 index 70c55f52f82405acfdb3234fb484b814d4b17ac7..0000000000000000000000000000000000000000 --- a/example-usage/test/Tasty.hs +++ /dev/null @@ -1 +0,0 @@ -{-# OPTIONS_GHC -F -pgmF tasty-discover #-} diff --git a/example-usage/test/Thing/AnotherThing/NestedTest.hs b/example-usage/test/Thing/AnotherThing/NestedTest.hs deleted file mode 100644 index 4a31f179bf8c0efbee05ba0837dbd7a6813d3508..0000000000000000000000000000000000000000 --- a/example-usage/test/Thing/AnotherThing/NestedTest.hs +++ /dev/null @@ -1,4 +0,0 @@ -module Thing.AnotherThing.NestedTest where - -prop_twoIsTwo :: Bool -prop_twoIsTwo = 2 == (2 :: Integer)