aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/unit_test/SourceConstructionTest.hs
diff options
context:
space:
mode:
authorBrad Richardson <everythingfunctional@protonmail.com>2020-10-14 13:51:18 -0500
committerBrad Richardson <everythingfunctional@protonmail.com>2020-10-14 13:51:18 -0500
commitd1400eeb1401dee32729d2752b8ca4a072766068 (patch)
treeaacb87a51a3e64277401e10756897994afd0c408 /bootstrap/unit_test/SourceConstructionTest.hs
parent0a0b3ec5a27d198832023ef5822087beb1ed860f (diff)
downloadfpm-d1400eeb1401dee32729d2752b8ca4a072766068.tar.gz
fpm-d1400eeb1401dee32729d2752b8ca4a072766068.zip
Add test for modules a program uses
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"