Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
Packages
Cabal
Commits
72b93d91
Commit
72b93d91
authored
Mar 25, 2016
by
Duncan Coutts
Browse files
Quote package locations with spaces when printing
And extend the project config print/parse tests to cover quoted strings.
parent
f6c1e71c
Changes
2
Hide whitespace changes
Inline
Side-by-side
cabal-install/Distribution/Client/ProjectConfig/Legacy.hs
View file @
72b93d91
...
...
@@ -17,6 +17,7 @@ module Distribution.Client.ProjectConfig.Legacy (
-- * Internals, just for tests
parsePackageLocationTokenQ
,
renderPackageLocationToken
,
)
where
import
Distribution.Client.ProjectConfig.Types
...
...
@@ -755,6 +756,8 @@ renderPackageLocationToken s | needsQuoting = show s
ok
n
(
'{'
:
cs
)
=
ok
(
n
+
1
)
cs
ok
n
(
'}'
:
cs
)
=
ok
(
n
-
1
)
cs
ok
n
(
','
:
cs
)
=
(
n
>
0
)
&&
ok
n
cs
ok
_
(
c
:
_
)
|
isSpace
c
=
False
ok
n
(
_
:
cs
)
=
ok
n
cs
...
...
cabal-install/tests/UnitTests/Distribution/Client/ProjectConfig.hs
View file @
72b93d91
...
...
@@ -223,7 +223,8 @@ prop_roundtrip_printparse_specific config =
prop_parsePackageLocationTokenQ
::
PackageLocationString
->
Bool
prop_parsePackageLocationTokenQ
(
PackageLocationString
str
)
=
case
[
x
|
(
x
,
""
)
<-
Parse
.
readP_to_S
parsePackageLocationTokenQ
str
]
of
case
[
x
|
(
x
,
""
)
<-
Parse
.
readP_to_S
parsePackageLocationTokenQ
(
renderPackageLocationToken
str
)
]
of
[
str'
]
->
str'
==
str
_
->
False
...
...
@@ -259,8 +260,8 @@ instance Arbitrary PackageLocationString where
arbitrary
=
PackageLocationString
<$>
oneof
[
--
show <$> (arbitrary :: Gen String)
arbitraryGlobLikeStr
[
show
.
getNonEmpty
<$>
(
arbitrary
::
Gen
(
NonEmptyList
String
)
)
,
arbitraryGlobLikeStr
,
show
<$>
(
arbitrary
::
Gen
URI
)
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment