From d1400eeb1401dee32729d2752b8ca4a072766068 Mon Sep 17 00:00:00 2001 From: Brad Richardson Date: Wed, 14 Oct 2020 13:51:18 -0500 Subject: Add test for modules a program uses --- bootstrap/unit_test/SourceConstructionTest.hs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'bootstrap/unit_test/SourceConstructionTest.hs') diff --git a/bootstrap/unit_test/SourceConstructionTest.hs b/bootstrap/unit_test/SourceConstructionTest.hs index 24122c5..751d10c 100644 --- a/bootstrap/unit_test/SourceConstructionTest.hs +++ b/bootstrap/unit_test/SourceConstructionTest.hs @@ -31,12 +31,15 @@ test = return $ givenInput , then' "its object file name is the 'flattened' path of the source file with '.o' appended" checkProgramObjectFileName + , then' "it knows what modules it uses directly" checkProgramModulesUsed ] ] exampleProgram :: RawSource exampleProgram = RawSource programSourceFileName' $ unlines [ "program some_program" + , " use module1" + , " USE MODULE2" , " implicit none" , " print *, \"Hello, World!\"" , "end program" @@ -59,3 +62,7 @@ checkProgramObjectFileName p@(Program{}) = assertEquals ("." "some_file_somewhere.f90.o") $ (programObjectFileName p) "." checkProgramObjectFileName _ = fail' "wasn't a Program" + +checkProgramModulesUsed :: Source -> Result +checkProgramModulesUsed p@(Program{}) = assertEquals ["module1", "module2"] $ programModulesUsed p +checkProgramModulesUsed _ = fail' "wasn't a Program" -- cgit v1.2.3