Skip to content

Commit

Permalink
Merge pull request #59632 from jasonmalinowski/fix-flaky-test
Browse files Browse the repository at this point in the history
Fix flaky test
  • Loading branch information
jasonmalinowski authored Feb 18, 2022
2 parents d868da8 + 46b782f commit b542ba6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Workspaces/CoreTest/SolutionTests/SolutionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,11 @@ public async Task ChangingPreprocessorDirectivesMayReparse(string source, bool e

var oldTree = await document.GetRequiredSyntaxTreeAsync(CancellationToken.None);

// Hold onto the old root, so we don't actually release the root; if the root were to fall away
// we're unable to use IsIncrementallyIdenticalTo to see if we didn't reparse, since asking for
// the old root will recover the tree and produce a new green node.
var oldRoot = oldTree.GetRoot();

Assert.Equal(document.Project.ParseOptions, oldTree.Options);

ParseOptions newOptions =
Expand All @@ -799,7 +804,7 @@ public async Task ChangingPreprocessorDirectivesMayReparse(string source, bool e

Assert.Equal(document.Project.ParseOptions, newTree.Options);

Assert.Equal(expectReuse, oldTree.GetRoot().IsIncrementallyIdenticalTo(newTree.GetRoot()));
Assert.Equal(expectReuse, oldRoot.IsIncrementallyIdenticalTo(newTree.GetRoot()));
}

[Fact]
Expand Down

0 comments on commit b542ba6

Please sign in to comment.