@@ -4,6 +4,8 @@ module Test.Compiler (compilerTests) where
5import Control.Exception (try, IOException)
5import Control.Exception (try, IOException)
7+import qualified Data.Text.Lazy as Text
8+import qualified Data.Text.Lazy.IO as Text
7import qualified Data.Map as Map
9import qualified Data.Map as Map
8import Data.Maybe (isJust)
10import Data.Maybe (isJust)
@@ -94,7 +96,7 @@ buildCoreInterface members =
94 aliases = Map.empty
96 aliases = Map.empty
95 fixities = []
97 fixities = []
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
100compileString :: FilePath -> String -> Either String Compiler.Result
102compileString :: FilePath -> String -> Either String Compiler.Result
@@ -102,7 +104,7 @@ compileString filePath source =
102 let dependentModuleNames =
104 let dependentModuleNames =
103 Map.keys essentialInterfaces
105 Map.keys essentialInterfaces
104 context =
106 context =
105− Compiler.Context Package.coreName False dependentModuleNames
107+ Compiler.Context Package.core False dependentModuleNames
106 (dealiaser, _warnings, result) =
108 (dealiaser, _warnings, result) =
107 Compiler.compile context source essentialInterfaces
109 Compiler.compile context source essentialInterfaces
108 formatErrors errors =
110 formatErrors errors =
@@ -162,8 +164,8 @@ doWriteNewExpectedTest expectedJsDir filePath =
162 -- Force the evaluation of `js` before `writeFile`
164 -- Force the evaluation of `js` before `writeFile`
163 -- so that if an error is raised we do not unintentionally write an empty file.
165 -- so that if an error is raised we do not unintentionally write an empty file.
164 -- NB: `js` can be an empty string in the case of NoExpressions.elm
166 -- NB: `js` can be an empty string in the case of NoExpressions.elm
165− assertBool "" (length js >= 0)
167+ assertBool "" (Text.length js >= 0)
166− writeFile expectedFilePath js
168+ Text.writeFile expectedFilePath js
167 assertFailure ("Wrote new expected js: " ++ expectedFilePath)
169 assertFailure ("Wrote new expected js: " ++ expectedFilePath)
@@ -210,7 +212,7 @@ matchesExpected :: String -> Either String Compiler.Result -> Assertion
210matchesExpected expectedJs result =
212matchesExpected expectedJs result =
211 case result of
213 case result of
212 Right (Compiler.Result _ _ js) ->
214 Right (Compiler.Result _ _ js) ->
213− assertEqual matchFailureMessage expectedJs js
215+ assertEqual matchFailureMessage (Text.pack expectedJs) js
215 Left errorMessages ->
217 Left errorMessages ->
216 assertFailure $ "Compile failed:\n" ++ errorMessages
218 assertFailure $ "Compile failed:\n" ++ errorMessages