blob: 94299756f75a7b084189632dc51934a86e0f18c9 (
plain)
1
2
3
4
5
6
7
8
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
|
module SourceConstructionTest
( test
)
where
import BuildModel ( RawSource(..)
, Source(..)
, processRawSource
)
import Hedge ( Result
, Test
, assertThat
, givenInput
, then'
, whenTransformed
)
test :: IO (Test ())
test = return $ givenInput
"a program"
exampleProgram
[ whenTransformed "processed to a source"
processRawSource
[then' "it is a Program" checkIsProgram]
]
exampleProgram :: RawSource
exampleProgram = RawSource
"some/file/somewhere.f90"
$ unlines
[ "program some_program"
, " implicit none"
, " print *, \"Hello, World!\""
, "end program"
]
checkIsProgram :: Source -> Result
checkIsProgram s = assertThat $ case s of
Program -> True
_ -> False
|