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

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

Issue 990343002: Add an optional 'typeParameters' to Element. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update version. 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/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 be856cd1f0af16e00ffc326fe6779b69e9993486..cae3f7b6dd039b3e77b2836f4f87b19e14820476 100644
--- a/pkg/analysis_server/test/analysis/notification_outline_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_outline_test.dart
@@ -60,7 +60,7 @@ class BBB {
test_class() {
addTestFile('''
-class A {
+class A<K, V> {
int fa, fb;
String fc;
A(int i, String s);
@@ -85,9 +85,10 @@ class B {
Element element_A = outline_A.element;
expect(element_A.kind, ElementKind.CLASS);
expect(element_A.name, "A");
+ expect(element_A.typeParameters, "<K, V>");
{
Location location = element_A.location;
- expect(location.offset, testCode.indexOf("A {"));
+ expect(location.offset, testCode.indexOf("A<K, V> {"));
expect(location.length, 1);
}
expect(element_A.parameters, null);
@@ -227,6 +228,7 @@ class B {
Element element_B = outline_B.element;
expect(element_B.kind, ElementKind.CLASS);
expect(element_B.name, "B");
+ expect(element_B.typeParameters, isNull);
{
Location location = element_B.location;
expect(location.offset, testCode.indexOf("B {"));
@@ -677,11 +679,12 @@ int fieldD; // marker2
test_topLevel() {
addTestFile('''
-typedef String FTA(int i, String s);
+typedef String FTA<K, V>(int i, String s);
typedef FTB(int p);
-class A {}
+class A<T> {}
class B {}
-class CTA = A with B;
+class CTA<T> = A<T> with B;
+class CTB = A with B;
String fA(int i, String s) => null;
fB(int p) => null;
String get propA => null;
@@ -690,16 +693,17 @@ set propB(int v) {}
return prepareOutline().then((_) {
Outline unitOutline = outline;
List<Outline> topOutlines = unitOutline.children;
- expect(topOutlines, hasLength(9));
+ expect(topOutlines, hasLength(10));
// FTA
{
Outline outline = topOutlines[0];
Element element = outline.element;
expect(element.kind, ElementKind.FUNCTION_TYPE_ALIAS);
expect(element.name, "FTA");
+ expect(element.typeParameters, "<K, V>");
{
Location location = element.location;
- expect(location.offset, testCode.indexOf("FTA("));
+ expect(location.offset, testCode.indexOf("FTA<K, V>("));
expect(location.length, "FTA".length);
}
expect(element.parameters, "(int i, String s)");
@@ -711,6 +715,7 @@ set propB(int v) {}
Element element = outline.element;
expect(element.kind, ElementKind.FUNCTION_TYPE_ALIAS);
expect(element.name, "FTB");
+ expect(element.typeParameters, isNull);
{
Location location = element.location;
expect(location.offset, testCode.indexOf("FTB("));
@@ -725,18 +730,28 @@ set propB(int v) {}
Element element = outline.element;
expect(element.kind, ElementKind.CLASS_TYPE_ALIAS);
expect(element.name, "CTA");
+ expect(element.typeParameters, '<T>');
{
Location location = element.location;
- expect(location.offset, testCode.indexOf("CTA ="));
+ expect(location.offset, testCode.indexOf("CTA<T> ="));
expect(location.length, "CTA".length);
}
expect(element.parameters, isNull);
expect(element.returnType, isNull);
}
- // fA
+ // CTB
{
Outline outline = topOutlines[5];
Element element = outline.element;
+ expect(element.kind, ElementKind.CLASS_TYPE_ALIAS);
+ expect(element.name, 'CTB');
+ expect(element.typeParameters, isNull);
+ expect(element.returnType, isNull);
+ }
+ // fA
+ {
+ Outline outline = topOutlines[6];
+ Element element = outline.element;
expect(element.kind, ElementKind.FUNCTION);
expect(element.name, "fA");
{
@@ -749,7 +764,7 @@ set propB(int v) {}
}
// fB
{
- Outline outline = topOutlines[6];
+ Outline outline = topOutlines[7];
Element element = outline.element;
expect(element.kind, ElementKind.FUNCTION);
expect(element.name, "fB");
@@ -763,7 +778,7 @@ set propB(int v) {}
}
// propA
{
- Outline outline = topOutlines[7];
+ Outline outline = topOutlines[8];
Element element = outline.element;
expect(element.kind, ElementKind.GETTER);
expect(element.name, "propA");
@@ -777,7 +792,7 @@ set propB(int v) {}
}
// propB
{
- Outline outline = topOutlines[8];
+ Outline outline = topOutlines[9];
Element element = outline.element;
expect(element.kind, ElementKind.SETTER);
expect(element.name, "propB");
« no previous file with comments | « pkg/analysis_server/lib/src/protocol_server.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