-
Notifications
You must be signed in to change notification settings - Fork 697
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
cabal init --tests
does not create any tests if not using --lib{andexe}
#7410
Comments
This issue is happening because by default cabal initializes a package with only an executable, and there is no way to wire tests directly to an executable without a library in the middle, as far as I can see. Pheraps As a workaround, If on the other hand you meant to initialize tests in an already existing package, this is not currently possible, though there are plans to allow editing .cabal files with cabal commands: #7337. |
cabal init --tests
does not create any tests.cabal init --tests
does not create any tests if not using --lib{andexe}
However, observe that you can have a test suite without either a library or an executable, and the default test suite being generated by That is to say, the test suite is not and does not need to be wired to any other stanza. |
That is true, but what would such a testsuite test? Answering that myself: other packages in a project, maybe in combination. Or there could be an overlap in the source directories, though I think that's discouraged. So maybe it would be best to generate the testsuite but also point out in a warning/notice that the user may want to use |
this may be another issue. when generating a lib+exe, the exe is made to depend on the lib since that's what one usually wants, so maybe the same should apply to lib+test |
My case is such that I needed a package with exactly one |
Hmmm. First off, I would not call this a bug @fgaz, since it's explicitly the behavior of the Ideally, something like this:
Is this what you're going for @kindaro? |
Please understand: I use Cabal as a tool to get the job done. Not a guru developer, not an occasional user either. So:
If you show me the results of «hallway testing» where people figure out to invoke I do not mean this as saying that I am somehow special and entitled. If you have other means of measuring the goodness of user experience, please go for it. I am fine with any behaviour as long as it is clear and consistent. All I can say is that, when I type Cabal already has a myriad of flags that work or do not work depending on their exact combination. Especially since |
Ah no I think maybe I wasn't clear - I provided a minimal example as a proof of concept for what this workflow might look like if we added The Just for background, what i mean when i say "initializing a test suite", I mean that the I agree that what we have now is poor, ergonomically. I'm agreeing with you that this is could be improved! |
Sure, the result looks right! If there is a way to put it into Cabal in such a way that it does not increase confusion, that would be good. |
There are one of two ways I can see this going:
I think for me, reconsidering, it may just be best to repurpose @ptkato what do you think? |
I'm fine with whatever option, as long there's an actual use case (which it does have), however I'm inclined towards supporting the first option more than the others. |
Okay, so just so spec that option out, here's my problem with 1:
So, a solution would go like this:
And we'd modify the following workflows:
|
That boils down to assuming defaults and checking the working directory for existing files. I believe with minimal alterations, what already is in place could work great. |
I have to separate tests out all the time as users complain about the extra dependencies that it adds to the package. How about You won't find it by intuition, but coming across it in the docs, the name would help clarify the usage provisos involved, and listed near --lib, would help distinguish this different use-case. |
Describe the bug
cabal init --tests
does not create any tests.To Reproduce
Expected behavior
A directory is created with some tests. The tests are wired into
example.cabal
as appropriate.System information
The text was updated successfully, but these errors were encountered: