hspec / sensei

MIT License
26 stars 12 forks source link

`sensei` chokes on `-fdefer-typed-holes` #21

Open soenkehahn opened 9 years ago

soenkehahn commented 9 years ago

Here's a script in a branch that demonstrates the bug: https://github.com/soenkehahn/quickcheck-demo/blob/sensei-bug/sensei-bug.sh

The error message is:

<interactive>: invalid argument `defer-typed-holes' for `--format'
Try `<interactive> --help' for more information.
*** Exception: ExitFailure 1
sol commented 9 years ago

This happens because -f is also a valid hspec argument. I think you can disambiguate this by putting a -- at the back, or moving the flag before the module. Say

cabal exec -- sensei-web test/Spec.hs -fdefer-typed-holes --

or

cabal exec -- sensei-web -fdefer-typed-holes test/Spec.hs

should work.

Not sure what else we should do here, but at the very least we want a better error message.

soenkehahn commented 9 years ago

I think -fwarn-no-name-shadowing works correctly though.

I wonder if it would be best to avoid any heuristic and just say that hspec arguments have to be passed after --, no exceptions. At least that behaviour would be very easy to understand and unsurprising.

sol commented 9 years ago

@soenkehahn -fno-warn-name-shadowing also does not work, just tried.

sol commented 9 years ago

I think our best bet is still to improve error messages, so that the user better understands what's going on and how he can do what he wants to do.