`copilot-core`: Increase test coverage
Description
The test coverage of copilot-core is currently reported at 75% by Hackage.
Although there are exceptions to what we can test (record fields of existential types) or should test (proxies, automatically generated constructors and accessor functions), the coverage of our tests should include very top level definition and expression that can be tested without having to modify the implementation of copilot-core itself.
Type
- Management: Increase coverage of tests.
Additional context
There are limitations to what we can test, or how we can instruct HPC to ignore certain symbols. At present, we don't have a simply way of modifying copilot-core's cabal package to tick specific symbols or expressions. Future improvements to HPC may make this possible.
Requester
- Ivan Perez
Method to check presence of bug
Not applicable (not a bug).
Expected result
All top-level functions that are not automatically generated by the compiler are tested, except where testing them is not possible, when code is automatically generated (constructors, record accessor functions), or when values do not need to be fully evaluated (e.g., Proxy's, ()).
Desired result
All top-level functions that are not automatically generated by the compiler are tested, except where testing them is not possible, when code is automatically generated (constructors, record accessor functions), or when values do not need to be fully evaluated (e.g., Proxy's, ()).
Proposed solution
Add tests for all definitions in copilot-core that are not automatically generated and can be tested without having to modify the implementation of the library (e.g., to force WHNF/NF in lazily evaluated values like Proxy).
Further notes
None.
Change Manager: Confirmed that the issue exists.
Technical Lead: Confirmed that the issue should be addressed.
Technical Lead: Issue scheduled for fixing in Copilot 4.2.
Fix assigned to: @ivanperez-keera .
Implementor: Solution implemented, review requested.
Change Manager: Verified that:
- Solution is implemented:
- [X] The code proposed compiles and passes all tests. Details: Build log: https://app.travis-ci.com/github/Copilot-Language/copilot/builds/273697324
- [X] The solution proposed produces the expected result. Details:
Evaluated by visual inspection. Running the code coverage in GHC produces a report indicating that 35/36 top-level definitions in
Copilot.Core.Typeand 4/4 inCopilot.Core.Type.Array. The top-level definition not covered inCopilot.Core.Typeis deprecated and will be removed in a future release. There's full alternative coverage for both modules (100%), and the expressions not covered areProxys, and arguments not evaluated due to laziness.
- [X] Implementation is documented. Details: All top-level functions and definitions are documented. Other comments are also added.
- [X] Change history is clear.
- [X] Commit messages are clear.
- [X] Changelogs are updated.
- [X] Examples are updated. Details: No updates needed; change is to the tests.
- [X] Required version bumps are evaluated. Details: Bump not needed; change is to the tests.
Change Manager: Implementation ready to be merged.