2module Test.Compiler (compilerTests) where
4import qualified Data.Map as Map
5import Data.Traversable (traverse)
7import System.FilePath ((</>))
8import System.FilePath.Find (find, (==?), extension)
11import Test.Framework.Providers.HUnit (testCase)
12import Test.HUnit (Assertion, assertFailure, assertBool)
14import qualified Elm.Compiler as Compiler
15import qualified Elm.Compiler.Module as Module
21 goods <- testIf isSuccess =<< getElms "good"
22 bads <- testIf isFailure =<< getElms "bad"
24 testGroup "Compile Tests"
25 [ testGroup "Good Tests" goods
26 , testGroup "Bad Tests" bads
32getElms :: FilePath -> IO [FilePath]
36 (extension ==? ".elm")
37 (testsDir </> filePath)
42 "tests" </> "compiler" </> "test-files"
48 :: (Either String (Module.Interface, String) -> Assertion)
51testIf handleResult filePaths =
52 traverse setupTest filePaths
55 do source <- readFile filePath
56 let result = Compiler.compile "elm-lang" "core" source Map.empty
57 return (testCase filePath (handleResult result))
62isSuccess :: Either String a -> Assertion
65 Right _ -> assertBool "" True
66 Left msg -> assertFailure msg
69isFailure :: Either a b -> Assertion
72 Left _ -> assertFailure "Compilation succeeded but should have failed"
73 Right _ -> assertBool "" True
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list