aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/unit_test
diff options
context:
space:
mode:
authorBrad Richardson <everythingfunctional@protonmail.com>2020-10-15 11:07:47 -0500
committerBrad Richardson <everythingfunctional@protonmail.com>2020-10-15 11:07:47 -0500
commitbd27ae8161860f9a40c3953e20001af1f450d5f4 (patch)
tree265e59cd5a53f263f1427bf7b7950faa945f0dee /bootstrap/unit_test
parent311c695aa30f63fc1be0ef8b8c56ca372e01a31e (diff)
downloadfpm-bd27ae8161860f9a40c3953e20001af1f450d5f4.tar.gz
fpm-bd27ae8161860f9a40c3953e20001af1f450d5f4.zip
Add test for whether a module produces a .smod file
Diffstat (limited to 'bootstrap/unit_test')
-rw-r--r--bootstrap/unit_test/ModuleSourceConstructionTest.hs17
1 files changed, 16 insertions, 1 deletions
diff --git a/bootstrap/unit_test/ModuleSourceConstructionTest.hs b/bootstrap/unit_test/ModuleSourceConstructionTest.hs
index 26f08b2..b98e9d3 100644
--- a/bootstrap/unit_test/ModuleSourceConstructionTest.hs
+++ b/bootstrap/unit_test/ModuleSourceConstructionTest.hs
@@ -33,12 +33,23 @@ test = return $ givenInput
checkModuleObjectFileName
, then' "it knows what modules it uses directly" checkModuleModulesUsed
, then' "it knows its name" checkModuleName
+ , then' "it can tell that it will produce a '.smod' file" checkSmod
]
]
exampleModule :: RawSource
exampleModule = RawSource moduleSourceFileName' $ unlines
- ["module some_module", " use module1", "USE MODULE2", "end module"]
+ [ "module some_module"
+ , " use module1"
+ , " USE MODULE2"
+ , " implicit none"
+ , " interface"
+ , " pure module function some_func()"
+ , " integer :: some_func"
+ , " end function"
+ , " end interface"
+ , "end module"
+ ]
moduleSourceFileName' :: String
moduleSourceFileName' = "some" </> "file" </> "somewhere.f90"
@@ -66,3 +77,7 @@ checkModuleModulesUsed _ = fail' "wasn't a Module"
checkModuleName :: Source -> Result
checkModuleName m@(Module{}) = assertEquals "some_module" $ moduleName m
checkModuleName _ = fail' "wasn't a Module"
+
+checkSmod :: Source -> Result
+checkSmod m@(Module{}) = assertThat $ moduleProducesSmod m
+checkSmod _ = fail' "wasn't a Module"