Setup golden value testing
This commit is contained in:
parent
4e83ca8d48
commit
72b102d071
10 changed files with 50 additions and 6 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,2 +1,4 @@
|
||||||
build/
|
build/
|
||||||
*.*~
|
*.*~
|
||||||
|
test/failures
|
||||||
|
test/*/*/output
|
||||||
|
|
|
@ -55,4 +55,5 @@ export
|
||||||
renderHtml : List Block -> Html "html"
|
renderHtml : List Block -> Html "html"
|
||||||
renderHtml xs =
|
renderHtml xs =
|
||||||
let (_ ** xs) = renderBlocks xs
|
let (_ ** xs) = renderBlocks xs
|
||||||
in Normal "html" ["lang" =$ "en"] xs
|
in Normal "html" ["lang" =$ "en"]
|
||||||
|
[ Normal "body" [] xs ]
|
||||||
|
|
8
test/Main.idr
Normal file
8
test/Main.idr
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
module Main
|
||||||
|
|
||||||
|
import Test.Golden.RunnerHelper
|
||||||
|
|
||||||
|
main : IO ()
|
||||||
|
main = goldenRunner
|
||||||
|
[ "Djot -> HTML Golden Values" `atDir` "djot-to-html"
|
||||||
|
]
|
16
test/djot-to-html/001-hello-world/Main.idr
Normal file
16
test/djot-to-html/001-hello-world/Main.idr
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
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
|
6
test/djot-to-html/001-hello-world/expected
Normal file
6
test/djot-to-html/001-hello-world/expected
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html lang=en>
|
||||||
|
<body>
|
||||||
|
<p>Hello World!</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
6
test/djot-to-html/001-hello-world/run
Normal file
6
test/djot-to-html/001-hello-world/run
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
rm -rf build/
|
||||||
|
|
||||||
|
flock "$1" pack -q install-deps test.ipkg
|
||||||
|
pack -q run test.ipkg
|
||||||
|
|
||||||
|
rm -rf build/
|
1
test/djot-to-html/001-hello-world/test.dj
Normal file
1
test/djot-to-html/001-hello-world/test.dj
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Hello World!
|
7
test/djot-to-html/001-hello-world/test.ipkg
Normal file
7
test/djot-to-html/001-hello-world/test.ipkg
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
package a-test
|
||||||
|
|
||||||
|
depends = SSG
|
||||||
|
|
||||||
|
main = Main
|
||||||
|
|
||||||
|
executable = test
|
|
@ -1,4 +0,0 @@
|
||||||
module Main
|
|
||||||
|
|
||||||
main : IO ()
|
|
||||||
main = putStrLn "Test successful!"
|
|
|
@ -14,6 +14,7 @@ authors = "Nathan McCarty"
|
||||||
|
|
||||||
-- packages to add to search path
|
-- packages to add to search path
|
||||||
depends = SSG
|
depends = SSG
|
||||||
|
, golden-runner-helper
|
||||||
|
|
||||||
-- modules to install
|
-- modules to install
|
||||||
-- modules =
|
-- modules =
|
||||||
|
@ -24,7 +25,7 @@ main = Main
|
||||||
-- name of executable
|
-- name of executable
|
||||||
executable = "SSG-test"
|
executable = "SSG-test"
|
||||||
-- opts =
|
-- opts =
|
||||||
sourcedir = "src"
|
-- sourcedir = "."
|
||||||
-- builddir =
|
-- builddir =
|
||||||
-- outputdir =
|
-- outputdir =
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue