aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/unit_test/ProgramToCompileInfoTest.hs
diff options
context:
space:
mode:
Diffstat (limited to 'bootstrap/unit_test/ProgramToCompileInfoTest.hs')
-rw-r--r--bootstrap/unit_test/ProgramToCompileInfoTest.hs15
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)