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

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

Issue 756483002: Exchanging operands of a comparision operator should invert the operator. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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/test/mock_sdk.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:analysis_server/src/services/index/index.dart'; 9 import 'package:analysis_server/src/services/index/index.dart';
10 import 'package:analysis_server/src/services/index/local_memory_index.dart'; 10 import 'package:analysis_server/src/services/index/local_memory_index.dart';
(...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 class A { 999 class A {
1000 bool get isEmpty => false; 1000 bool get isEmpty => false;
1001 } 1001 }
1002 main(A a) { 1002 main(A a) {
1003 !a.isEmpty; 1003 !a.isEmpty;
1004 } 1004 }
1005 '''); 1005 ''');
1006 assertNoAssistAt('isEmpty;', AssistKind.CONVERT_INTO_IS_NOT_EMPTY); 1006 assertNoAssistAt('isEmpty;', AssistKind.CONVERT_INTO_IS_NOT_EMPTY);
1007 } 1007 }
1008 1008
1009 void test_exchangeBinaryExpressionArguments_OK_compare() {
1010 Map<String, String> operatorMap = {
1011 '<': '>=',
1012 '<=': '>',
1013 '>': '<=',
1014 '>=': '<'
1015 };
1016 operatorMap.forEach((initialOperator, resultOperator) {
1017 _indexTestUnit('''
1018 bool main(int a, int b) {
1019 return a $initialOperator b;
1020 }
1021 ''');
1022 assertHasAssistAt(initialOperator, AssistKind.EXCHANGE_OPERANDS, '''
1023 bool main(int a, int b) {
1024 return b $resultOperator a;
1025 }
1026 ''');
1027 });
1028 }
1029
1009 void test_exchangeBinaryExpressionArguments_OK_extended_mixOperator_1() { 1030 void test_exchangeBinaryExpressionArguments_OK_extended_mixOperator_1() {
1010 _indexTestUnit(''' 1031 _indexTestUnit('''
1011 main() { 1032 main() {
1012 1 * 2 * 3 + 4; 1033 1 * 2 * 3 + 4;
1013 } 1034 }
1014 '''); 1035 ''');
1015 assertHasAssistAt('* 2', AssistKind.EXCHANGE_OPERANDS, ''' 1036 assertHasAssistAt('* 2', AssistKind.EXCHANGE_OPERANDS, '''
1016 main() { 1037 main() {
1017 2 * 3 * 1 + 4; 1038 2 * 3 * 1 + 4;
1018 } 1039 }
(...skipping 1564 matching lines...) Expand 10 before | Expand all | Expand 10 after
2583 void _indexTestUnit(String code) { 2604 void _indexTestUnit(String code) {
2584 resolveTestUnit(code); 2605 resolveTestUnit(code);
2585 index.indexUnit(context, testUnit); 2606 index.indexUnit(context, testUnit);
2586 } 2607 }
2587 2608
2588 void _setStartEndSelection() { 2609 void _setStartEndSelection() {
2589 offset = findOffset('// start\n') + '// start\n'.length; 2610 offset = findOffset('// start\n') + '// start\n'.length;
2590 length = findOffset('// end') - offset; 2611 length = findOffset('// end') - offset;
2591 } 2612 }
2592 } 2613 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/mock_sdk.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698