packages feed

doctest-driver-gen (empty) → 0.1.0.0

raw patch · 8 files changed

+169/−0 lines, 8 filesdep +basedep +doctestdep +doctest-driver-gensetup-changed

Dependencies added: base, doctest, doctest-driver-gen

Files

+ CHANGELOG.md view
@@ -0,0 +1,11 @@+# Changelog for doctest-driver-gen++## 0.1.0.0 (Initial)++doctest-driver-gen is a doctest driver file generator. It lets you automatically generate driver file for doctest's cabal integration.++### Usage++    {-# OPTIONS_GHC -F -pgmF doctest-driver-gen [-optF OPTION]... #-}++Make your driver file with the content. `OPTION` is doctest's option. You can see help with `doctest --help`.
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright Hexirp (c) 2017++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++    * Redistributions of source code must retain the above copyright+      notice, this list of conditions and the following disclaimer.++    * Redistributions in binary form must reproduce the above+      copyright notice, this list of conditions and the following+      disclaimer in the documentation and/or other materials provided+      with the distribution.++    * Neither the name of Hexirp nor the names of other+      contributors may be used to endorse or promote products derived+      from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ README.md view
@@ -0,0 +1,17 @@+# doctest-driver-gen++[![Build Status](https://travis-ci.org/Hexirp/doctest-driver-gen.svg?branch=master)](https://travis-ci.org/Hexirp/doctest-driver-gen)++doctest-driver-gen is a doctest driver file generator. It lets you automatically generate driver file for doctest's cabal integration.++## Usage++```haskell+{-# OPTIONS_GHC -F -pgmF doctest-driver-gen [-optF OPTION]... #-}+```++Make your driver file with the content. `OPTION` is doctest's option. You can see help with `doctest --help`.++## Motivation++This package was motivated by [doctest-discover](https://hackage.haskell.org/package/doctest-discover).
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ app/Main.hs view
@@ -0,0 +1,8 @@+module Main where+ import Prelude+ import System.Environment (getArgs)++ import Test.DocTest.Gen (ddgen)++ main :: IO ()+ main = getArgs >>= ddgen
+ doctest-driver-gen.cabal view
@@ -0,0 +1,52 @@+name:                doctest-driver-gen+version:             0.1.0.0+synopsis:            Generate doctest-driver.hs+description:         doctest-driver-gen is a doctest driver file generator.+                     It lets you automatically generate driver file for+                     doctest's cabal integration.+homepage:            https://github.com/Hexirp/doctest-driver-gen#readme+license:             BSD3+license-file:        LICENSE+author:              Hexirp+maintainer:          https://github.com/Hexirp/doctest-driver-gen/issues+copyright:           2017 Hexirp+category:            Testing+build-type:          Simple+extra-source-files:  README.md, CHANGELOG.md+cabal-version:       >=1.10++library+  hs-source-dirs:      src+  exposed-modules:     Test.DocTest.Gen+  build-depends:       base >= 4 && < 5+                       -- doctest 0.12 is disabled.+                     , doctest >= 0.8 && < 0.12 || >= 0.13 && < 0.14+  ghc-options:         -Wall+  default-language:    Haskell2010++executable doctest-driver-gen+  hs-source-dirs:      app+  main-is:             Main.hs+  ghc-options:         -Wall -threaded -rtsopts -with-rtsopts=-N+  build-depends:       base+                     , doctest-driver-gen+  default-language:    Haskell2010++test-suite doctest-driver-gen-test+  type:                exitcode-stdio-1.0+  hs-source-dirs:      test+  main-is:             doctest-driver.hs+  build-depends:       base+                     , doctest+                     , doctest-driver-gen+  ghc-options:         -threaded -rtsopts -with-rtsopts=-N+  default-language:    Haskell2010++source-repository head+  type:     git+  location: https://github.com/Hexirp/doctest-driver-gen++source-repository this+  type:     git+  location: https://github.com/Hexirp/doctest-driver-gen+  tag:      0.1.0.0
+ src/Test/DocTest/Gen.hs view
@@ -0,0 +1,48 @@+-- |+-- Module      : Test.DocTest.Gen+--+-- Stability   : experimental+-- Portability : portable+--+-- Provide doctest-driver-gen's functions.+module Test.DocTest.Gen where+ import Prelude+ import Data.List (unlines)++ -- * Usage++ -- $usage+ --+ -- > {-# OPTIONS_GHC -F -pgmF doctest-driver-gen [-optF OPTION]... #-}+ --+ -- Make your driver file with the content.+ -- @OPTION@ is doctest's option. You can see help with @doctest --help@.++ -- * Documentation++ -- | Run doctest-driver-gen with given list of arguments.+ ddgen :: [String] -> IO ()+ ddgen (src : inp : out : opts) = ddgen_output src inp out opts+ ddgen _                        = ddgen_usage++ -- | Output driver file.+ ddgen_output+  :: String -- ^ Name of the original source file.+  -> String -- ^ Name of the file holding the input.+  -> String -- ^ Name of the file where this should write its output to.+  -> [String] -- ^ Options for doctest.+  -> IO ()+ ddgen_output _ _ out opts = writeFile out $ unlines [+  "import Test.DocTest",+  "",+  "main :: IO ()",+  "main = doctest " ++ show opts]++ -- | Print doctest-driver-gen's usage.+ ddgen_usage :: IO ()+ ddgen_usage = putStrLn $ unlines [+  "Usage:",+  "  {-# OPTIONS_GHC -F -pgmF doctest-driver-gen [-optF OPTION]... #-}",+  "",+  "Make your driver file with the content.",+  "\"OPTION\" is doctest's option. You can see help with \"doctest --help\"."]
+ test/doctest-driver.hs view
@@ -0,0 +1,1 @@+{-# OPTIONS_GHC -F -pgmF doctest-driver-gen -optF src #-}