Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad escaping of --test-options #6248

Open
sjakobi opened this issue Sep 19, 2019 · 4 comments
Open

Bad escaping of --test-options #6248

sjakobi opened this issue Sep 19, 2019 · 4 comments

Comments

@sjakobi
Copy link
Member

sjakobi commented Sep 19, 2019

dhall has a tasty test-suite which I would like to execute with the arguments -p /type-inference\/failure/.

The arguments that cabal ends up passing to the tasty executable are -p ''\''/type-inference\/failure/'\''':

$ cabal test dhall:tasty --test-options "-p '/type-inference\/failure/'" -v
...
Test suite tasty: RUNNING...
/home/simon/src/dhall-haskell/dist-newstyle/build/x86_64-linux/ghc-8.6.5/dhall-1.26.0/t/tasty/noopt/build/tasty/tasty -p ''\''/type-inference\/failure/'\'''
option -p: Could not parse pattern
@UnkindPartition
Copy link
Contributor

Normally '' would be interpreted and stripped by the shell. It looks like cabal is not doing that (i.e. it tries to pass the single quotes verbatim to the test suite). That's not necessarily a bug, though it would be nice if the precise semantics of --test-options was documented somewhere (is it?).

In this particular case I think you can simply drop the single quotes, as the outer double quotes would prevent the shell from interpreting the \/, but if the agument contained a white space, I wouldn't know how to pass it.

@sjakobi
Copy link
Member Author

sjakobi commented Sep 19, 2019

In this particular case I think you can simply drop the single quotes, as the outer double quotes would prevent the shell from interpreting the \/

Yes! --test-options "-p /type-inference\/failure/" works. How had I not tried this before?!

@ulysses4ever
Copy link
Collaborator

I wonder if #8093 improved/resolves this.

@Mikolaj
Copy link
Member

Mikolaj commented Jun 11, 2022

Or breaks. Let's add the example above as a test for #8093.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants