diff options
author | Brad Richardson <everythingfunctional@protonmail.com> | 2020-10-15 10:13:35 -0500 |
---|---|---|
committer | Brad Richardson <everythingfunctional@protonmail.com> | 2020-10-15 10:13:35 -0500 |
commit | 4b062f1f275d568099d6ebf4c1c687c50d039b84 (patch) | |
tree | b71c1bd67789fc98dd5348baa426541d293a7cb6 /bootstrap/unit_test | |
parent | 06798e8f263ad5a95df00469740945090ff66977 (diff) | |
download | fpm-4b062f1f275d568099d6ebf4c1c687c50d039b84.tar.gz fpm-4b062f1f275d568099d6ebf4c1c687c50d039b84.zip |
Add constructor for Module Source
Diffstat (limited to 'bootstrap/unit_test')
-rw-r--r-- | bootstrap/unit_test/ModuleSourceConstructionTest.hs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/bootstrap/unit_test/ModuleSourceConstructionTest.hs b/bootstrap/unit_test/ModuleSourceConstructionTest.hs new file mode 100644 index 0000000..cc6d079 --- /dev/null +++ b/bootstrap/unit_test/ModuleSourceConstructionTest.hs @@ -0,0 +1,37 @@ +module ModuleSourceConstructionTest + ( test + ) +where + +import BuildModel ( RawSource(..) + , Source(..) + , processRawSource + ) +import Hedge ( Result + , Test + , assertThat + , givenInput + , then' + , whenTransformed + ) +import System.FilePath ( (</>) ) + +test :: IO (Test ()) +test = return $ givenInput + "a module" + exampleModule + [ whenTransformed "processed to a source" + processRawSource + [then' "it is a Module" checkIsModule] + ] + +exampleModule :: RawSource +exampleModule = + RawSource moduleSourceFileName' $ unlines ["module some_module", "end module"] + +moduleSourceFileName' :: String +moduleSourceFileName' = "some" </> "file" </> "somewhere.f90" + +checkIsModule :: Source -> Result +checkIsModule Module{} = assertThat True +checkIsModule _ = assertThat False |