diff options
author | Brad Richardson <everythingfunctional@protonmail.com> | 2020-10-20 11:27:30 -0500 |
---|---|---|
committer | Brad Richardson <everythingfunctional@protonmail.com> | 2020-10-20 11:27:30 -0500 |
commit | 5db397ddca9ffa5558fb80ebfad73332f8c52cd6 (patch) | |
tree | a3a275c6062e4949d6fa29328d0e1569ca1a47c9 /bootstrap/unit_test | |
parent | 20ee2333cd86909e21ca5bd88f3d7166e1941c92 (diff) | |
download | fpm-5db397ddca9ffa5558fb80ebfad73332f8c52cd6.tar.gz fpm-5db397ddca9ffa5558fb80ebfad73332f8c52cd6.zip |
Add test for program's direct dependencies
Diffstat (limited to 'bootstrap/unit_test')
-rw-r--r-- | bootstrap/unit_test/ProgramToCompileInfoTest.hs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/bootstrap/unit_test/ProgramToCompileInfoTest.hs b/bootstrap/unit_test/ProgramToCompileInfoTest.hs index e16ab22..20d7131 100644 --- a/bootstrap/unit_test/ProgramToCompileInfoTest.hs +++ b/bootstrap/unit_test/ProgramToCompileInfoTest.hs @@ -20,13 +20,15 @@ import System.FilePath ( (</>) ) test :: IO (Test ()) test = return $ givenInput "a program and other sources" - (exampleProgram, exampleSources) + (exampleProgram, availableModules) [ whenTransformed "its compileTimeInfo is determined" doCompileTimeTransformation [ then' "it still knows the original source file" checkSourceFileName , then' "it knows what object file will be produced" checkObjectFileName , then' "there are no other files produced" checkOtherFilesProduced + , then' "the direct dependencies are only the available modules used" + checkDirectDependencies ] ] @@ -40,10 +42,10 @@ exampleProgram = Program programSourceFileName' :: String programSourceFileName' = "some" </> "file" </> "somewhere.f90" -exampleSources :: [Source] -exampleSources = [] +availableModules :: [String] +availableModules = ["module1", "module3"] -doCompileTimeTransformation :: (Source, [Source]) -> CompileTimeInfo +doCompileTimeTransformation :: (Source, [String]) -> CompileTimeInfo doCompileTimeTransformation (programSource, otherSources) = constructCompileTimeInfo programSource otherSources "build_dir" @@ -59,3 +61,8 @@ checkObjectFileName cti = assertEquals checkOtherFilesProduced :: CompileTimeInfo -> Result checkOtherFilesProduced cti = assertEmpty (compileTimeInfoOtherFilesProduced cti) + +checkDirectDependencies :: CompileTimeInfo -> Result +checkDirectDependencies cti = assertEquals + ["build_dir" </> "module1.mod", "build_dir" </> "module3.mod"] + (compileTimeInfoDirectDependencies cti) |