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

Unified Diff: pkg/analysis_server/test/analysis/notification_outline_test.dart

Issue 934353002: Issue 22476. Outline for enums. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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/analysis/notification_outline_test.dart
diff --git a/pkg/analysis_server/test/analysis/notification_outline_test.dart b/pkg/analysis_server/test/analysis/notification_outline_test.dart
index b92ec5267877530927255d8f9d507a2ff2e0b8d6..8b6eccfc477ef88fcc900e3dcbe1e3eb925ad9af 100644
--- a/pkg/analysis_server/test/analysis/notification_outline_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_outline_test.dart
@@ -256,6 +256,39 @@ class B {
});
}
+ test_enum() {
+ addTestFile('''
+enum MyEnum {
+ A, B, C
+}
+''');
+ return prepareOutline().then((_) {
+ Outline unitOutline = outline;
+ List<Outline> topOutlines = unitOutline.children;
+ expect(topOutlines, hasLength(1));
+ // MyEnum
+ {
+ Outline outline_MyEnum = topOutlines[0];
+ Element element_MyEnum = outline_MyEnum.element;
+ expect(element_MyEnum.kind, ElementKind.ENUM);
+ expect(element_MyEnum.name, "MyEnum");
+ {
+ Location location = element_MyEnum.location;
+ expect(location.offset, testCode.indexOf("MyEnum {"));
+ expect(location.length, 'MyEnum'.length);
+ }
+ expect(element_MyEnum.parameters, null);
+ expect(element_MyEnum.returnType, null);
+ // MyEnum children
+ List<Outline> outlines_MyEnum = outline_MyEnum.children;
+ expect(outlines_MyEnum, hasLength(3));
+ _isEnumConstant(outlines_MyEnum[0], 'A');
+ _isEnumConstant(outlines_MyEnum[1], 'B');
+ _isEnumConstant(outlines_MyEnum[2], 'C');
+ }
+ });
+ }
+
/**
* Code like this caused NPE in the past.
*
@@ -760,4 +793,12 @@ set propB(int v) {}
}
});
}
+
+ void _isEnumConstant(Outline outline, String name) {
+ Element element = outline.element;
+ expect(element.kind, ElementKind.ENUM_CONSTANT);
+ expect(element.name, name);
+ expect(element.parameters, isNull);
+ expect(element.returnType, isNull);
+ }
}
« no previous file with comments | « pkg/analysis_server/lib/src/generated_protocol.dart ('k') | pkg/analysis_server/test/integration/protocol_matchers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698