Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Unified Diff: pkg/analysis_server/test/integration/analysis/error_test.dart

Issue 1574523002: add enableAsync to analysis option file flags (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/test/integration/analysis/error_test.dart
diff --git a/pkg/analysis_server/test/integration/analysis/error_test.dart b/pkg/analysis_server/test/integration/analysis/error_test.dart
index cd490fa87e4e9c495ebae3296d1af5138f28fcee..be2f8c1d04f62820b4a3bbec38e5817113719e00 100644
--- a/pkg/analysis_server/test/integration/analysis/error_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/error_test.dart
@@ -19,6 +19,45 @@ main() {
@reflectiveTest
class AnalysisErrorIntegrationTest
extends AbstractAnalysisServerIntegrationTest {
+ test_async_disabled() async {
+ String pathname = sourcePath('test.dart');
+ writeFile(
+ pathname,
+ '''
+import 'dart:async';
+class Test {
+ Future foo() async {}
+}
+ ''');
+ await sendAnalysisUpdateOptions(new AnalysisOptions()..enableAsync = false);
+ standardAnalysisSetup();
+ await analysisFinished;
+ expect(currentAnalysisErrors[pathname], isList);
+ List<AnalysisError> errors = currentAnalysisErrors[pathname];
+ expect(errors, hasLength(1));
+ Set<String> allErrorMessages =
+ errors.map((AnalysisError e) => e.message).toSet();
+ expect(allErrorMessages, contains(
+ "Async and sync are not supported in this environment."));
+ }
+
+ test_async_enabled() async {
+ String pathname = sourcePath('test.dart');
+ writeFile(
+ pathname,
+ '''
+import 'dart:async';
+class Test {
+ Future foo() async {}
+}
+ ''');
+ standardAnalysisSetup();
+ await analysisFinished;
+ expect(currentAnalysisErrors[pathname], isList);
+ List<AnalysisError> errors = currentAnalysisErrors[pathname];
+ expect(errors, isEmpty);
+ }
+
test_detect_simple_error() {
String pathname = sourcePath('test.dart');
writeFile(

Powered by Google App Engine
This is Rietveld 408576698