diff options
author | Brad Richardson <everythingfunctional@protonmail.com> | 2020-10-20 11:13:07 -0500 |
---|---|---|
committer | Brad Richardson <everythingfunctional@protonmail.com> | 2020-10-20 11:13:07 -0500 |
commit | 078f4ca5af387ef39e331f2eb2d7f0df5ce6d720 (patch) | |
tree | 8e6c38b6d9885187c9d89b8734ba7c9c168b50ed | |
parent | cfb8b07fcb102573b70f37de9421e14d1300ac58 (diff) | |
download | fpm-078f4ca5af387ef39e331f2eb2d7f0df5ce6d720.tar.gz fpm-078f4ca5af387ef39e331f2eb2d7f0df5ce6d720.zip |
Add test for object file of program's compile time info
-rw-r--r-- | bootstrap/src/BuildModel.hs | 5 | ||||
-rw-r--r-- | bootstrap/unit_test/ProgramToCompileInfoTest.hs | 9 |
2 files changed, 12 insertions, 2 deletions
diff --git a/bootstrap/src/BuildModel.hs b/bootstrap/src/BuildModel.hs index 9bc6b48..86dbeab 100644 --- a/bootstrap/src/BuildModel.hs +++ b/bootstrap/src/BuildModel.hs @@ -60,6 +60,7 @@ data Source = data CompileTimeInfo = CompileTimeInfo { compileTimeInfoSourceFileName :: FilePath + , compileTimeInfoObjectFileProduced :: FilePath } processRawSource :: RawSource -> Source @@ -93,7 +94,9 @@ processRawSource rawSource = constructCompileTimeInfo :: Source -> [Source] -> FilePath -> CompileTimeInfo constructCompileTimeInfo program@(Program{}) otherSources buildDirectory = CompileTimeInfo - { compileTimeInfoSourceFileName = programSourceFileName program + { compileTimeInfoSourceFileName = programSourceFileName program + , compileTimeInfoObjectFileProduced = (programObjectFileName program) + buildDirectory } constructCompileTimeInfo _ otherSources buildDirectory = undefined diff --git a/bootstrap/unit_test/ProgramToCompileInfoTest.hs b/bootstrap/unit_test/ProgramToCompileInfoTest.hs index b855c66..ca1f228 100644 --- a/bootstrap/unit_test/ProgramToCompileInfoTest.hs +++ b/bootstrap/unit_test/ProgramToCompileInfoTest.hs @@ -23,7 +23,9 @@ test = return $ givenInput [ whenTransformed "its compileTimeInfo is determined" doCompileTimeTransformation - [then' "it still knows the original source file" checkSourceFileName] + [ then' "it still knows the original source file" checkSourceFileName + , then' "it knows what object file will be produced" checkObjectFileName + ] ] exampleProgram :: Source @@ -46,3 +48,8 @@ doCompileTimeTransformation (programSource, otherSources) = checkSourceFileName :: CompileTimeInfo -> Result checkSourceFileName cti = assertEquals programSourceFileName' (compileTimeInfoSourceFileName cti) + +checkObjectFileName :: CompileTimeInfo -> Result +checkObjectFileName cti = assertEquals + ("build_dir" </> "some_file_somewhere.f90.o") + (compileTimeInfoObjectFileProduced cti) |