-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix 5724 compile suffix main arguments (#5910)
Fixes #5724 ### Description - Support for `--compile-suffix` for emitting the main method name. - Support for main methods with arguments. - Support for test main methods with implicit formals ### How has this been tested? - Modified the existing `comp/rust/tests.dfy` test in a way that was reproducing the two issues mentioned in #5724 <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>
- Loading branch information
1 parent
e7a9db1
commit 5f23301
Showing
20 changed files
with
125 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 17 additions & 2 deletions
19
Source/IntegrationTests/TestFiles/LitTests/LitTest/comp/rust/tests.dfy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,22 @@ | ||
// NONUNIFORM: Demonstration of the use of the external Rust Option<> type | ||
// NONUNIFORM: Test of the Dafny-to-Rust tests | ||
// RUN: %baredafny test --target=rs "%s" > "%t" | ||
// RUN: %diff "%s.expect" "%t" | ||
// RUN: %diff "%s.expect" "%t | ||
// RUN: %baredafny build --compile-suffix --target=rs "%s" > "%t" | ||
// RUN: "%S/tests-rust/cargo" run -- Hello > "%t" | ||
// RUN: %diff "%s.main.expect" "%t" | ||
|
||
method {:test} TestIfTestsAreWorking() { | ||
expect 1 == 1, "Ok"; | ||
} | ||
|
||
module WrappedTests { | ||
method {:test} TestIfTestsAreWorking() { | ||
expect 1 == 1, "Ok"; | ||
} | ||
method Main(args: seq<string>) { | ||
print "Detected main\n"; | ||
if |args| > 1 { | ||
print args[1]; | ||
} | ||
} | ||
} |
3 changes: 2 additions & 1 deletion
3
Source/IntegrationTests/TestFiles/LitTests/LitTest/comp/rust/tests.dfy.expect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
|
||
Dafny program verifier finished with 0 verified, 0 errors | ||
Dafny program verifier finished with 1 verified, 0 errors | ||
WrappedTests.TestIfTestsAreWorking: PASSED | ||
TestIfTestsAreWorking: PASSED |
2 changes: 2 additions & 0 deletions
2
Source/IntegrationTests/TestFiles/LitTests/LitTest/comp/rust/tests.dfy.main.expect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Detected main | ||
Hello |