-
Notifications
You must be signed in to change notification settings - Fork 699
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Error if an untrimmed URI is detected - Add a changelog - Add UntrimmedImport tests - Soften the error down to a warning - Use with-ghc.config trick - Add fix-whitespace exceptions for test projects - Include W3C quote is changelog - Remove unused LANGUAGE pragma - Rerun test now that URL imports are sorted last - Move test underneath ProjectImport parent dir
- Loading branch information
1 parent
11f91fd
commit 9dfe91a
Showing
10 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
cabal-testsuite/PackageTests/ProjectImport/UntrimmedImport/cabal.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# checking project import with trailing space | ||
# cabal v2-build | ||
Warning: import has leading or trailing whitespace; | ||
'https://www.stackage.org/nightly-2024-12-05/cabal.config ' | ||
imported by: trailing-space.project | ||
Configuration is affected by the following files: | ||
- trailing-space.project | ||
- with-ghc.config | ||
imported by: trailing-space.project | ||
- https://www.stackage.org/nightly-2024-12-05/cabal.config | ||
imported by: trailing-space.project | ||
Resolving dependencies... | ||
Build profile: -w ghc-<GHCVER> -O1 | ||
In order, the following would be built: | ||
- my-0.1 (lib:my) (first run) | ||
# checking project import with tabs and spaces | ||
# cabal v2-build | ||
Warning: import has leading or trailing whitespace; | ||
'https://www.stackage.org/nightly-2024-12-05/cabal.config ' | ||
imported by: tabs-and-spaces.project | ||
Configuration is affected by the following files: | ||
- tabs-and-spaces.project | ||
- with-ghc.config | ||
imported by: tabs-and-spaces.project | ||
- https://www.stackage.org/nightly-2024-12-05/cabal.config | ||
imported by: tabs-and-spaces.project | ||
Resolving dependencies... | ||
Build profile: -w ghc-<GHCVER> -O1 | ||
In order, the following would be built: | ||
- my-0.1 (lib:my) (first run) |
14 changes: 14 additions & 0 deletions
14
cabal-testsuite/PackageTests/ProjectImport/UntrimmedImport/cabal.test.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import Test.Cabal.Prelude | ||
|
||
main = cabalTest . recordMode RecordMarked $ do | ||
let log = recordHeader . pure | ||
|
||
log "checking project import with trailing space" | ||
trailing <- cabal' "v2-build" [ "--dry-run", "--project-file=trailing-space.project" ] | ||
assertOutputContains "import has leading or trailing whitespace" trailing | ||
assertOutputContains "'https://www.stackage.org/nightly-2024-12-05/cabal.config '" trailing | ||
|
||
log "checking project import with tabs and spaces" | ||
cabal "v2-build" [ "--dry-run", "--project-file=tabs-and-spaces.project" ] | ||
|
||
return () |
9 changes: 9 additions & 0 deletions
9
cabal-testsuite/PackageTests/ProjectImport/UntrimmedImport/my.cabal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
name: my | ||
version: 0.1 | ||
license: BSD3 | ||
cabal-version: >= 1.2 | ||
build-type: Simple | ||
|
||
library | ||
exposed-modules: Foo | ||
build-depends: base |
3 changes: 3 additions & 0 deletions
3
cabal-testsuite/PackageTests/ProjectImport/UntrimmedImport/tabs-and-spaces.project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
packages: . | ||
import: https://www.stackage.org/nightly-2024-12-05/cabal.config | ||
import: with-ghc.config |
3 changes: 3 additions & 0 deletions
3
cabal-testsuite/PackageTests/ProjectImport/UntrimmedImport/trailing-space.project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
packages: . | ||
import: https://www.stackage.org/nightly-2024-12-05/cabal.config | ||
import: with-ghc.config |
7 changes: 7 additions & 0 deletions
7
cabal-testsuite/PackageTests/ProjectImport/UntrimmedImport/with-ghc.config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
-- WARNING: Override the `with-compiler: ghc-x.y.z` of the stackage import, of | ||
-- https://www.stackage.org/nightly-yyyy-mm-dd/cabal.config. Otherwise tests | ||
-- will fail with: | ||
-- -Error: [Cabal-5490] | ||
-- -Cannot find the program 'ghc'. User-specified path 'ghc-x.y.z' does not | ||
-- refer to an executable and the program is not on the system path. | ||
with-compiler: ghc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
synopsis: "Report trailing spaces in project import URIs" | ||
packages: [cabal-install, cabal-install-solver] | ||
prs: 10629 | ||
issues: 10622 | ||
--- | ||
|
||
> A string is a valid URL potentially surrounded by spaces if, after stripping | ||
> leading and trailing whitespace from it, it is a valid URL." | ||
> SOURCE: [W3C/HTML5/URLs](https://www.w3.org/TR/2010/WD-html5-20100624/urls.html) | ||
|
||
Fixes a problem of mistaking a URI for a file path when it has trailing spaces | ||
and warn about such trailing spaces. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters