aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/unit_test/ProgramSourceConstructionTest.hs
diff options
context:
space:
mode:
authorSebastian Ehlert <28669218+awvwgk@users.noreply.github.com>2021-03-31 16:13:58 +0200
committerGitHub <noreply@github.com>2021-03-31 16:13:58 +0200
commitd9dc9f2ae5f196c15a7d35cddabc805c40ff86ce (patch)
tree6f61952c630b023edec391daae2747063703d489 /bootstrap/unit_test/ProgramSourceConstructionTest.hs
parent5422ec57f4081bf2225f5dde5cc07999bf8010f9 (diff)
downloadfpm-d9dc9f2ae5f196c15a7d35cddabc805c40ff86ce.tar.gz
fpm-d9dc9f2ae5f196c15a7d35cddabc805c40ff86ce.zip
Phase out Haskell fpm (#420)
- remove bootstrap directory from repository - remove stack-build from CI workflow - move Fortran fpm to project root - adjust install script and bootstrap instructions
Diffstat (limited to 'bootstrap/unit_test/ProgramSourceConstructionTest.hs')
-rw-r--r--bootstrap/unit_test/ProgramSourceConstructionTest.hs69
1 files changed, 0 insertions, 69 deletions
diff --git a/bootstrap/unit_test/ProgramSourceConstructionTest.hs b/bootstrap/unit_test/ProgramSourceConstructionTest.hs
deleted file mode 100644
index 6369965..0000000
--- a/bootstrap/unit_test/ProgramSourceConstructionTest.hs
+++ /dev/null
@@ -1,69 +0,0 @@
-module ProgramSourceConstructionTest
- ( test
- )
-where
-
-import BuildModel ( RawSource(..)
- , Source(..)
- , processRawSource
- )
-import Hedge ( Result
- , Test
- , assertEquals
- , assertThat
- , fail'
- , givenInput
- , then'
- , whenTransformed
- )
-import System.FilePath ( (</>) )
-
-test :: IO (Test ())
-test = return $ givenInput
- "a program"
- exampleProgram
- [ whenTransformed
- "processed to a source"
- processRawSource
- [ then' "it is a Program" checkIsProgram
- , then' "its source file name is the same as the original"
- checkProgramSourceFileName
- , 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"
- ]
-
-programSourceFileName' :: String
-programSourceFileName' = "some" </> "file" </> "somewhere.f90"
-
-checkIsProgram :: Source -> Result
-checkIsProgram Program{} = assertThat True
-checkIsProgram _ = assertThat False
-
-checkProgramSourceFileName :: Source -> Result
-checkProgramSourceFileName p@(Program{}) =
- assertEquals programSourceFileName' $ programSourceFileName p
-checkProgramSourceFileName _ = fail' "wasn't a Program"
-
-checkProgramObjectFileName :: Source -> Result
-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"