Use actual names of the @isTest of isTestGroup executable in outlines.
R=brianwilkerson@google.com, devoncarew@google.com
Change-Id: Ifcd9d2398ca4e80cdace115e36f0d27df1afaad4
Reviewed-on: https://dart-review.googlesource.com/53825
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
diff --git a/pkg/analysis_server/lib/src/computer/computer_outline.dart b/pkg/analysis_server/lib/src/computer/computer_outline.dart
index c086d92..96432aa 100644
--- a/pkg/analysis_server/lib/src/computer/computer_outline.dart
+++ b/pkg/analysis_server/lib/src/computer/computer_outline.dart
@@ -430,9 +430,9 @@
}
void addOutlineNode(ElementKind kind, [List<Outline> children]) {
- String kindName = kind == ElementKind.UNIT_TEST_GROUP ? 'group' : 'test';
- String name = '$kindName("${extractString(
- node.argumentList?.arguments)}")';
+ String executableName = nameNode.name;
+ String description = extractString(node.argumentList?.arguments);
+ String name = '$executableName("$description")';
Element element = new Element(kind, name, 0,
location: outlineComputer._getLocationNode(nameNode));
contents.add(new Outline(
diff --git a/pkg/analysis_server/test/src/computer/outline_computer_test.dart b/pkg/analysis_server/test/src/computer/outline_computer_test.dart
index 7f3a6ce..67e9b9b 100644
--- a/pkg/analysis_server/test/src/computer/outline_computer_test.dart
+++ b/pkg/analysis_server/test/src/computer/outline_computer_test.dart
@@ -591,7 +591,7 @@
_expect(group1_outline,
kind: ElementKind.UNIT_TEST_GROUP,
length: 7,
- name: 'group("group1")',
+ name: 'myGroup("group1")',
offset: testCode.indexOf("myGroup('group1'"));
List<Outline> group1_children = group1_outline.children;
expect(group1_children, hasLength(2));
@@ -600,7 +600,7 @@
_expect(group1_1_outline,
kind: ElementKind.UNIT_TEST_GROUP,
length: 7,
- name: 'group("group1_1")',
+ name: 'myGroup("group1_1")',
offset: testCode.indexOf("myGroup('group1_1'"));
List<Outline> group1_1_children = group1_1_outline.children;
expect(group1_1_children, hasLength(2));
@@ -610,7 +610,7 @@
kind: ElementKind.UNIT_TEST_TEST,
leaf: true,
length: 6,
- name: 'test("test1_1_1")',
+ name: 'myTest("test1_1_1")',
offset: testCode.indexOf("myTest('test1_1_1'"));
// test1_1_1
Outline test1_1_2_outline = group1_1_children[1];
@@ -618,14 +618,14 @@
kind: ElementKind.UNIT_TEST_TEST,
leaf: true,
length: 6,
- name: 'test("test1_1_2")',
+ name: 'myTest("test1_1_2")',
offset: testCode.indexOf("myTest('test1_1_2'"));
// group1_2
Outline group1_2_outline = group1_children[1];
_expect(group1_2_outline,
kind: ElementKind.UNIT_TEST_GROUP,
length: 7,
- name: 'group("group1_2")',
+ name: 'myGroup("group1_2")',
offset: testCode.indexOf("myGroup('group1_2'"));
List<Outline> group1_2_children = group1_2_outline.children;
expect(group1_2_children, hasLength(1));
@@ -635,14 +635,14 @@
kind: ElementKind.UNIT_TEST_TEST,
leaf: true,
length: 6,
- name: 'test("test1_2_1")',
+ name: 'myTest("test1_2_1")',
offset: testCode.indexOf("myTest('test1_2_1'"));
// group2
Outline group2_outline = main_children[1];
_expect(group2_outline,
kind: ElementKind.UNIT_TEST_GROUP,
length: 7,
- name: 'group("group2")',
+ name: 'myGroup("group2")',
offset: testCode.indexOf("myGroup('group2'"));
List<Outline> group2_children = group2_outline.children;
expect(group2_children, hasLength(2));
@@ -652,7 +652,7 @@
kind: ElementKind.UNIT_TEST_TEST,
leaf: true,
length: 6,
- name: 'test("test2_1")',
+ name: 'myTest("test2_1")',
offset: testCode.indexOf("myTest('test2_1'"));
// test2_2
Outline test2_2_outline = group2_children[1];
@@ -660,7 +660,7 @@
kind: ElementKind.UNIT_TEST_TEST,
leaf: true,
length: 6,
- name: 'test("test2_2")',
+ name: 'myTest("test2_2")',
offset: testCode.indexOf("myTest('test2_2'"));
}