diff options
author | Brad Richardson <everythingfunctional@protonmail.com> | 2020-10-15 10:22:43 -0500 |
---|---|---|
committer | Brad Richardson <everythingfunctional@protonmail.com> | 2020-10-15 10:22:43 -0500 |
commit | c2638957dd9aca90831e0b434fec9ccc05c77acc (patch) | |
tree | c32a8315831b148687acd9cc15f8cce2339994db /bootstrap/unit_test/ModuleSourceConstructionTest.hs | |
parent | 4b062f1f275d568099d6ebf4c1c687c50d039b84 (diff) | |
download | fpm-c2638957dd9aca90831e0b434fec9ccc05c77acc.tar.gz fpm-c2638957dd9aca90831e0b434fec9ccc05c77acc.zip |
Add test for module source file name
Diffstat (limited to 'bootstrap/unit_test/ModuleSourceConstructionTest.hs')
-rw-r--r-- | bootstrap/unit_test/ModuleSourceConstructionTest.hs | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/bootstrap/unit_test/ModuleSourceConstructionTest.hs b/bootstrap/unit_test/ModuleSourceConstructionTest.hs index cc6d079..fae7c89 100644 --- a/bootstrap/unit_test/ModuleSourceConstructionTest.hs +++ b/bootstrap/unit_test/ModuleSourceConstructionTest.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 module" exampleModule - [ whenTransformed "processed to a source" - processRawSource - [then' "it is a Module" checkIsModule] + [ whenTransformed + "processed to a source" + processRawSource + [ then' "it is a Module" checkIsModule + , then' "its source file name is the same as the original" + checkModuleSourceFileName + ] ] exampleModule :: RawSource @@ -35,3 +41,8 @@ moduleSourceFileName' = "some" </> "file" </> "somewhere.f90" checkIsModule :: Source -> Result checkIsModule Module{} = assertThat True checkIsModule _ = assertThat False + +checkModuleSourceFileName :: Source -> Result +checkModuleSourceFileName m@(Module{}) = + assertEquals moduleSourceFileName' $ moduleSourceFileName m +checkModuleSourceFileName _ = fail' "wasn't a Module" |