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

Side by Side Diff: pkg/analysis_server/test/services/correction/assist_test.dart

Issue 1009833002: Quick Assist for creating a constructor for selected final fields. (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/analysis_server/lib/src/services/correction/util.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.correction.assist; 5 library test.services.correction.assist;
6 6
7 import 'package:analysis_server/src/protocol.dart'; 7 import 'package:analysis_server/src/protocol.dart';
8 import 'package:analysis_server/src/services/correction/assist.dart'; 8 import 'package:analysis_server/src/services/correction/assist.dart';
9 import 'package:analyzer/src/generated/source.dart'; 9 import 'package:analyzer/src/generated/source.dart';
10 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
(...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 class A { 1082 class A {
1083 bool get isEmpty => false; 1083 bool get isEmpty => false;
1084 } 1084 }
1085 main(A a) { 1085 main(A a) {
1086 !a.isEmpty; 1086 !a.isEmpty;
1087 } 1087 }
1088 '''); 1088 ''');
1089 assertNoAssistAt('isEmpty;', AssistKind.CONVERT_INTO_IS_NOT_EMPTY); 1089 assertNoAssistAt('isEmpty;', AssistKind.CONVERT_INTO_IS_NOT_EMPTY);
1090 } 1090 }
1091 1091
1092 void test_createFinalFieldsConstructor() {
Brian Wilkerson 2015/03/15 23:43:22 What happens with the following test input: class
1093 resolveTestUnit('''
1094 class A {
1095 final int a;
1096 // start
1097 final int b;
1098 final int c;
1099 // end
1100 final int d;
1101 }
1102 ''');
1103 _setStartEndSelection();
1104 assertHasAssist(AssistKind.CREATE_FINAL_FIELD_CONSTRUCTOR, '''
1105 class A {
1106 final int a;
1107 // start
1108 final int b;
1109 final int c;
1110 // end
1111 final int d;
1112
1113 A(this.b, this.c);
1114 }
1115 ''');
1116 }
1117
1092 void test_exchangeBinaryExpressionArguments_OK_compare() { 1118 void test_exchangeBinaryExpressionArguments_OK_compare() {
1093 Map<String, String> operatorMap = { 1119 Map<String, String> operatorMap = {
1094 '<': '>', 1120 '<': '>',
1095 '<=': '>=', 1121 '<=': '>=',
1096 '>': '<', 1122 '>': '<',
1097 '>=': '<=' 1123 '>=': '<='
1098 }; 1124 };
1099 operatorMap.forEach((initialOperator, resultOperator) { 1125 operatorMap.forEach((initialOperator, resultOperator) {
1100 resolveTestUnit(''' 1126 resolveTestUnit('''
1101 bool main(int a, int b) { 1127 bool main(int a, int b) {
(...skipping 1530 matching lines...) Expand 10 before | Expand all | Expand 10 after
2632 positions.add(new Position(testFile, offset)); 2658 positions.add(new Position(testFile, offset));
2633 } 2659 }
2634 return positions; 2660 return positions;
2635 } 2661 }
2636 2662
2637 void _setStartEndSelection() { 2663 void _setStartEndSelection() {
2638 offset = findOffset('// start\n') + '// start\n'.length; 2664 offset = findOffset('// start\n') + '// start\n'.length;
2639 length = findOffset('// end') - offset; 2665 length = findOffset('// end') - offset;
2640 } 2666 }
2641 } 2667 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/services/correction/util.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698