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

Feat: Added the test command #420

Merged
merged 2 commits into from
Aug 14, 2023
Merged

Feat: Added the test command #420

merged 2 commits into from
Aug 14, 2023

Conversation

MikaelMayer
Copy link
Member

@MikaelMayer MikaelMayer commented Aug 14, 2023

Fixes #417
This PR adds the "Test" command in the contextual Dafny menu.

A bit of context. It's not possible to put several Main methods in included files, but it's definitely possible to put tests in each file as needed. Currently, to run tests, one typically right-clicks "Dafny > build with custom arguments", and then replace everything with "test". There is not even a shortcut for that, although the "test" command is fully supported in Dafny. Moreover, I am adding the --no-verify flag by default both on tests and run because

  1. it's in the context of a development environment
  2. The minimum required for dafny run and dafnyt test is that the program resolves and the compiler can compile it.
  3. Verification of the entire file before testing is at best redundant because it was already verified in the IDE, at worst it forces the user to add a bunch of "assume false" in their code just because they haven't prove some assertions they conjectured.

I think it's fair to say that the usual workflow of testing is complementary to verification, even that testing often precedes verification.
If users want still to run regular tests and run with verification, they can use the trick of "build with custom arguments" and set up their custom command, or just use the terminal.

Fixes #417
This PR adds the "Test" command in the contextual Dafny menu.

A bit of context. It's not possible to put several Main methods in included files, but it's definitely possible to put tests in each file as needed.
Currently, to run tests, one typically right-clicks "Dafny > build with custom arguments", and then replace everything with "test". There is not even a shortcut for that, although the "test" command is fully supported in Dafny.
Moreover, I am adding the "--no-verify" flag by default both on tests and run because
1) it's in the context of a development environment
2) The minimum required for `dafny run` and `dafnyt test` is that the program resolves and the compiler can compile it.
3) Verification of the entire file before testing is at best redundant because it was already verified in the IDE, at worst it forces the user to add a bunch of "assume false" in their code just because they haven't prove some assertions they conjectured.

I think it's fair to say that the usual workflow of testing is complementary to verification, meaning it makes it possible to experiment on specifications before proving them.
@keyboardDrummer
Copy link
Member

Commented on the issue: #417 (comment)

@jtristan jtristan merged commit 63e5d7f into master Aug 14, 2023
8 checks passed
@MikaelMayer MikaelMayer deleted the feat-test-command branch August 14, 2023 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Dafny > test"
3 participants