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

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

Issue 902273002: Don't propose fixes to update SDK sources. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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/fix_internal.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.fix; 5 library test.services.correction.fix;
6 6
7 import 'package:analysis_server/src/protocol.dart' hide AnalysisError; 7 import 'package:analysis_server/src/protocol.dart' hide AnalysisError;
8 import 'package:analysis_server/src/services/correction/fix.dart'; 8 import 'package:analysis_server/src/services/correction/fix.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 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 _indexTestUnit(''' 445 _indexTestUnit('''
446 class A { 446 class A {
447 A._named(p); 447 A._named(p);
448 } 448 }
449 class B extends A { 449 class B extends A {
450 } 450 }
451 '''); 451 ''');
452 assertNoFix(FixKind.CREATE_CONSTRUCTOR_SUPER); 452 assertNoFix(FixKind.CREATE_CONSTRUCTOR_SUPER);
453 } 453 }
454 454
455 void test_createField_BAD_inSDK() {
456 _indexTestUnit('''
457 main(List p) {
458 p.foo = 1;
459 }
460 ''');
461 assertNoFix(FixKind.CREATE_FIELD);
462 }
463
455 void test_createField_getter_multiLevel() { 464 void test_createField_getter_multiLevel() {
456 _indexTestUnit(''' 465 _indexTestUnit('''
457 class A { 466 class A {
458 } 467 }
459 class B { 468 class B {
460 A a; 469 A a;
461 } 470 }
462 class C { 471 class C {
463 B b; 472 B b;
464 } 473 }
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 change = fix.change; 753 change = fix.change;
745 // validate change 754 // validate change
746 List<SourceFileEdit> fileEdits = change.edits; 755 List<SourceFileEdit> fileEdits = change.edits;
747 expect(fileEdits, hasLength(1)); 756 expect(fileEdits, hasLength(1));
748 SourceFileEdit fileEdit = change.edits[0]; 757 SourceFileEdit fileEdit = change.edits[0];
749 expect(fileEdit.file, '/my/project/bin/my_file.dart'); 758 expect(fileEdit.file, '/my/project/bin/my_file.dart');
750 expect(fileEdit.fileStamp, -1); 759 expect(fileEdit.fileStamp, -1);
751 expect(fileEdit.edits[0].replacement, contains('library my.file;')); 760 expect(fileEdit.edits[0].replacement, contains('library my.file;'));
752 } 761 }
753 762
763 void test_createGetter_BAD_inSDK() {
764 _indexTestUnit('''
765 main(List p) {
766 int v = p.foo;
767 }
768 ''');
769 assertNoFix(FixKind.CREATE_GETTER);
770 }
771
754 void test_createGetter_multiLevel() { 772 void test_createGetter_multiLevel() {
755 _indexTestUnit(''' 773 _indexTestUnit('''
756 class A { 774 class A {
757 } 775 }
758 class B { 776 class B {
759 A a; 777 A a;
760 } 778 }
761 class C { 779 class C {
762 B b; 780 B b;
763 } 781 }
(...skipping 1576 matching lines...) Expand 10 before | Expand all | Expand 10 after
2340 } 2358 }
2341 '''); 2359 ''');
2342 assertHasFix(FixKind.CHANGE_TO, ''' 2360 assertHasFix(FixKind.CHANGE_TO, '''
2343 myFunction() {} 2361 myFunction() {}
2344 main() { 2362 main() {
2345 myFunction(); 2363 myFunction();
2346 } 2364 }
2347 '''); 2365 ''');
2348 } 2366 }
2349 2367
2368 void test_undefinedMethod_create_BAD_inSDK() {
2369 _indexTestUnit('''
2370 main() {
2371 List.foo();
2372 }
2373 ''');
2374 assertNoFix(FixKind.CREATE_METHOD);
2375 }
2376
2350 void test_undefinedMethod_create_generic_BAD() { 2377 void test_undefinedMethod_create_generic_BAD() {
2351 _indexTestUnit(''' 2378 _indexTestUnit('''
2352 class A<T> { 2379 class A<T> {
2353 B b; 2380 B b;
2354 Map<int, T> items; 2381 Map<int, T> items;
2355 main() { 2382 main() {
2356 b.process(items); 2383 b.process(items);
2357 } 2384 }
2358 } 2385 }
2359 2386
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
2786 positions.add(new Position(testFile, offset)); 2813 positions.add(new Position(testFile, offset));
2787 } 2814 }
2788 return positions; 2815 return positions;
2789 } 2816 }
2790 2817
2791 void _indexTestUnit(String code) { 2818 void _indexTestUnit(String code) {
2792 resolveTestUnit(code); 2819 resolveTestUnit(code);
2793 index.indexUnit(context, testUnit); 2820 index.indexUnit(context, testUnit);
2794 } 2821 }
2795 } 2822 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/services/correction/fix_internal.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698