Lines effect
This commit is contained in:
parent
db0f3a0427
commit
bd94410c01
13 changed files with 146 additions and 27 deletions
|
@ -4,5 +4,5 @@ import Test.Golden.RunnerHelper
|
|||
|
||||
main : IO ()
|
||||
main = goldenRunner
|
||||
[ "Djot -> HTML Golden Values" `atDir` "djot-to-html"
|
||||
[ "Hedgehog Tests" `atDir` "hedgehog"
|
||||
]
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
module Main
|
||||
|
||||
import SSG.Djot
|
||||
import SSG.HTML
|
||||
|
||||
import System
|
||||
import System.File
|
||||
|
||||
main : IO ()
|
||||
main = do
|
||||
Right contents <- readFile "test.dj"
|
||||
| Left err => do
|
||||
printLn err
|
||||
exitFailure
|
||||
let parsed = djot contents
|
||||
putStr . render . renderHtml $ parsed
|
|
@ -1,6 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html lang=en>
|
||||
<body>
|
||||
<p>Hello World!</p>
|
||||
</body>
|
||||
</html>
|
|
@ -1 +0,0 @@
|
|||
Hello World!
|
28
test/hedgehog/001-lines/Main.idr
Normal file
28
test/hedgehog/001-lines/Main.idr
Normal file
|
@ -0,0 +1,28 @@
|
|||
module Main
|
||||
|
||||
import SSG.Djot.Lines
|
||||
|
||||
import Control.Eff
|
||||
import Data.String
|
||||
import Hedgehog
|
||||
|
||||
lines' : Eff [Lines] (List String)
|
||||
lines' = do
|
||||
Just next <- take
|
||||
| _ => pure []
|
||||
map (next ::) lines'
|
||||
|
||||
propLinesEquiv : Property
|
||||
propLinesEquiv = property $ do
|
||||
str <- forAll $ string (linear 0 256) ascii
|
||||
let std_lines = lines str
|
||||
let (our_lines, rest) = extract $ runLines str lines'
|
||||
our_lines === std_lines
|
||||
|
||||
main : IO ()
|
||||
main = test $
|
||||
[ MkGroup
|
||||
"Lines effect"
|
||||
[ ("Lines effect equivalent to lines", propLinesEquiv)
|
||||
]
|
||||
]
|
3
test/hedgehog/001-lines/expected
Normal file
3
test/hedgehog/001-lines/expected
Normal file
|
@ -0,0 +1,3 @@
|
|||
━━━ Lines effect ━━━
|
||||
✓ Lines effect equivalent to lines passed 1000 tests.
|
||||
✓ 1 succeeded.
|
5
test/hedgehog/001-lines/pack.toml
Normal file
5
test/hedgehog/001-lines/pack.toml
Normal file
|
@ -0,0 +1,5 @@
|
|||
[custom.all.SSG]
|
||||
type = "local"
|
||||
path = "../../.."
|
||||
ipkg = "SSG.ipkg"
|
||||
test = "test/test.ipkg"
|
|
@ -1,6 +1,6 @@
|
|||
rm -rf build/
|
||||
|
||||
flock "$1" pack -q install-deps test.ipkg
|
||||
pack -q run test.ipkg
|
||||
HEDGEHOG_COLOR=0 pack -q run test.ipkg -n 1000
|
||||
|
||||
rm -rf build/
|
|
@ -1,6 +1,8 @@
|
|||
package a-test
|
||||
|
||||
depends = SSG
|
||||
, hedgehog
|
||||
, eff
|
||||
|
||||
main = Main
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue