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

Allow the :test attribute when using run and build #3275

Merged

Conversation

keyboardDrummer
Copy link
Member

@keyboardDrummer keyboardDrummer commented Dec 27, 2022

Fixes #3260

Also adds a hidden --spill-translation attribute for the run,build and test commands.

By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

@keyboardDrummer keyboardDrummer enabled auto-merge (squash) December 27, 2022 12:59
@@ -3390,7 +3390,7 @@ private class CSharpCompilationResult {
}

private void AddTestCheckerIfNeeded(string name, Declaration decl, ConcreteSyntaxTree wr) {
if (DafnyOptions.O.RunAllTests || !Attributes.Contains(decl.Attributes, "test")) {
if (DafnyOptions.O.Compile || DafnyOptions.O.RunAllTests || !Attributes.Contains(decl.Attributes, "test")) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just checking that the intended behavior is that methods marked {:test} are only compiled when testing

Copy link
Member Author

@keyboardDrummer keyboardDrummer Dec 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're always compiled when compiling, but the C# XUnit.Fact attribute is only added when using dafny translate.

@"In case the Dafny source code is translated to another language, emit that translation.") {
IsHidden = true
};

public static readonly Option<bool> UseBaseFileName = new("--use-basename-for-filename",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are instances of the old spelling that ought to be changed concurrently (even if the old spelling still works):
grep -r -e '--useBaseNameForFileName' ../.. | grep -v Binary
../../Test/lit.site.cfg:'--useBaseNameForFileName',
../../Source/DafnyDriver/DafnyDriver.cs: "--useBaseNameForFileName",
../../Source/DafnyCore/Options/DeveloperOptionBag.cs: public static readonly Option UseBaseFileName = new("--useBaseNameForFileName",
../../Source/IntegrationTests/bin/Debug/net6.0/TestFiles/LitTests/LitTest/lit.site.cfg:'--useBaseNameForFileName',
../../Source/IntegrationTests/bin/Debug/net6.0/TestFiles/LitTests/LitTest/lit.site.cfg:config.substitutions.append( ('%resolveargs', "--useBaseNameForFileName" ) )
../../docs/check-examples:## "dafny verify --useBaseNameForFileName $F" and checks
../../docs/check-examples:## "dafny resolve --useBaseNameForFileName $F" and checks
../../docs/check-examples:## "dafny run --useBaseNameForFileName $F" and,
../../docs/check-examples: "$dafny" $com --useBaseNameForFileName $options $text > actual

Copy link
Member Author

@keyboardDrummer keyboardDrummer Dec 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this grep was not done on this PR. I only see three occurrences in comments (that have been resolved now)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My mistake, and I was also looking a a stale list of changes...
Thanks for making this option consistently spelled.

@keyboardDrummer keyboardDrummer merged commit 61bd72f into dafny-lang:master Dec 27, 2022
@keyboardDrummer keyboardDrummer deleted the testAttributeRunBuild branch December 28, 2022 12:49
RustanLeino pushed a commit to RustanLeino/dafny that referenced this pull request Dec 29, 2022
Fixes dafny-lang#3260

Also adds a hidden `--spill-translation` attribute for the `run`,`build`
and `test` commands.

<small>By submitting this pull request, I confirm that my contribution
is made under the terms of the [MIT
license](https://github.com/dafny-lang/dafny/blob/master/LICENSE.txt).</small>
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.

Compiling with {:test} on .NET fails
2 participants