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

Side by Side Diff: pkg/analyzer/test/generated/incremental_resolver_test.dart

Issue 832143007: Issue 22044. A changes in annotations should be considered as a mismatch. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Positive tests. Created 5 years, 11 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/analyzer/lib/src/generated/incremental_resolver.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 engine.incremental_resolver_test; 5 library engine.incremental_resolver_test;
6 6
7 import 'package:analyzer/src/generated/ast.dart'; 7 import 'package:analyzer/src/generated/ast.dart';
8 import 'package:analyzer/src/generated/element.dart'; 8 import 'package:analyzer/src/generated/element.dart';
9 import 'package:analyzer/src/generated/engine.dart'; 9 import 'package:analyzer/src/generated/engine.dart';
10 import 'package:analyzer/src/generated/error.dart'; 10 import 'package:analyzer/src/generated/error.dart';
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 } 63 }
64 64
65 65
66 @ReflectiveTestCase() 66 @ReflectiveTestCase()
67 class DeclarationMatcherTest extends ResolverTestCase { 67 class DeclarationMatcherTest extends ResolverTestCase {
68 void setUp() { 68 void setUp() {
69 super.setUp(); 69 super.setUp();
70 test_resolveApiChanges = true; 70 test_resolveApiChanges = true;
71 } 71 }
72 72
73 void test_false_class_annotation_edit() {
74 _assertDoesNotMatch(r'''
75 const my_annotationA = const Object();
76 const my_annotationB = const Object();
77 @my_annotationA
78 class A {
79 }
80 ''', r'''
81 const my_annotationA = const Object();
82 const my_annotationB = const Object();
83 @my_annotationB
84 class A {
85 }
86 ''');
87 }
88
89 void test_false_class_annotations_add() {
90 _assertDoesNotMatch(r'''
91 const my_annotation = const Object();
92 class A {
93 }
94 ''', r'''
95 const my_annotation = const Object();
96 @my_annotation
97 class A {
98 }
99 ''');
100 }
101
102 void test_false_class_annotations_remove() {
103 _assertDoesNotMatch(r'''
104 const my_annotation = const Object();
105 @my_annotation
106 class A {
107 }
108 ''', r'''
109 const my_annotation = const Object();
110 class A {
111 }
112 ''');
113 }
114
73 void test_false_class_list_add() { 115 void test_false_class_list_add() {
74 _assertDoesNotMatch(r''' 116 _assertDoesNotMatch(r'''
75 class A {} 117 class A {}
76 class B {} 118 class B {}
77 ''', r''' 119 ''', r'''
78 class A {} 120 class A {}
79 class B {} 121 class B {}
80 class C {} 122 class C {}
81 '''); 123 ''');
82 } 124 }
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 } 846 }
805 847
806 void test_false_import_show_remove() { 848 void test_false_import_show_remove() {
807 _assertDoesNotMatch(r''' 849 _assertDoesNotMatch(r'''
808 import 'dart:async' show Future, Stream; 850 import 'dart:async' show Future, Stream;
809 ''', r''' 851 ''', r'''
810 import 'dart:async' show Future; 852 import 'dart:async' show Future;
811 '''); 853 ''');
812 } 854 }
813 855
856 void test_false_method_annotation_edit() {
857 _assertDoesNotMatchOK(r'''
858 const my_annotationA = const Object();
859 const my_annotationB = const Object();
860 class A {
861 @my_annotationA
862 void m() {}
863 }
864 ''', r'''
865 const my_annotationA = const Object();
866 const my_annotationB = const Object();
867 class A {
868 @my_annotationB
869 void m() {}
870 }
871 ''');
872 }
873
874 void test_false_method_annotations_add() {
875 _assertDoesNotMatchOK(r'''
876 const my_annotation = const Object();
877 class A {
878 void m() {}
879 }
880 ''', r'''
881 const my_annotation = const Object();
882 class A {
883 @my_annotation
884 void m() {}
885 }
886 ''');
887 }
888
889 void test_false_method_annotations_remove() {
890 _assertDoesNotMatchOK(r'''
891 const my_annotation = const Object();
892 class A {
893 @my_annotation
894 void m() {}
895 }
896 ''', r'''
897 const my_annotation = const Object();
898 class A {
899 void m() {}
900 }
901 ''');
902 }
903
814 void test_false_method_list_add() { 904 void test_false_method_list_add() {
815 _assertDoesNotMatchOK(r''' 905 _assertDoesNotMatchOK(r'''
816 class A { 906 class A {
817 a() {} 907 a() {}
818 b() {} 908 b() {}
819 } 909 }
820 ''', r''' 910 ''', r'''
821 class A { 911 class A {
822 a() {} 912 a() {}
823 b() {} 913 b() {}
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
1176 class A {} 1266 class A {}
1177 class B {} 1267 class B {}
1178 class C extends Object with A, B {} 1268 class C extends Object with A, B {}
1179 ''', r''' 1269 ''', r'''
1180 class A {} 1270 class A {}
1181 class B {} 1271 class B {}
1182 class C extends Object with B, A {} 1272 class C extends Object with B, A {}
1183 '''); 1273 ''');
1184 } 1274 }
1185 1275
1276 void test_true_class_annotations_same() {
1277 _assertMatches(r'''
1278 const my_annotation = const Object();
1279 @my_annotation
1280 class A {
1281 }
1282 ''', r'''
1283 const my_annotation = const Object();
1284 @my_annotation
1285 class A {
1286 }
1287 ''');
1288 }
1289
1186 void test_true_class_list_reorder() { 1290 void test_true_class_list_reorder() {
1187 _assertMatches(r''' 1291 _assertMatches(r'''
1188 class A {} 1292 class A {}
1189 class B {} 1293 class B {}
1190 class C {} 1294 class C {}
1191 ''', r''' 1295 ''', r'''
1192 class C {} 1296 class C {}
1193 class A {} 1297 class A {}
1194 class B {} 1298 class B {}
1195 '''); 1299 ''');
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
1604 } 1708 }
1605 1709
1606 void test_true_import_show_reorder() { 1710 void test_true_import_show_reorder() {
1607 _assertMatches(r''' 1711 _assertMatches(r'''
1608 import 'dart:async' show Future, Stream; 1712 import 'dart:async' show Future, Stream;
1609 ''', r''' 1713 ''', r'''
1610 import 'dart:async' show Stream, Future; 1714 import 'dart:async' show Stream, Future;
1611 '''); 1715 ''');
1612 } 1716 }
1613 1717
1718 void test_true_method_annotations_same() {
1719 _assertMatches(r'''
1720 const my_annotation = const Object();
1721 class A {
1722 @my_annotation
1723 void m() {}
1724 }
1725 ''', r'''
1726 const my_annotation = const Object();
1727 class A {
1728 @my_annotation
1729 void m() {}
1730 }
1731 ''');
1732 }
1733
1614 void test_true_method_list_reorder() { 1734 void test_true_method_list_reorder() {
1615 _assertMatches(r''' 1735 _assertMatches(r'''
1616 class A { 1736 class A {
1617 a() {} 1737 a() {}
1618 b() {} 1738 b() {}
1619 c() {} 1739 c() {}
1620 } 1740 }
1621 ''', r''' 1741 ''', r'''
1622 class A { 1742 class A {
1623 c() {} 1743 c() {}
(...skipping 1778 matching lines...) Expand 10 before | Expand all | Expand 10 after
3402 } 3522 }
3403 } 3523 }
3404 3524
3405 3525
3406 class _Edit { 3526 class _Edit {
3407 final int offset; 3527 final int offset;
3408 final int length; 3528 final int length;
3409 final String replacement; 3529 final String replacement;
3410 _Edit(this.offset, this.length, this.replacement); 3530 _Edit(this.offset, this.length, this.replacement);
3411 } 3531 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/incremental_resolver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698