Skip to content

Commit

Permalink
Use normalizeWindowsOutput
Browse files Browse the repository at this point in the history
  • Loading branch information
philderbeast committed Jan 6, 2025
1 parent 997f147 commit d80b5ec
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# cabal v2-build
Warning: <ROOT>/else.project, else.project: Unrecognized section '_' on line 3
Warnings found while parsing the project file, else.project:
- dir-else/else.config: Unrecognized section '_' on line 3
# Multiline string marking:
# ^When using configuration from:$
# ^ - else.project$
Expand All @@ -8,3 +9,25 @@ Warning: <ROOT>/else.project, else.project: Unrecognized section '_' on line 3
# ^ - The package location 'no-pkg-here' does not exist.$
# Pseudo multiline string marking:
# ^When using configuration from: - else.project - dir-else/else.config The following errors occurred: - The package location 'no-pkg-here' does not exist.$
# cabal v2-build
Error: [Cabal-7090]
Error parsing project file cabal.project:3:
- Failed to parse 'if(_)' with error:
"<condition>" (line 1, column 1): unexpected SecArgName (Position 1 4) "_"
# cabal v2-build
Error: [Cabal-7090]
Error parsing project file dir-if/if.config:3:
- dir-if/if.config
imported by: if.project
Failed to parse 'if(_)' with error:
"<condition>" (line 1, column 1): unexpected SecArgName (Position 1 4) "_"
# cabal v2-build
Error: [Cabal-7090]
Error parsing project file dir-elif/elif.config:4:
- dir-elif/elif.config
imported by: elif.project
Failed to parse 'elif(_)' with error:
"<condition>" (line 1, column 1): unexpected SecArgName (Position 1 6) "_"
# cabal v2-build
Warnings found while parsing the project file, else.project:
- dir-else/else.config: Unrecognized section '_' on line 3
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ main = cabalTest . recordMode RecordMarked $ do
assertOutputDoesNotContain "imported by:" outDefault

outIf <- fails $ cabal' "v2-build" [ "all", "--dry-run", "--project-file=if.project" ]
assertOutputContains "Error parsing project file dir-if/if.config:3" outIf
assertOutputContains (normalizeWindowsOutput "Error parsing project file dir-if/if.config:3") outIf
assertOutputContains "imported by:" outIf

outElif <- fails $ cabal' "v2-build" [ "all", "--dry-run", "--project-file=elif.project" ]
assertOutputContains "Error parsing project file dir-elif/elif.config:4" outElif
assertOutputContains (normalizeWindowsOutput "Error parsing project file dir-elif/elif.config:4") outElif
assertOutputContains "imported by:" outElif

outElse <- fails $ cabal' "v2-build" [ "all", "--dry-run", "--project-file=else.project" ]
assertOutputContains "Warnings found while parsing the project file, else.project:" outElse
assertOutputContains "- dir-else/else.config: Unrecognized section '_' on line 3" outElse
assertOutputContains (normalizeWindowsOutput "- dir-else/else.config: Unrecognized section '_' on line 3") outElse
assertOutputContains "When using configuration from:" outElse

return ()
3 changes: 3 additions & 0 deletions cabal-testsuite/src/Test/Cabal/Prelude.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1127,6 +1127,9 @@ flakyIfCI ticket m = do
flakyIfWindows :: IssueID -> TestM a -> TestM a
flakyIfWindows ticket m = flakyIf isWindows ticket m

normalizeWindowsOutput :: String -> String
normalizeWindowsOutput = if isWindows then map (\x -> case x of '/' -> '\\'; _ -> x) else id

getOpenFilesLimit :: TestM (Maybe Integer)
#ifdef mingw32_HOST_OS
-- No MS-specified limit, was determined experimentally on Windows 10 Pro x64,
Expand Down

0 comments on commit d80b5ec

Please sign in to comment.