diff --git a/.gitignore b/.gitignore index 2784b39..87db7aa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ build/ *.*~ +test/failures +test/*/*/output diff --git a/src/SSG/Djot/Render.idr b/src/SSG/Djot/Render.idr index bffca50..d9a4a58 100644 --- a/src/SSG/Djot/Render.idr +++ b/src/SSG/Djot/Render.idr @@ -55,4 +55,5 @@ export renderHtml : List Block -> Html "html" renderHtml xs = let (_ ** xs) = renderBlocks xs - in Normal "html" ["lang" =$ "en"] xs + in Normal "html" ["lang" =$ "en"] + [ Normal "body" [] xs ] diff --git a/test/Main.idr b/test/Main.idr new file mode 100644 index 0000000..0437780 --- /dev/null +++ b/test/Main.idr @@ -0,0 +1,8 @@ +module Main + +import Test.Golden.RunnerHelper + +main : IO () +main = goldenRunner + [ "Djot -> HTML Golden Values" `atDir` "djot-to-html" + ] diff --git a/test/djot-to-html/001-hello-world/Main.idr b/test/djot-to-html/001-hello-world/Main.idr new file mode 100644 index 0000000..97d8771 --- /dev/null +++ b/test/djot-to-html/001-hello-world/Main.idr @@ -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 diff --git a/test/djot-to-html/001-hello-world/expected b/test/djot-to-html/001-hello-world/expected new file mode 100644 index 0000000..130955a --- /dev/null +++ b/test/djot-to-html/001-hello-world/expected @@ -0,0 +1,6 @@ + + +
+Hello World!
+ + \ No newline at end of file diff --git a/test/djot-to-html/001-hello-world/run b/test/djot-to-html/001-hello-world/run new file mode 100644 index 0000000..6b5ab53 --- /dev/null +++ b/test/djot-to-html/001-hello-world/run @@ -0,0 +1,6 @@ +rm -rf build/ + +flock "$1" pack -q install-deps test.ipkg +pack -q run test.ipkg + +rm -rf build/ diff --git a/test/djot-to-html/001-hello-world/test.dj b/test/djot-to-html/001-hello-world/test.dj new file mode 100644 index 0000000..980a0d5 --- /dev/null +++ b/test/djot-to-html/001-hello-world/test.dj @@ -0,0 +1 @@ +Hello World! diff --git a/test/djot-to-html/001-hello-world/test.ipkg b/test/djot-to-html/001-hello-world/test.ipkg new file mode 100644 index 0000000..0efef9e --- /dev/null +++ b/test/djot-to-html/001-hello-world/test.ipkg @@ -0,0 +1,7 @@ +package a-test + +depends = SSG + +main = Main + +executable = test diff --git a/test/src/Main.idr b/test/src/Main.idr deleted file mode 100644 index 1047866..0000000 --- a/test/src/Main.idr +++ /dev/null @@ -1,4 +0,0 @@ -module Main - -main : IO () -main = putStrLn "Test successful!" diff --git a/test/test.ipkg b/test/test.ipkg index 81f240b..b1e7e47 100644 --- a/test/test.ipkg +++ b/test/test.ipkg @@ -14,6 +14,7 @@ authors = "Nathan McCarty" -- packages to add to search path depends = SSG + , golden-runner-helper -- modules to install -- modules = @@ -24,7 +25,7 @@ main = Main -- name of executable executable = "SSG-test" -- opts = -sourcedir = "src" +-- sourcedir = "." -- builddir = -- outputdir =