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

Side by Side Diff: pkg/analysis_server/test/services/completion/completion_target_test.dart

Issue 1271723002: fix completion replacement offset/length for invalid token in switch statement (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: merge and address comments Created 5 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library test.services.completion.target; 5 library test.services.completion.target;
6 6
7 import 'package:analysis_server/src/services/completion/completion_target.dart'; 7 import 'package:analysis_server/src/services/completion/completion_target.dart';
8 import 'package:analyzer/src/generated/ast.dart'; 8 import 'package:analyzer/src/generated/ast.dart';
9 import 'package:analyzer/src/generated/source.dart'; 9 import 'package:analyzer/src/generated/source.dart';
10 import 'package:test_reflective_loader/test_reflective_loader.dart'; 10 import 'package:test_reflective_loader/test_reflective_loader.dart';
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 addTestSource('class C2 {/** */ ^ zoo(z) { } String name; }'); 491 addTestSource('class C2 {/** */ ^ zoo(z) { } String name; }');
492 assertTarget('zoo', 'zoo(z) {}'); 492 assertTarget('zoo', 'zoo(z) {}');
493 } 493 }
494 494
495 test_MethodDeclaration_returnType_afterStarDocComment2() { 495 test_MethodDeclaration_returnType_afterStarDocComment2() {
496 // MethodDeclaration ClassDeclaration CompilationUnit 496 // MethodDeclaration ClassDeclaration CompilationUnit
497 addTestSource('class C2 {/** */^ zoo(z) { } String name; }'); 497 addTestSource('class C2 {/** */^ zoo(z) { } String name; }');
498 assertTarget('zoo', 'zoo(z) {}'); 498 assertTarget('zoo', 'zoo(z) {}');
499 } 499 }
500 500
501 test_SwitchStatement_c() {
502 // Token('c') SwitchStatement
503 addTestSource('main() { switch(x) {c^} }');
504 assertTarget('}', 'switch (x) {}');
505 }
506
507 test_SwitchStatement_c2() {
508 // Token('c') SwitchStatement
509 addTestSource('main() { switch(x) { c^ } }');
510 assertTarget('}', 'switch (x) {}');
511 }
512
513 test_SwitchStatement_empty() {
514 // SwitchStatement
515 addTestSource('main() { switch(x) {^} }');
516 assertTarget('}', 'switch (x) {}');
517 }
518
519 test_SwitchStatement_empty2() {
520 // SwitchStatement
521 addTestSource('main() { switch(x) { ^ } }');
522 assertTarget('}', 'switch (x) {}');
523 }
524
501 test_TypeArgumentList() { 525 test_TypeArgumentList() {
502 // TypeName TypeArgumentList TypeName 526 // TypeName TypeArgumentList TypeName
503 addTestSource('main() { C<^> c; }'); 527 addTestSource('main() { C<^> c; }');
504 assertTarget('', '<>'); 528 assertTarget('', '<>');
505 } 529 }
506 530
507 test_TypeArgumentList2() { 531 test_TypeArgumentList2() {
508 // TypeName TypeArgumentList TypeName 532 // TypeName TypeArgumentList TypeName
509 addTestSource('main() { C<C^> c; }'); 533 addTestSource('main() { C<C^> c; }');
510 assertTarget('C', '<C>'); 534 assertTarget('C', '<C>');
511 } 535 }
512 536
513 test_VariableDeclaration_lhs_identifier_after() { 537 test_VariableDeclaration_lhs_identifier_after() {
514 // VariableDeclaration VariableDeclarationList 538 // VariableDeclaration VariableDeclarationList
515 addTestSource('main() {int b^ = 1;}'); 539 addTestSource('main() {int b^ = 1;}');
516 assertTarget('b = 1', 'int b = 1'); 540 assertTarget('b = 1', 'int b = 1');
517 } 541 }
518 542
519 test_VariableDeclaration_lhs_identifier_before() { 543 test_VariableDeclaration_lhs_identifier_before() {
520 // VariableDeclaration VariableDeclarationList 544 // VariableDeclaration VariableDeclarationList
521 addTestSource('main() {int ^b = 1;}'); 545 addTestSource('main() {int ^b = 1;}');
522 assertTarget('b = 1', 'int b = 1'); 546 assertTarget('b = 1', 'int b = 1');
523 } 547 }
524 } 548 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698