-
Notifications
You must be signed in to change notification settings - Fork 710
support test library #4297
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
Comments
Does #4206 encompass this? If so, please pipe in on that thread supporting the feature! |
Don't internal libraries available in current |
internal libraries don't solve my problem: I want to use the test-library in the test code of other packages. |
@PierreVDL Is there a substantially simpler version of #4206 that solves your problem? #4206 is unlikely to get solved in the near future. |
A simpler solution could be: introduce a keyword like When a test library is not declared, exactly the same behaviour as currently is implemented will be obtained. In particular, when I include the package / *.cabal file in another package to build a test However, when a package / *.cabal file declares such a test library besides the normal library, then This proposal makes building and testing explicitly two different activities for which different libraries might be needed. |
I realized that another choice is possible: We can make two libraries: However, we can also make two libraries as follows: In the latter case, we can make the inclusion of the test library in other packages explicit, instead implicitly based on the test / library / benchmark / executable context. |
Based on your previous comments, possibly the most expedient thing to do from an implementation perspective is to add a condition (maybe a special flag?) which is true when the top level goal is a test. But there have been philosophical objections to letting the APIs of packages change this way (which is why, for example, you can't demand a dependency have a flag set a certain way). |
Closing as a duplicate of #4206. For now, a workaround is to use a separate package. |
Only one library can be defined in a single Cabal file.
According to #2716 it is a fundamental design decision.
As a developer, I want to expose additional functionality for test purposes only.
For example, I want to expose generators of test data defined in a package
such that it can be used by packages that use that test data (e.g. for QuickCheck).
One way to deal with this cabal limitation, is the usage of flags: See e.g.
PackageStructure.zip
This has however some unwanted side effects.
Among others, understanding the packages' builds becomes more complicated,
one gets discussions whether the program that is shipped is the program that is tested,
and the generators are also included in the coverage reports.
Could support for an additional test library be added?
The text was updated successfully, but these errors were encountered: