on master help sign in
Update test runner for new compiler APIs
commit403c74e700f0f8535297d5975ffef55f785b99c0 authorEvan Czaplicki <info@elm-lang.org> dateMon 18 Apr 2016, 12:22 (11 years ago) parentc3b6f4f
1 file changed+7−5
tests/Test/Compiler.hs+7−5
tests/Test/Compiler.hs+7−5
@@ -4,6 +4,8 @@ module Test.Compiler (compilerTests) where
44
55import Control.Exception (try, IOException)
66
7+import qualified Data.Text.Lazy as Text
8+import qualified Data.Text.Lazy.IO as Text
79import qualified Data.Map as Map
810import Data.Maybe (isJust)
911
@@ -94,7 +96,7 @@ buildCoreInterface members =
9496 aliases = Map.empty
9597 fixities = []
9698 in
97− Module.Interface Compiler.version Package.coreName exports types imports adts aliases fixities
99+ Module.Interface Compiler.version Package.core exports imports types adts aliases fixities
98100
99101
100102compileString :: FilePath -> String -> Either String Compiler.Result
@@ -102,7 +104,7 @@ compileString filePath source =
102104 let dependentModuleNames =
103105 Map.keys essentialInterfaces
104106 context =
105− Compiler.Context Package.coreName False dependentModuleNames
107+ Compiler.Context Package.core False dependentModuleNames
106108 (dealiaser, _warnings, result) =
107109 Compiler.compile context source essentialInterfaces
108110 formatErrors errors =
@@ -162,8 +164,8 @@ doWriteNewExpectedTest expectedJsDir filePath =
162164 -- Force the evaluation of `js` before `writeFile`
163165 -- so that if an error is raised we do not unintentionally write an empty file.
164166 -- NB: `js` can be an empty string in the case of NoExpressions.elm
165− assertBool "" (length js >= 0)
166− writeFile expectedFilePath js
167+ assertBool "" (Text.length js >= 0)
168+ Text.writeFile expectedFilePath js
167169 assertFailure ("Wrote new expected js: " ++ expectedFilePath)
168170
169171 _ ->
@@ -210,7 +212,7 @@ matchesExpected :: String -> Either String Compiler.Result -> Assertion
210212matchesExpected expectedJs result =
211213 case result of
212214 Right (Compiler.Result _ _ js) ->
213− assertEqual matchFailureMessage expectedJs js
215+ assertEqual matchFailureMessage (Text.pack expectedJs) js
214216
215217 Left errorMessages ->
216218 assertFailure $ "Compile failed:\n" ++ errorMessages