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