[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
This commit is contained in:
Ben Langmuir
2020-07-22 17:39:26 -07:00
parent 53b87714d7
commit 9c08fc0ddd

View File

@@ -195,11 +195,14 @@ public:
void doubleOpenWithDelay(std::chrono::microseconds delay, bool close);
void setupThreeAnnotations(const char *DocName, TestConsumer &Consumer) {
// The following is engineered so that the references to `mem` are at
// offsets 60, 70, and 80 for convenience. They're on the same line so
// that tests do not accidentally depend on line separation.
const char *Contents =
"struct S {\n"
" var mem: Int = 0\n"
" func test() {\n"
" _ = (self.mem, self.mem, self.mem)\n"
" _ = mem; _ = mem; _ = mem\n"
" }\n"
"}\n";
const char *Args[] = { "-parse-as-library" };
@@ -550,8 +553,6 @@ TEST_F(EditTest, AnnotationsRangeShiftingAfterEditInsertEnd) {
ASSERT_FALSE(waitForDocUpdate()) << "timed out";
close(DocName);
}
// rdar://65934938 Failing in CI with ASan
#if defined(__has_feature) && !__has_feature(address_sanitizer)
TEST_F(EditTest, AnnotationsRangeShiftingAfterEditReplaceEnd) {
const char *DocName = "test.swift";
TestConsumer Consumer;
@@ -570,7 +571,6 @@ TEST_F(EditTest, AnnotationsRangeShiftingAfterEditReplaceEnd) {
ASSERT_FALSE(waitForDocUpdate()) << "timed out";
close(DocName);
}
#endif
TEST_F(EditTest, AnnotationsRangeShiftingAfterEditDeleteEnd) {
const char *DocName = "test.swift";
TestConsumer Consumer;