copilot icon indicating copy to clipboard operation
copilot copied to clipboard

`copilot-core`: Increase test coverage

Open ivanperez-keera opened this issue 1 year ago • 2 comments

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.

ivanperez-keera avatar Oct 24 '24 23:10 ivanperez-keera

Change Manager: Confirmed that the issue exists.

ivanperez-keera avatar Oct 24 '24 23:10 ivanperez-keera

Technical Lead: Confirmed that the issue should be addressed.

ivanperez-keera avatar Oct 24 '24 23:10 ivanperez-keera

Technical Lead: Issue scheduled for fixing in Copilot 4.2.

Fix assigned to: @ivanperez-keera .

ivanperez-keera avatar Nov 12 '24 15:11 ivanperez-keera

Implementor: Solution implemented, review requested.

ivanperez-keera avatar Dec 30 '24 05:12 ivanperez-keera

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.Type and 4/4 in Copilot.Core.Type.Array. The top-level definition not covered in Copilot.Core.Type is deprecated and will be removed in a future release. There's full alternative coverage for both modules (100%), and the expressions not covered are Proxys, 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.

ivanperez-keera avatar Dec 30 '24 06:12 ivanperez-keera

Change Manager: Implementation ready to be merged.

ivanperez-keera avatar Dec 30 '24 06:12 ivanperez-keera