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

Unified Diff: pkg/analysis_server/test/protocol_server_test.dart

Issue 990343002: Add an optional 'typeParameters' to Element. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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/protocol_server_test.dart
diff --git a/pkg/analysis_server/test/protocol_server_test.dart b/pkg/analysis_server/test/protocol_server_test.dart
index 8a3851bf77da2b4e6aaf03f22febbfcf3b3e8950..26aae555a284f5ca04f3772d09ae008a80cbd1b4 100644
--- a/pkg/analysis_server/test/protocol_server_test.dart
+++ b/pkg/analysis_server/test/protocol_server_test.dart
@@ -195,24 +195,38 @@ class ElementTest extends AbstractContextTest {
void test_fromElement_CLASS() {
engine.Source source = addSource('/test.dart', '''
@deprecated
-abstract class _MyClass {}''');
+abstract class _A {}
+class B<K, V> {}''');
engine.CompilationUnit unit = resolveLibraryUnit(source);
- engine.ClassElement engineElement = findElementInUnit(unit, '_MyClass');
- // create notification Element
- Element element = newElement_fromEngine(engineElement);
- expect(element.kind, ElementKind.CLASS);
- expect(element.name, '_MyClass');
{
- Location location = element.location;
- expect(location.file, '/test.dart');
- expect(location.offset, 27);
- expect(location.length, '_MyClass'.length);
- expect(location.startLine, 2);
- expect(location.startColumn, 16);
+ engine.ClassElement engineElement = findElementInUnit(unit, '_A');
+ // create notification Element
+ Element element = newElement_fromEngine(engineElement);
+ expect(element.kind, ElementKind.CLASS);
+ expect(element.name, '_A');
+ expect(element.typeParameters, isNull);
+ {
+ Location location = element.location;
+ expect(location.file, '/test.dart');
+ expect(location.offset, 27);
+ expect(location.length, '_A'.length);
+ expect(location.startLine, 2);
+ expect(location.startColumn, 16);
+ }
+ expect(element.parameters, isNull);
+ expect(element.flags, Element.FLAG_ABSTRACT |
+ Element.FLAG_DEPRECATED |
+ Element.FLAG_PRIVATE);
+ }
+ {
+ engine.ClassElement engineElement = findElementInUnit(unit, 'B');
+ // create notification Element
+ Element element = newElement_fromEngine(engineElement);
+ expect(element.kind, ElementKind.CLASS);
+ expect(element.name, 'B');
+ expect(element.typeParameters, '<K, V>');
+ expect(element.flags, 0);
}
- expect(element.parameters, isNull);
- expect(element.flags,
- Element.FLAG_ABSTRACT | Element.FLAG_DEPRECATED | Element.FLAG_PRIVATE);
}
void test_fromElement_CONSTRUCTOR() {
@@ -227,6 +241,7 @@ class A {
Element element = newElement_fromEngine(engineElement);
expect(element.kind, ElementKind.CONSTRUCTOR);
expect(element.name, 'myConstructor');
+ expect(element.typeParameters, isNull);
{
Location location = element.location;
expect(location.file, '/test.dart');
@@ -278,20 +293,21 @@ class A {
void test_fromElement_FUNCTION_TYPE_ALIAS() {
engine.Source source = addSource('/test.dart', '''
-typedef int f(String x);
+typedef int F<T>(String x);
''');
engine.CompilationUnit unit = resolveLibraryUnit(source);
engine.FunctionTypeAliasElement engineElement =
- findElementInUnit(unit, 'f');
+ findElementInUnit(unit, 'F');
// create notification Element
Element element = newElement_fromEngine(engineElement);
expect(element.kind, ElementKind.FUNCTION_TYPE_ALIAS);
- expect(element.name, 'f');
+ expect(element.name, 'F');
+ expect(element.typeParameters, '<T>');
{
Location location = element.location;
expect(location.file, '/test.dart');
expect(location.offset, 12);
- expect(location.length, 'f'.length);
+ expect(location.length, 'F'.length);
expect(location.startLine, 1);
expect(location.startColumn, 13);
}

Powered by Google App Engine
This is Rietveld 408576698