-
Notifications
You must be signed in to change notification settings - Fork 20
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
"Dafny > test" #417
Comments
Related/duplicate: #418 |
Indeed that will be good to integrate with VSCode. |
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.
Ok thanks for the clarification. From the documentation you shared with me, it looks like designing a user-level task generator is a bit more ambitious than what I implemented. It would be certainly be helpful for a class of Dafny users who otherwise just switch to the command line and write their various "make xxx" commands because they usually put everything in a makefile. Being able to get these commands from the dafny project sounds a good idea too. In my case and with a lot of new Dafny users, they don't necessarily have project files, everything they need at the beginning is a way to run and test their files, using a keyboard shortcut (F5 or SHIFT+F5 as I suggest). It would be a bit overwhelming to have to define them the notion of project file/task/generate task/modify task. So in short, I like your solution in general, but for what our need is currently, I wouldn't spend time myself implementing it. |
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.
Does it not seem about equivalent in complexity? You define objects like the JSON I quoted, but then in code. You don't have to do anything dynamic or do anything with project files.
I think there would be an extra step where the user asks VSCode to generate tasks, but after that invoking the tasks is similar to invoking the commands. I would be careful in adding these commands, if later we might decide to use tasks instead and then want to remove the commands. |
For now it looks like it's more obvious to you than to me. What I did was straightforward just to unblock new and existing users discovering the Run function and in need of the test function. I am still not sure about the tasks because I haven't looked deeply at them. I'd be happy to review a proposal about tasks, or even just a comparative workflow.
I think that, for discoverability purposes, I would very likely vote against any removal of commands in general easily accessible from the right-click, unless there is another compelling UI we can start using (e.g. the Run and Debug interface). Again, I have not studied tasks closely so I can't say if they will fit our needs or not, and from what I heard of you, I'm not yet convinced (but happy to change mind with more evidence). |
I should recall about at least one user who would probably like to configure tasks if ever you want to make someone happier. |
I would like to just right-click and run Dafny > test, but this option is not present.
Currently, I select "build with custom arguments" and I replace everything with "test" or "test --no-verify".
it would be good to have the two options.
Test without verification is useful to check up if a property holds before proving it.
The text was updated successfully, but these errors were encountered: