aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/unit_test/ModuleSourceConstructionTest.hs
diff options
context:
space:
mode:
Diffstat (limited to 'bootstrap/unit_test/ModuleSourceConstructionTest.hs')
-rw-r--r--bootstrap/unit_test/ModuleSourceConstructionTest.hs10
1 files changed, 8 insertions, 2 deletions
diff --git a/bootstrap/unit_test/ModuleSourceConstructionTest.hs b/bootstrap/unit_test/ModuleSourceConstructionTest.hs
index fd69844..20bc011 100644
--- a/bootstrap/unit_test/ModuleSourceConstructionTest.hs
+++ b/bootstrap/unit_test/ModuleSourceConstructionTest.hs
@@ -31,12 +31,13 @@ test = return $ givenInput
, then'
"its object file name is the 'flattened' path of the source file with '.o' appeneded"
checkModuleObjectFileName
+ , then' "it knows what modules it uses directly" checkModuleModulesUsed
]
]
exampleModule :: RawSource
-exampleModule =
- RawSource moduleSourceFileName' $ unlines ["module some_module", "end module"]
+exampleModule = RawSource moduleSourceFileName' $ unlines
+ ["module some_module", " use module1", "USE MODULE2", "end module"]
moduleSourceFileName' :: String
moduleSourceFileName' = "some" </> "file" </> "somewhere.f90"
@@ -55,3 +56,8 @@ checkModuleObjectFileName m@(Module{}) =
assertEquals ("." </> "some_file_somewhere.f90.o")
$ (moduleObjectFileName m) "."
checkModuleObjectFileName _ = fail' "wasn't a Module"
+
+checkModuleModulesUsed :: Source -> Result
+checkModuleModulesUsed m@(Module{}) =
+ assertEquals ["module1", "module2"] $ moduleModulesUsed m
+checkModuleModulesUsed _ = fail' "wasn't a Module"