Skip to content

Commit

Permalink
Fix php tag fold test (attempt 2)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbien committed Nov 7, 2023
1 parent 0c8313e commit 49cda01
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2146,13 +2146,6 @@ protected void checkFolds(String relFilePath) throws Exception {
ParserManager.parse(Collections.singleton(testSource), new UserTask() {
public @Override void run(ResultIterator resultIterator) throws Exception {

// FoldingScanner#folds calls source.getDocument(false) and receive non null values on JDK 8.
// On JDK 11+ however the document is null which leads to test failures in FoldingTest#testPHPTags.
// This is likely a race condition which is more likely to occur on JDK 11+ since the test can be
// brute forced to passing on linux if restarted often enough.
// This fixes it by making sure the document is open before folds are computed
assertNotNull(resultIterator.getSnapshot().getSource().getDocument(true));

StructureScanner analyzer = getStructureScanner();
assertNotNull("getStructureScanner must be implemented", analyzer);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public Map<String, List<OffsetRange>> folds(ParserResult info) {
program.accept(new FoldingVisitor(folds));
Source source = phpParseResult.getSnapshot().getSource();
assert source != null : "source was null";
Document doc = source.getDocument(false);
Document doc = source.getDocument(true);
if (FOLD_PHPTAG) {
processPHPTags(folds, doc);
}
Expand Down

0 comments on commit 49cda01

Please sign in to comment.