aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/unit_test
diff options
context:
space:
mode:
authorBrad Richardson <everythingfunctional@protonmail.com>2020-10-14 12:23:03 -0500
committerBrad Richardson <everythingfunctional@protonmail.com>2020-10-14 12:23:03 -0500
commit0a7eb98dd5083ede9e940a3e9cc424b76968ba4a (patch)
treea772f2d55d9b08096536648fada3c736f4920e57 /bootstrap/unit_test
parentef7cbcd4014e9b81a57d9f16564623d4073b461d (diff)
downloadfpm-0a7eb98dd5083ede9e940a3e9cc424b76968ba4a.tar.gz
fpm-0a7eb98dd5083ede9e940a3e9cc424b76968ba4a.zip
Finish first unit test
Diffstat (limited to 'bootstrap/unit_test')
-rw-r--r--bootstrap/unit_test/SourceConstructionTest.hs35
1 files changed, 32 insertions, 3 deletions
diff --git a/bootstrap/unit_test/SourceConstructionTest.hs b/bootstrap/unit_test/SourceConstructionTest.hs
index a3fdf68..9429975 100644
--- a/bootstrap/unit_test/SourceConstructionTest.hs
+++ b/bootstrap/unit_test/SourceConstructionTest.hs
@@ -3,9 +3,38 @@ module SourceConstructionTest
)
where
-import Hedge ( Test
- , describe
+import BuildModel ( RawSource(..)
+ , Source(..)
+ , processRawSource
+ )
+import Hedge ( Result
+ , Test
+ , assertThat
+ , givenInput
+ , then'
+ , whenTransformed
)
test :: IO (Test ())
-test = return $ describe "something" []
+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