Index: pkg/analysis_server/test/integration/analysis/update_content_test.dart |
diff --git a/pkg/analysis_server/test/integration/analysis/update_content_test.dart b/pkg/analysis_server/test/integration/analysis/update_content_test.dart |
index 77338ef76d0061021bcf71f61bd5a174eb6ccf2d..76a7f3b4cb594277d83db8fc0ca599bef9310bc9 100644 |
--- a/pkg/analysis_server/test/integration/analysis/update_content_test.dart |
+++ b/pkg/analysis_server/test/integration/analysis/update_content_test.dart |
@@ -16,54 +16,48 @@ main() { |
} |
class AbstractUpdateContentTest extends AbstractAnalysisServerIntegrationTest { |
- test_updateContent() { |
- String pathname = sourcePath('test.dart'); |
+ test_updateContent() async { |
+ String path = sourcePath('test.dart'); |
String goodText = r''' |
main() { |
print("Hello, world!"); |
}'''; |
+ |
String badText = goodText.replaceAll(';', ''); |
- writeFile(pathname, badText); |
+ writeFile(path, badText); |
standardAnalysisSetup(); |
- return analysisFinished |
- .then((_) { |
- // The contents on disk (badText) are missing a semicolon. |
- expect(currentAnalysisErrors[pathname], isNotEmpty); |
- }) |
- .then((_) => sendAnalysisUpdateContent( |
- {pathname: new AddContentOverlay(goodText)})) |
- .then((result) => analysisFinished) |
- .then((_) { |
- // There should be no errors now because the contents on disk have been |
- // overridden with goodText. |
- expect(currentAnalysisErrors[pathname], isEmpty); |
- return sendAnalysisUpdateContent({ |
- pathname: new ChangeContentOverlay( |
- [new SourceEdit(goodText.indexOf(';'), 1, '')]) |
- }); |
- }) |
- .then((result) => analysisFinished) |
- .then((_) { |
- // There should be errors now because we've removed the semicolon. |
- expect(currentAnalysisErrors[pathname], isNotEmpty); |
- return sendAnalysisUpdateContent({ |
- pathname: new ChangeContentOverlay( |
- [new SourceEdit(goodText.indexOf(';'), 0, ';')]) |
- }); |
- }) |
- .then((result) => analysisFinished) |
- .then((_) { |
- // There should be no errors now because we've added the semicolon back. |
- expect(currentAnalysisErrors[pathname], isEmpty); |
- return sendAnalysisUpdateContent( |
- {pathname: new RemoveContentOverlay()}); |
- }) |
- .then((result) => analysisFinished) |
- .then((_) { |
- // Now there should be errors again, because the contents on disk are no |
- // longer overridden. |
- expect(currentAnalysisErrors[pathname], isNotEmpty); |
- }); |
+ |
+ // The contents on disk (badText) are missing a semicolon. |
+ await analysisFinished; |
+ expect(currentAnalysisErrors[path], isNotEmpty); |
+ |
+ // There should be no errors now because the contents on disk have been |
+ // overridden with goodText. |
+ sendAnalysisUpdateContent({path: new AddContentOverlay(goodText)}); |
+ await analysisFinished; |
+ expect(currentAnalysisErrors[path], isEmpty); |
+ |
+ // There should be errors now because we've removed the semicolon. |
+ sendAnalysisUpdateContent({ |
+ path: new ChangeContentOverlay( |
+ [new SourceEdit(goodText.indexOf(';'), 1, '')]) |
+ }); |
+ await analysisFinished; |
+ expect(currentAnalysisErrors[path], isNotEmpty); |
+ |
+ // There should be no errors now because we've added the semicolon back. |
+ sendAnalysisUpdateContent({ |
+ path: new ChangeContentOverlay( |
+ [new SourceEdit(goodText.indexOf(';'), 0, ';')]) |
+ }); |
+ await analysisFinished; |
+ expect(currentAnalysisErrors[path], isEmpty); |
+ |
+ // Now there should be errors again, because the contents on disk are no |
+ // longer overridden. |
+ sendAnalysisUpdateContent({path: new RemoveContentOverlay()}); |
+ await analysisFinished; |
+ expect(currentAnalysisErrors[path], isNotEmpty); |
} |
} |
@@ -74,11 +68,4 @@ class UpdateContentTest extends AbstractUpdateContentTest {} |
class UpdateContentTest_Driver extends AbstractUpdateContentTest { |
@override |
bool get enableNewAnalysisDriver => true; |
- |
- @failingTest |
- test_updateContent() { |
- // Expected: non-empty |
- // Actual: [] |
- return super.test_updateContent(); |
- } |
} |