@@ -14,7 +14,6 @@ import Test.HUnit (Assertion, assertFailure, assertBool)
1414import qualified Elm.Compiler as Compiler
1515import qualified Elm.Compiler.Module as Module
1616
17−
1817compilerTests :: Test
1918compilerTests =
2019 buildTest $ do
@@ -45,7 +44,7 @@ testsDir =
4544-- RUN COMPILER
4645
4746testIf
48− :: (Either String (Module.Interface, String) -> Assertion)
47+ :: (([Compiler.Warning], Either [Compiler.Error] (Module.Interface, String)) -> Assertion)
4948 -> [FilePath]
5049 -> IO [Test]
5150testIf handleResult filePaths =
@@ -53,21 +52,21 @@ testIf handleResult filePaths =
5352 where
5453 setupTest filePath =
5554 do source <- readFile filePath
56− let result = Compiler.compile "elm-lang" "core" source Map.empty
55+ let result = Compiler.compile "elm-lang" "core" True source Map.empty
5756 return (testCase filePath (handleResult result))
5857
5958
6059-- CHECK RESULTS
6160
62−isSuccess :: Either String a -> Assertion
63−isSuccess result =
61+isSuccess :: ([Compiler.Warning], Either [Compiler.Error] a) -> Assertion
62+isSuccess (_, result) =
6463 case result of
65− Right _ -> assertBool "" True
66− Left msg -> assertFailure msg
64+ Right _ -> assertBool "" True
65+ Left errors -> assertFailure $ (unlines $ map (Compiler.errorToString "" "") errors)
6766
6867
69−isFailure :: Either a b -> Assertion
70−isFailure result =
68+isFailure :: ([Compiler.Warning], Either a b) -> Assertion
69+isFailure (_, result) =
7170 case result of
7271 Right _ -> assertFailure "Compilation succeeded but should have failed"
73− Left _ -> assertBool "" True
72+ Left _ -> assertBool "" True