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

Unified Diff: pkg/analysis_server/test/services/completion/completion_target_test.dart

Issue 1002713003: completions in map literals (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge cleanup 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/services/completion/completion_target_test.dart
diff --git a/pkg/analysis_server/test/services/completion/completion_target_test.dart b/pkg/analysis_server/test/services/completion/completion_target_test.dart
index 8e98b005dc21421c035f469b813aa166ff482907..16983af755c8edaa23701d5f092ab9e22c11c7fb 100644
--- a/pkg/analysis_server/test/services/completion/completion_target_test.dart
+++ b/pkg/analysis_server/test/services/completion/completion_target_test.dart
@@ -39,9 +39,10 @@ class CompletionTargetTest extends AbstractContextTest {
void assertTarget(entityText, nodeText,
{int argIndex: null, bool isFunctionalArgument: false}) {
void assertCommon() {
- expect(target.entity.toString(), entityText);
- expect(target.containingNode.toString(), nodeText);
- expect(target.argIndex, argIndex);
+ expect(target.entity.toString(), entityText, reason: 'entity');
+ expect(target.containingNode.toString(), nodeText,
+ reason: 'containingNode');
+ expect(target.argIndex, argIndex, reason: 'argIndex');
}
// Assert with parsed unit
assertCommon();
@@ -65,18 +66,6 @@ class CompletionTargetTest extends AbstractContextTest {
assertTarget(')', '()', argIndex: 0, isFunctionalArgument: true);
}
- test_TypeArgumentList() {
- // SimpleIdentifier BinaryExpression ExpressionStatement
- addTestSource('main() { C<^> c; }');
- assertTarget('', 'C < ');
- }
-
- test_TypeArgumentList2() {
- // TypeName TypeArgumentList TypeName
- addTestSource('main() { C<C^> c; }');
- assertTarget('C', '<C>');
- }
-
test_ArgumentList_MethodInvocation() {
// ArgumentList MethodInvocation Block
addTestSource('main() {foo(^)}');
@@ -312,6 +301,24 @@ class CompletionTargetTest extends AbstractContextTest {
assertTarget('new C();', '{var f; {var x;} new C();}');
}
+ test_MapLiteralEntry() {
+ // MapLiteralEntry MapLiteral VariableDeclaration
+ addTestSource('foo = {^');
+ assertTarget(' : ', '{ : }');
+ }
+
+ test_MapLiteralEntry1() {
+ // MapLiteralEntry MapLiteral VariableDeclaration
+ addTestSource('foo = {T^');
+ assertTarget('T : ', '{T : }');
+ }
+
+ test_MapLiteralEntry2() {
+ // SimpleIdentifier MapLiteralEntry MapLiteral VariableDeclaration
+ addTestSource('foo = {7:T^};');
+ assertTarget('T', '7 : T');
+ }
+
test_MethodDeclaration_inLineComment() {
// Comment ClassDeclaration CompilationUnit
addTestSource('''
@@ -467,6 +474,18 @@ class C2 {
assertTarget('zoo', 'zoo(z) {}');
}
+ test_TypeArgumentList() {
+ // SimpleIdentifier BinaryExpression ExpressionStatement
+ addTestSource('main() { C<^> c; }');
+ assertTarget('', 'C < ');
+ }
+
+ test_TypeArgumentList2() {
+ // TypeName TypeArgumentList TypeName
+ addTestSource('main() { C<C^> c; }');
+ assertTarget('C', '<C>');
+ }
+
test_VariableDeclaration_lhs_identifier_after() {
// VariableDeclaration VariableDeclarationList
addTestSource('main() {int b^ = 1;}');

Powered by Google App Engine
This is Rietveld 408576698