Skip to content

Commit 5e8898d

Browse files
asklarCopilot
andcommitted
Fix integration test file locking: close ifstream before fs::remove
On Windows, fs::remove throws when the file is still open by an ifstream in the same process. Close the ifstream explicitly before removing the annotations JSON temp files in the three affected tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent ebbe001 commit 5e8898d

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

tests/integration_tests.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@ TEST_F(NotepadFixture, AnnotationsJsonOutput) {
390390
EXPECT_GT(h, 0) << "Annotation " << a["id"] << " has non-positive height";
391391
}
392392

393+
f.close();
393394
fs::remove(annFile);
394395
}
395396

@@ -428,6 +429,7 @@ TEST_F(NotepadFixture, AnnotationsMatchTreeElements) {
428429
<< "Annotated element " << id << " not found in tree";
429430
}
430431

432+
f.close();
431433
fs::remove(annFile);
432434
}
433435
#endif
@@ -708,6 +710,7 @@ TEST_F(KnownWindowFixture, AnnotationsIncludeKnownControls) {
708710
<< "Annotation " << a["id"] << " has non-positive height";
709711
}
710712

713+
f.close();
711714
fs::remove(annFile);
712715
}
713716
#endif

0 commit comments

Comments
 (0)