1module Tests.Compiler (compilerTests)
4import Data.Functor ((<$>))
5import Data.Traversable (traverse)
6import System.FilePath.Find (find, (==?), extension)
8import Test.Framework.Providers.HUnit (testCase)
9import Test.HUnit ((@=?), Assertion)
11import Elm.Internal.Utils as Elm
14compilerTests = buildTest $ do
15 goods <- getElms "tests/data/good" >>= mkTests True
16 bads <- getElms "tests/data/bad" >>= mkTests False
18 return $ testGroup "Compile Tests"
20 testGroup "Good Tests" goods
21 , testGroup "Bad Tests" bads
24 where getElms :: FilePath -> IO [FilePath]
25 getElms = find (return True) (extension ==? ".elm")
27 mkTests :: Bool -> [FilePath] -> IO [Test]
28 mkTests b = traverse setupTest
29 where setupTest f = testCase f . mkCompileTest b <$> readFile f
31mkCompileTest :: Bool -- ^ Expect success?
32 -> String -- ^ File Contents
34mkCompileTest succ modul = noCompileErr @=? succ
35 where noCompileErr = either (const False) (const True) . Elm.compile $ modul
36 expectation = "Compile " ++ if succ then "Success" else "Error"
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