Skip to content

Commit 750b2b3

Browse files
committed
Fix new compiiler nesting warning
1 parent 6ac5149 commit 750b2b3

File tree

1 file changed

+51
-51
lines changed

1 file changed

+51
-51
lines changed

test/Lamdera/Evergreen/TestMigrationGenerator.hs

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -122,57 +122,57 @@ testExamples = withTestEnv $ do
122122

123123
testFiles & mapM (\folder -> do
124124
scope folder $ do
125-
io $ putStrLn $ "testing: " <> show folder
126-
let
127-
oldVersion = 1
128-
newVersion = 2
129-
filenameOld = folder </> "Old.elm"
130-
filenameNew = folder </> "New.elm"
131-
filenameExpected = folder </> "Expected.elm"
132-
filenameActual = folder </> "Actual.elm"
133-
typeName = "Target"
134-
scenarioName = FP.takeBaseName folder
135-
moduleNameOld = N.fromChars $ scenarioName <> ".Old"
136-
moduleNameNew = N.fromChars $ scenarioName <> ".New"
137-
moduleNameActual = scenarioName <> ".Actual"
138-
moduleNameExpected = scenarioName <> ".Expected"
139-
moduleOld = ModuleName.Canonical (Pkg.Name "author" "project") moduleNameOld
140-
moduleNew = ModuleName.Canonical (Pkg.Name "author" "project") moduleNameNew
141-
142-
interfacesE <- io $ Lamdera.Make.compileToInterfaces project filenameOld [filenameNew] `catch` catchTestException filenameNew
143-
144-
case interfacesE of
145-
Left err -> io $ Lamdera.Progress.throw $ Reporting.Exit.makeToReport err
146-
-- "🏗 error, please compile manually:\n\ncd " <> project <> " && lamdera make " <> filename <> "\n\n"
147-
Right interfaces -> do
148-
let
149-
typeOldM = Helpers.findDef moduleOld typeName interfaces
150-
typeNewM = Helpers.findDef moduleNew typeName interfaces
151-
152-
expectationM <- io $ readUtf8Text (project </> filenameExpected)
153-
154-
case (typeOldM, typeNewM, expectationM) of
155-
(Just typeDefOld, Just typeDefNew, Just expectation) -> do
156-
let
157-
migrationNested = MigrationGenerator.migrateTypeDef typeDefOld typeDefNew oldVersion newVersion interfaces [] [] Set.empty
158-
(Helpers.MigrationNested migration migrationImports migrationDefs) = migrationNested
159-
migrationDefM = migrationDefs & Map.lookup (moduleNew, typeName) & fmap Helpers.migrationDef
160-
161-
case migrationDefM of
162-
Just migrationDef -> do
163-
let final = MigrationGenerator.migrationsToFile (stringToText moduleNameActual) oldVersion newVersion [(typeName, (migrationNested { Helpers.migrationFn = "target = " <> migration }))] moduleNew
164-
expected = Ext.ElmFormat.formatOrPassthrough (expectation & T.replace "\\n" "\n" & T.strip)
165-
-- actual = Ext.ElmFormat.formatOrPassthrough (migrationDef & T.replace "\\n" "\n" & T.strip)
166-
actual = Ext.ElmFormat.formatOrPassthrough (final)
167-
_ <- io $ writeUtf8 (project </> filenameActual) actual
168-
expectEqualTextTrimmed (expected & T.replace "Expected exposing (..)" "Actual exposing (..)") actual
169-
pure migrationNested
170-
Nothing ->
171-
pure migrationNested
172-
(_, _, Nothing) -> error $ "Could not find expectation file: " <> filenameExpected
173-
(Nothing, Just typeNew, _) -> error $ "Could not find type `Target` in test: " <> N.toChars moduleNameNew
174-
(Just typeOld, Nothing, _) -> error $ "Could not find type `Target` in test: " <> N.toChars moduleNameOld
175-
(Nothing, Nothing, _) -> error $ "Could not find type `Target` in test: " <> N.toChars moduleNameNew
125+
io $ putStrLn $ "testing: " <> show folder
126+
let
127+
oldVersion = 1
128+
newVersion = 2
129+
filenameOld = folder </> "Old.elm"
130+
filenameNew = folder </> "New.elm"
131+
filenameExpected = folder </> "Expected.elm"
132+
filenameActual = folder </> "Actual.elm"
133+
typeName = "Target"
134+
scenarioName = FP.takeBaseName folder
135+
moduleNameOld = N.fromChars $ scenarioName <> ".Old"
136+
moduleNameNew = N.fromChars $ scenarioName <> ".New"
137+
moduleNameActual = scenarioName <> ".Actual"
138+
moduleNameExpected = scenarioName <> ".Expected"
139+
moduleOld = ModuleName.Canonical (Pkg.Name "author" "project") moduleNameOld
140+
moduleNew = ModuleName.Canonical (Pkg.Name "author" "project") moduleNameNew
141+
142+
interfacesE <- io $ Lamdera.Make.compileToInterfaces project filenameOld [filenameNew] `catch` catchTestException filenameNew
143+
144+
case interfacesE of
145+
Left err -> io $ Lamdera.Progress.throw $ Reporting.Exit.makeToReport err
146+
-- "🏗 error, please compile manually:\n\ncd " <> project <> " && lamdera make " <> filename <> "\n\n"
147+
Right interfaces -> do
148+
let
149+
typeOldM = Helpers.findDef moduleOld typeName interfaces
150+
typeNewM = Helpers.findDef moduleNew typeName interfaces
151+
152+
expectationM <- io $ readUtf8Text (project </> filenameExpected)
153+
154+
case (typeOldM, typeNewM, expectationM) of
155+
(Just typeDefOld, Just typeDefNew, Just expectation) -> do
156+
let
157+
migrationNested = MigrationGenerator.migrateTypeDef typeDefOld typeDefNew oldVersion newVersion interfaces [] [] Set.empty
158+
(Helpers.MigrationNested migration migrationImports migrationDefs) = migrationNested
159+
migrationDefM = migrationDefs & Map.lookup (moduleNew, typeName) & fmap Helpers.migrationDef
160+
161+
case migrationDefM of
162+
Just migrationDef -> do
163+
let final = MigrationGenerator.migrationsToFile (stringToText moduleNameActual) oldVersion newVersion [(typeName, (migrationNested { Helpers.migrationFn = "target = " <> migration }))] moduleNew
164+
expected = Ext.ElmFormat.formatOrPassthrough (expectation & T.replace "\\n" "\n" & T.strip)
165+
-- actual = Ext.ElmFormat.formatOrPassthrough (migrationDef & T.replace "\\n" "\n" & T.strip)
166+
actual = Ext.ElmFormat.formatOrPassthrough (final)
167+
_ <- io $ writeUtf8 (project </> filenameActual) actual
168+
expectEqualTextTrimmed (expected & T.replace "Expected exposing (..)" "Actual exposing (..)") actual
169+
pure migrationNested
170+
Nothing ->
171+
pure migrationNested
172+
(_, _, Nothing) -> error $ "Could not find expectation file: " <> filenameExpected
173+
(Nothing, Just typeNew, _) -> error $ "Could not find type `Target` in test: " <> N.toChars moduleNameNew
174+
(Just typeOld, Nothing, _) -> error $ "Could not find type `Target` in test: " <> N.toChars moduleNameOld
175+
(Nothing, Nothing, _) -> error $ "Could not find type `Target` in test: " <> N.toChars moduleNameNew
176176
)
177177

178178
failures <- io $ readMVar failuresM

0 commit comments

Comments
 (0)