aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/unit_test/SourceConstructionTest.hs
diff options
context:
space:
mode:
Diffstat (limited to 'bootstrap/unit_test/SourceConstructionTest.hs')
-rw-r--r--bootstrap/unit_test/SourceConstructionTest.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/bootstrap/unit_test/SourceConstructionTest.hs b/bootstrap/unit_test/SourceConstructionTest.hs
index 24122c5..751d10c 100644
--- a/bootstrap/unit_test/SourceConstructionTest.hs
+++ b/bootstrap/unit_test/SourceConstructionTest.hs
@@ -31,12 +31,15 @@ test = return $ givenInput
, then'
"its object file name is the 'flattened' path of the source file with '.o' appended"
checkProgramObjectFileName
+ , then' "it knows what modules it uses directly" checkProgramModulesUsed
]
]
exampleProgram :: RawSource
exampleProgram = RawSource programSourceFileName' $ unlines
[ "program some_program"
+ , " use module1"
+ , " USE MODULE2"
, " implicit none"
, " print *, \"Hello, World!\""
, "end program"
@@ -59,3 +62,7 @@ checkProgramObjectFileName p@(Program{}) =
assertEquals ("." </> "some_file_somewhere.f90.o")
$ (programObjectFileName p) "."
checkProgramObjectFileName _ = fail' "wasn't a Program"
+
+checkProgramModulesUsed :: Source -> Result
+checkProgramModulesUsed p@(Program{}) = assertEquals ["module1", "module2"] $ programModulesUsed p
+checkProgramModulesUsed _ = fail' "wasn't a Program"