Skip to content

Commit

Permalink
Disgard previous notifications to ensure we get only the most recent …
Browse files Browse the repository at this point in the history
…ones.

One test for possible interleavings.
  • Loading branch information
MikaelMayer committed Mar 29, 2022
1 parent 0a2ff43 commit beabc4f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ var previousPerLineDiagnostics
for (; maximumNumberOfTraces > 0; maximumNumberOfTraces--) {
var verificationDiagnosticReport = await VerificationDiagnosticReceiver.AwaitNextNotificationAsync(CancellationToken);
Assert.AreEqual(documentItem.Uri, verificationDiagnosticReport.Uri);
if (documentItem.Version != verificationDiagnosticReport.Version) {
continue;
}
var newPerLineDiagnostics = verificationDiagnosticReport.PerLineDiagnostic.ToList();
if ((previousPerLineDiagnostics != null
&& previousPerLineDiagnostics.SequenceEqual(newPerLineDiagnostics)) ||
Expand Down Expand Up @@ -229,7 +232,9 @@ public async Task VerifyTrace(string codeAndTrace) {
}
var traceObtained = RenderTrace(traces, code);
var ignoreQuestionMarks = AcceptQuestionMarks(traceObtained, codeAndTrace);
AssertWithDiff.Equal("\n" + codeAndTrace + "\n", "\n" + ignoreQuestionMarks + "\n");
var expected = "\n" + codeAndTrace + "\n";
var actual = "\n" + ignoreQuestionMarks + "\n";
AssertWithDiff.Equal(expected, actual);
}

// Finds all the "?" at the beginning in expected and replace the characters at the same position in traceObtained
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,17 @@ await VerifyTrace(@"
. S [S][ ]:}");
}

[TestMethod, Timeout(MaxTestExecutionTimeMs)]
[TestMethod, Timeout(MaxTestExecutionTimeMs * 10)]
public async Task EnsureNoAssertShowsVerified() {
await VerifyTrace(@"
for (var i = 0; i < 10; i++) {
await VerifyTrace(@"
. | | | I | :predicate P(x: int)
| | | I | :
. S [S][ ][I] | :method Main() {
. S [=][=][I] | : ghost var x :| P(x); //Next: ghost var x := 1;
. S [S][ ][I] | :}
| :");
}
}

[TestMethod, Timeout(MaxTestExecutionTimeMs)]
Expand Down

0 comments on commit beabc4f

Please sign in to comment.