From 29be28f5e7de2d8a3fa405d61ec63e8c8d7ea809 Mon Sep 17 00:00:00 2001 From: Brad Richardson Date: Thu, 15 Oct 2020 11:43:20 -0500 Subject: Add constructor for Submodule Source --- .../unit_test/SubmoduleSourceConstructionTest.hs | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 bootstrap/unit_test/SubmoduleSourceConstructionTest.hs (limited to 'bootstrap/unit_test') diff --git a/bootstrap/unit_test/SubmoduleSourceConstructionTest.hs b/bootstrap/unit_test/SubmoduleSourceConstructionTest.hs new file mode 100644 index 0000000..96492fb --- /dev/null +++ b/bootstrap/unit_test/SubmoduleSourceConstructionTest.hs @@ -0,0 +1,37 @@ +module SubmoduleSourceConstructionTest + ( 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 submodule" + exampleSubmodule + [ whenTransformed "processed to a source" + processRawSource + [then' "it is a Submodule" checkIsSubmodule] + ] + +exampleSubmodule :: RawSource +exampleSubmodule = RawSource submoduleSourceFileName' + $ unlines ["submodule (some_module:parent) child", "end submodule"] + +submoduleSourceFileName' :: String +submoduleSourceFileName' = "some" "file" "somewhere.f90" + +checkIsSubmodule :: Source -> Result +checkIsSubmodule Submodule{} = assertThat True +checkIsSubmodule _ = assertThat False -- cgit v1.2.3