Skip to content

Commit 9c08fc0

Browse files
committed
[test] Fix annotation test to have same behaviour before and after update
The goal of the test is to test the behaviour when the edit is range-shifted, but in the (rare) case where the document update happens before the edit finishes, we need the ranges to be the same. In particular, using separate statements ensures that the tokens not touched by the edit are not affected by the edit. Re-enable the test disabled on ASan, since this seems to be the underlying issue. rdar://65934938
1 parent 53b8771 commit 9c08fc0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

unittests/SourceKit/SwiftLang/EditingTest.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,14 @@ class EditTest : public ::testing::Test {
195195
void doubleOpenWithDelay(std::chrono::microseconds delay, bool close);
196196

197197
void setupThreeAnnotations(const char *DocName, TestConsumer &Consumer) {
198+
// The following is engineered so that the references to `mem` are at
199+
// offsets 60, 70, and 80 for convenience. They're on the same line so
200+
// that tests do not accidentally depend on line separation.
198201
const char *Contents =
199202
"struct S {\n"
200203
" var mem: Int = 0\n"
201204
" func test() {\n"
202-
" _ = (self.mem, self.mem, self.mem)\n"
205+
" _ = mem; _ = mem; _ = mem\n"
203206
" }\n"
204207
"}\n";
205208
const char *Args[] = { "-parse-as-library" };
@@ -550,8 +553,6 @@ TEST_F(EditTest, AnnotationsRangeShiftingAfterEditInsertEnd) {
550553
ASSERT_FALSE(waitForDocUpdate()) << "timed out";
551554
close(DocName);
552555
}
553-
// rdar://65934938 Failing in CI with ASan
554-
#if defined(__has_feature) && !__has_feature(address_sanitizer)
555556
TEST_F(EditTest, AnnotationsRangeShiftingAfterEditReplaceEnd) {
556557
const char *DocName = "test.swift";
557558
TestConsumer Consumer;
@@ -570,7 +571,6 @@ TEST_F(EditTest, AnnotationsRangeShiftingAfterEditReplaceEnd) {
570571
ASSERT_FALSE(waitForDocUpdate()) << "timed out";
571572
close(DocName);
572573
}
573-
#endif
574574
TEST_F(EditTest, AnnotationsRangeShiftingAfterEditDeleteEnd) {
575575
const char *DocName = "test.swift";
576576
TestConsumer Consumer;

0 commit comments

Comments
 (0)