From 4b062f1f275d568099d6ebf4c1c687c50d039b84 Mon Sep 17 00:00:00 2001 From: Brad Richardson Date: Thu, 15 Oct 2020 10:13:35 -0500 Subject: Add constructor for Module Source --- .../unit_test/ModuleSourceConstructionTest.hs | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 bootstrap/unit_test/ModuleSourceConstructionTest.hs (limited to 'bootstrap/unit_test/ModuleSourceConstructionTest.hs') 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 -- cgit v1.2.3