Skip to content

Commit d80b5ec

Browse files
committed
Use normalizeWindowsOutput
1 parent 997f147 commit d80b5ec

File tree

3 files changed

+30
-4
lines changed

3 files changed

+30
-4
lines changed
Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# cabal v2-build
2-
Warning: <ROOT>/else.project, else.project: Unrecognized section '_' on line 3
2+
Warnings found while parsing the project file, else.project:
3+
- dir-else/else.config: Unrecognized section '_' on line 3
34
# Multiline string marking:
45
# ^When using configuration from:$
56
# ^ - else.project$
@@ -8,3 +9,25 @@ Warning: <ROOT>/else.project, else.project: Unrecognized section '_' on line 3
89
# ^ - The package location 'no-pkg-here' does not exist.$
910
# Pseudo multiline string marking:
1011
# ^When using configuration from: - else.project - dir-else/else.config The following errors occurred: - The package location 'no-pkg-here' does not exist.$
12+
# cabal v2-build
13+
Error: [Cabal-7090]
14+
Error parsing project file cabal.project:3:
15+
- Failed to parse 'if(_)' with error:
16+
"<condition>" (line 1, column 1): unexpected SecArgName (Position 1 4) "_"
17+
# cabal v2-build
18+
Error: [Cabal-7090]
19+
Error parsing project file dir-if/if.config:3:
20+
- dir-if/if.config
21+
imported by: if.project
22+
Failed to parse 'if(_)' with error:
23+
"<condition>" (line 1, column 1): unexpected SecArgName (Position 1 4) "_"
24+
# cabal v2-build
25+
Error: [Cabal-7090]
26+
Error parsing project file dir-elif/elif.config:4:
27+
- dir-elif/elif.config
28+
imported by: elif.project
29+
Failed to parse 'elif(_)' with error:
30+
"<condition>" (line 1, column 1): unexpected SecArgName (Position 1 6) "_"
31+
# cabal v2-build
32+
Warnings found while parsing the project file, else.project:
33+
- dir-else/else.config: Unrecognized section '_' on line 3

cabal-testsuite/PackageTests/ProjectImport/ParseErrorProvenance/cabal.test.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,16 @@ main = cabalTest . recordMode RecordMarked $ do
2727
assertOutputDoesNotContain "imported by:" outDefault
2828

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

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

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

4242
return ()

cabal-testsuite/src/Test/Cabal/Prelude.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,6 +1127,9 @@ flakyIfCI ticket m = do
11271127
flakyIfWindows :: IssueID -> TestM a -> TestM a
11281128
flakyIfWindows ticket m = flakyIf isWindows ticket m
11291129

1130+
normalizeWindowsOutput :: String -> String
1131+
normalizeWindowsOutput = if isWindows then map (\x -> case x of '/' -> '\\'; _ -> x) else id
1132+
11301133
getOpenFilesLimit :: TestM (Maybe Integer)
11311134
#ifdef mingw32_HOST_OS
11321135
-- No MS-specified limit, was determined experimentally on Windows 10 Pro x64,

0 commit comments

Comments
 (0)