9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/test_hook.rb', line 9
def compile_file_content(req)
<<-EOF
{-# OPTIONS_GHC -fdefer-type-errors #-}
import Test.Hspec
import Test.Hspec.Runner (hspecWith, defaultConfig, Config (configFormatter))
import Test.QuickCheck
import Test.Hspec.Formatters
import qualified Control.Exception as Exception
import Data.List
structured :: Formatter
structured = silent {
exampleSucceeded = \\p ->
writeTerm [formatPath p, "passed", ""],
exampleFailed = \\p result -> case result of
(Right e) -> writeTerm [formatPath p, "failed", e]
(Left e) -> writeTerm [formatPath p, "failed", show e],
headerFormatter = write $ "@@@RESULTS-START@@@[",
footerFormatter = write $ "null]"
}
where formatPath (ps, p) = intercalate " " $ (ps ++ [p])
writeTerm = write.(++",").show
#{req.content}
#{req.}
main :: IO ()
main = hspecWith defaultConfig {configFormatter = Just structured} $ do
#{req.test.lines.map {|it| ' ' + it}.join}
EOF
end
|