diff options
-rw-r--r-- | bootstrap/src/BuildModel.hs | 5 | ||||
-rw-r--r-- | bootstrap/unit_test/SubmoduleSourceConstructionTest.hs | 9 |
2 files changed, 13 insertions, 1 deletions
diff --git a/bootstrap/src/BuildModel.hs b/bootstrap/src/BuildModel.hs index 9a9866a..70046d7 100644 --- a/bootstrap/src/BuildModel.hs +++ b/bootstrap/src/BuildModel.hs @@ -53,6 +53,7 @@ data Source = } | Submodule { submoduleSourceFileName :: FilePath + , submoduleObjectFileName :: FilePath -> FilePath } processRawSource :: RawSource -> Source @@ -76,7 +77,9 @@ processRawSource rawSource = , moduleProducesSmod = hasModuleSubprogramDeclaration parsedContents } else if hasSubmoduleDeclaration parsedContents - then Submodule { submoduleSourceFileName = sourceFileName } + then Submodule { submoduleSourceFileName = sourceFileName + , submoduleObjectFileName = objectFileName + } else undefined pathSeparatorsToUnderscores :: FilePath -> FilePath diff --git a/bootstrap/unit_test/SubmoduleSourceConstructionTest.hs b/bootstrap/unit_test/SubmoduleSourceConstructionTest.hs index 6158939..5295a97 100644 --- a/bootstrap/unit_test/SubmoduleSourceConstructionTest.hs +++ b/bootstrap/unit_test/SubmoduleSourceConstructionTest.hs @@ -28,6 +28,9 @@ test = return $ givenInput [ then' "it is a Submodule" checkIsSubmodule , then' "its source file name is the same as the original" checkSubmoduleSourceFileName + , then' + "its object file name is the 'flattened' path of the source file with '.o' appeneded" + checkSubmoduleObjectFileName ] ] @@ -46,3 +49,9 @@ checkSubmoduleSourceFileName :: Source -> Result checkSubmoduleSourceFileName s@(Submodule{}) = assertEquals submoduleSourceFileName' $ submoduleSourceFileName s checkSubmoduleSourceFileName _ = fail' "wasn't a Submodule" + +checkSubmoduleObjectFileName :: Source -> Result +checkSubmoduleObjectFileName s@(Submodule{}) = + assertEquals ("." </> "some_file_somewhere.f90.o") + $ (submoduleObjectFileName s) "." +checkSubmoduleObjectFileName _ = fail' "wasn't a Submodule" |