@@ -182,27 +182,26 @@ accessorsTests = testGroup "accessors"
182182 ]
183183
184184#ifdef MIN_VERSION_tree_diff
185+ -- Here, we test the unmerged internal representation
185186accessorsGoldenTest :: FilePath -> TestTree
186- accessorsGoldenTest fp =
187- let go label f = ediffGolden goldenTest label exprFile $ do
188- contents <- BS. readFile input
189- let res = withSource (PCabalFile (fp, contents)) $ parseGenericPackageDescription contents
190- let (_, x) = runParseResult res
191- case x of
192- Right gpd -> pure (toExpr $ f gpd)
193- Left (_, errs) -> fail $ unlines $ " ERROR" : map (showPErrorWithSource . fmap renderCabalFileSource) (NE. toList errs)
194- where
195- input = " tests" </> " ParserTests" </> " accessors" </> fp
196- exprFile = replaceExtension input (label <> " .expr" )
197- in testGroup " accessors"
198- [ go " gpdCommonStanzas" gpdCommonStanzas
199- , go " condLibraryUnmerged" condLibraryUnmerged
200- , go " condSubLibrariesUnmerged" condSubLibrariesUnmerged
201- , go " condForeignLibsUnmerged" condForeignLibsUnmerged
202- , go " condExecutablesUnmerged" condExecutablesUnmerged
203- , go " condTestSuitesUnmerged" condTestSuitesUnmerged
204- , go " condBenchmarksUnmerged" condBenchmarksUnmerged
205- ]
187+ accessorsGoldenTest fp = ediffGolden goldenTest " expr" exprFile $ do
188+ contents <- BS. readFile input
189+ let res = withSource (PCabalFile (fp, contents)) $ parseGenericPackageDescription contents
190+ let (_, x) = runParseResult res
191+ case x of
192+ Right gpd -> pure $ toExpr
193+ ( gpdCommonStanzas gpd
194+ , condLibraryUnmerged gpd
195+ , condSubLibrariesUnmerged gpd
196+ , condForeignLibsUnmerged gpd
197+ , condExecutablesUnmerged gpd
198+ , condTestSuitesUnmerged gpd
199+ , condBenchmarksUnmerged gpd
200+ )
201+ Left (_, errs) -> fail $ unlines $ " ERROR" : map (showPErrorWithSource . fmap renderCabalFileSource) (NE. toList errs)
202+ where
203+ input = " tests" </> " ParserTests" </> " accessors" </> fp
204+ exprFile = replaceExtension input " expr"
206205#endif
207206
208207-------------------------------------------------------------------------------
0 commit comments