aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/unit_test
diff options
context:
space:
mode:
authorBrad Richardson <everythingfunctional@protonmail.com>2020-10-15 11:52:11 -0500
committerBrad Richardson <everythingfunctional@protonmail.com>2020-10-15 11:52:11 -0500
commitb927218b5690fe7cd4080af53831311d59db6987 (patch)
treeef37c5be8d5266fae3717a086d7f7f5279453b5b /bootstrap/unit_test
parent29be28f5e7de2d8a3fa405d61ec63e8c8d7ea809 (diff)
downloadfpm-b927218b5690fe7cd4080af53831311d59db6987.tar.gz
fpm-b927218b5690fe7cd4080af53831311d59db6987.zip
Add test for submodule source file name
Diffstat (limited to 'bootstrap/unit_test')
-rw-r--r--bootstrap/unit_test/SubmoduleSourceConstructionTest.hs17
1 files changed, 14 insertions, 3 deletions
diff --git a/bootstrap/unit_test/SubmoduleSourceConstructionTest.hs b/bootstrap/unit_test/SubmoduleSourceConstructionTest.hs
index 96492fb..6158939 100644
--- a/bootstrap/unit_test/SubmoduleSourceConstructionTest.hs
+++ b/bootstrap/unit_test/SubmoduleSourceConstructionTest.hs
@@ -9,7 +9,9 @@ import BuildModel ( RawSource(..)
)
import Hedge ( Result
, Test
+ , assertEquals
, assertThat
+ , fail'
, givenInput
, then'
, whenTransformed
@@ -20,9 +22,13 @@ test :: IO (Test ())
test = return $ givenInput
"a submodule"
exampleSubmodule
- [ whenTransformed "processed to a source"
- processRawSource
- [then' "it is a Submodule" checkIsSubmodule]
+ [ whenTransformed
+ "processed to a source"
+ processRawSource
+ [ then' "it is a Submodule" checkIsSubmodule
+ , then' "its source file name is the same as the original"
+ checkSubmoduleSourceFileName
+ ]
]
exampleSubmodule :: RawSource
@@ -35,3 +41,8 @@ submoduleSourceFileName' = "some" </> "file" </> "somewhere.f90"
checkIsSubmodule :: Source -> Result
checkIsSubmodule Submodule{} = assertThat True
checkIsSubmodule _ = assertThat False
+
+checkSubmoduleSourceFileName :: Source -> Result
+checkSubmoduleSourceFileName s@(Submodule{}) =
+ assertEquals submoduleSourceFileName' $ submoduleSourceFileName s
+checkSubmoduleSourceFileName _ = fail' "wasn't a Submodule"