Skip to content
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

Test Refactor #3066

Merged
merged 6 commits into from
Sep 7, 2023
Merged

Test Refactor #3066

merged 6 commits into from
Sep 7, 2023

Conversation

madman-bob
Copy link
Collaborator

A refactor of Idris's tests. I've used this approach in my own projects.

Test Utilities

I've created a utility script testutils.sh, which can be imported to provide testing utilities to tests. This helps with consistency, and readability. I've extracted a couple of common patterns here.

For example, instead of $1 --no-banner --console-width 0 --no-color ..., we can just write idris2 ....

Test Directories

Instead of naming the tests explicitly in Main.idr, I've used testsInDir as much as possible. This did require me creating an additional directory layer in the idris2 tests. This should prevent tests being added, without being run.

Indeed, the following tests weren't acutally being run:

  • allbackends/evaluator005
  • chez/barrier001
  • chez/forkjoin001
  • node/node014
  • idris2/builtin012
  • idris2/linear004
  • racket/forkjoin001
  • racket/conditions006
  • racket/conditions007

For each of these tests, if it was easy to get the test running, I did so. I've deleted linear004, as it requires linearity subtyping. I'm considering also deleting evaluator005, unless we can decide how Doubles should behave.

Backwards Compatibility

This change will cause merge conflicts with some outstanding PRs. If a PR adds a new test, it will likely cause a conflict in the testing Main.idr. We can throw away their change here, as the testsInDir will pick up the test instead.

If the test is added to the idris2 folder, it should be moved to the appropriate subdirectory.

It is not required to use testutils in any new test, but I reommend importing it if just for the readability improvement over $1 .... Usages of $1 should probably be replaced with one of idris2, $idris2, check, or run.

@gallais
Copy link
Member

gallais commented Sep 1, 2023

Cf. discussion in #1736

Edit: I guess now that testsInDir does take a predicate I'm not as opposed to
using it more extensively.

@madman-bob madman-bob force-pushed the test-refactor branch 2 times, most recently from feeefb6 to f697ddd Compare September 1, 2023 13:50
@gallais gallais added the event: IDM 2023/08 Issue tackled during the August 2023 Idris Developers Meeting label Sep 1, 2023
@andrevidela andrevidela added this to the 0.7.0 milestone Sep 7, 2023
@gallais gallais merged commit b4d7bba into idris-lang:main Sep 7, 2023
20 checks passed
@madman-bob madman-bob deleted the test-refactor branch September 7, 2023 15:43
buzden added a commit to buzden/Idris2 that referenced this pull request Oct 3, 2023
buzden added a commit to buzden/Idris2 that referenced this pull request Oct 3, 2023
buzden added a commit to buzden/Idris2 that referenced this pull request Oct 3, 2023
buzden added a commit to buzden/Idris2 that referenced this pull request Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
admin: continuous-integration code: refactoring event: IDM 2023/08 Issue tackled during the August 2023 Idris Developers Meeting library: test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants