Use temporary directory for tutorial example files (#503)
... as suggested by @sol
This commit is contained in:
parent
ec807be8c6
commit
1346663776
|
@ -274,9 +274,11 @@ Test-Suite doctest
|
|||
Main-Is: Main.hs
|
||||
GHC-Options: -Wall
|
||||
Build-Depends:
|
||||
base ,
|
||||
Diff >= 0.2 && < 0.4 ,
|
||||
doctest >= 0.7.0 && < 0.17
|
||||
base ,
|
||||
directory >= 1.2.2.0 && < 1.4 ,
|
||||
filepath < 1.5 ,
|
||||
mockery < 0.4 ,
|
||||
doctest >= 0.7.0 && < 0.17
|
||||
Default-Language: Haskell2010
|
||||
|
||||
Benchmark dhall-parser
|
||||
|
|
|
@ -1,12 +1,29 @@
|
|||
module Main where
|
||||
|
||||
import Data.Monoid ((<>))
|
||||
import System.FilePath ((</>))
|
||||
|
||||
import qualified System.Directory
|
||||
import qualified Test.Mockery.Directory
|
||||
import qualified Test.DocTest
|
||||
|
||||
main :: IO ()
|
||||
main =
|
||||
Test.DocTest.doctest
|
||||
[ "-isrc"
|
||||
, "src/Dhall.hs"
|
||||
, "src/Dhall/Import.hs"
|
||||
, "src/Dhall/Tutorial.hs"
|
||||
]
|
||||
main = do
|
||||
pwd <- System.Directory.getCurrentDirectory
|
||||
prefix <- System.Directory.makeAbsolute pwd
|
||||
|
||||
Test.Mockery.Directory.inTempDirectory $ do
|
||||
writeFile "makeBools" "λ(n : Bool) → [ n && True, n && False, n || True, n || False ]"
|
||||
writeFile "bool1" "True"
|
||||
writeFile "bool2" "False"
|
||||
writeFile "both" "./bool1 && ./bool2"
|
||||
writeFile "file2" "./file1"
|
||||
writeFile "file1" "./file2"
|
||||
|
||||
Test.DocTest.doctest
|
||||
[ "--fast"
|
||||
, "-i" <> (prefix </> "src")
|
||||
, prefix </> "src/Dhall.hs"
|
||||
, prefix </> "src/Dhall/Import.hs"
|
||||
, prefix </> "src/Dhall/Tutorial.hs"
|
||||
]
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
, containers, contravariant, criterion, cryptonite, deepseq, Diff
|
||||
, directory, doctest, exceptions, filepath, haskeline, http-client
|
||||
, http-client-tls, insert-ordered-containers, lens-family-core
|
||||
, megaparsec, memory, mtl, optparse-applicative, parsers
|
||||
, megaparsec, memory, mockery, mtl, optparse-applicative, parsers
|
||||
, prettyprinter, prettyprinter-ansi-terminal, repline, scientific
|
||||
, stdenv, tasty, tasty-hunit, template-haskell, text, transformers
|
||||
, unordered-containers, vector
|
||||
|
@ -23,8 +23,8 @@ mkDerivation {
|
|||
];
|
||||
executableHaskellDepends = [ base ];
|
||||
testHaskellDepends = [
|
||||
base deepseq Diff doctest insert-ordered-containers prettyprinter
|
||||
tasty tasty-hunit text vector
|
||||
base deepseq directory doctest filepath insert-ordered-containers
|
||||
mockery prettyprinter tasty tasty-hunit text vector
|
||||
];
|
||||
benchmarkHaskellDepends = [
|
||||
base containers criterion directory text
|
||||
|
|
|
@ -171,12 +171,6 @@ import Dhall
|
|||
-- $setup
|
||||
--
|
||||
-- >>> :set -XOverloadedStrings
|
||||
-- >>> writeFile "makeBools" "λ(n : Bool) → [ n && True, n && False, n || True, n || False ]"
|
||||
-- >>> writeFile "bool1" "True"
|
||||
-- >>> writeFile "bool2" "False"
|
||||
-- >>> writeFile "both" "./bool1 && ./bool2"
|
||||
-- >>> writeFile "file2" "./file1"
|
||||
-- >>> writeFile "file1" "./file2"
|
||||
|
||||
-- $introduction
|
||||
--
|
||||
|
@ -2822,14 +2816,3 @@ import Dhall
|
|||
-- this guide:
|
||||
--
|
||||
-- <https://github.com/dhall-lang/dhall-lang/wiki/How-to-translate-recursive-code-to-Dhall How to translate recursive code to Dhall>
|
||||
|
||||
-- $cleanup
|
||||
--
|
||||
-- >>> System.Directory.removeFile "bool"
|
||||
-- >>> System.Directory.removeFile "bool1"
|
||||
-- >>> System.Directory.removeFile "bool2"
|
||||
-- >>> System.Directory.removeFile "both"
|
||||
-- >>> System.Directory.removeFile "file1"
|
||||
-- >>> System.Directory.removeFile "file2"
|
||||
-- >>> System.Directory.removeFile "baz"
|
||||
-- >>> System.Directory.removeFile "makeBools"
|
||||
|
|
Loading…
Reference in New Issue
Block a user