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

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

Issue 747503002: Tests for matching constructors. (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/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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 _assertCompilationUnitMatches(false, r''' 67 _assertCompilationUnitMatches(false, r'''
68 class A {} 68 class A {}
69 class B {} 69 class B {}
70 class C {} 70 class C {}
71 ''', r''' 71 ''', r'''
72 class A {} 72 class A {}
73 class B {} 73 class B {}
74 '''); 74 ''');
75 } 75 }
76 76
77 void test_false_constructor_parameters_list_add() {
78 _assertCompilationUnitMatches(false, r'''
79 class A {
80 A();
81 }
82 ''', r'''
83 class A {
84 A(int p);
85 }
86 ''');
87 }
88
89 void test_false_constructor_parameters_list_remove() {
90 _assertCompilationUnitMatches(false, r'''
91 class A {
92 A(int p);
93 }
94 ''', r'''
95 class A {
96 A();
97 }
98 ''');
99 }
100
101 void test_false_constructor_parameters_type_edit() {
102 _assertCompilationUnitMatches(false, r'''
103 class A {
104 A(int p);
105 }
106 ''', r'''
107 class A {
108 A(String p);
109 }
110 ''');
111 }
112
113 void test_false_constructor_unnamed_add_hadParameters() {
114 _assertCompilationUnitMatches(false, r'''
115 class A {
116 }
117 ''', r'''
118 class A {
119 A(int p) {}
120 }
121 ''');
122 }
123
124 void test_false_constructor_unnamed_remove_hadParameters() {
125 _assertCompilationUnitMatches(false, r'''
126 class A {
127 A(int p) {}
128 }
129 ''', r'''
130 class A {
131 }
132 ''');
133 }
134
77 void test_false_extendsClause_add() { 135 void test_false_extendsClause_add() {
78 _assertCompilationUnitMatches(false, r''' 136 _assertCompilationUnitMatches(false, r'''
79 class A {} 137 class A {}
80 class B {} 138 class B {}
81 ''', r''' 139 ''', r'''
82 class A {} 140 class A {}
83 class B extends A {} 141 class B extends A {}
84 '''); 142 ''');
85 } 143 }
86 144
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 } 323 }
266 324
267 void test_true_class_typeParameters_same() { 325 void test_true_class_typeParameters_same() {
268 _assertCompilationUnitMatches(true, r''' 326 _assertCompilationUnitMatches(true, r'''
269 class A<T> {} 327 class A<T> {}
270 ''', r''' 328 ''', r'''
271 class A<T> {} 329 class A<T> {}
272 '''); 330 ''');
273 } 331 }
274 332
333 void test_true_constructor_named_same() {
334 _assertCompilationUnitMatches(true, r'''
335 class A {
336 A.name(int p);
337 }
338 ''', r'''
339 class A {
340 A.name(int p);
341 }
342 ''');
343 }
344
345 void test_true_constructor_unnamed_add_noParameters() {
346 _assertCompilationUnitMatches(true, r'''
347 class A {
348 }
349 ''', r'''
350 class A {
351 A() {}
352 }
353 ''');
354 }
355
356 void test_true_constructor_unnamed_remove_noParameters() {
357 _assertCompilationUnitMatches(true, r'''
358 class A {
359 A() {}
360 }
361 ''', r'''
362 class A {
363 }
364 ''');
365 }
366
367 void test_true_constructor_unnamed_same() {
368 _assertCompilationUnitMatches(true, r'''
369 class A {
370 A(int p);
371 }
372 ''', r'''
373 class A {
374 A(int p);
375 }
376 ''');
377 }
378
275 void test_true_extendsClause_same() { 379 void test_true_extendsClause_same() {
276 _assertCompilationUnitMatches(true, r''' 380 _assertCompilationUnitMatches(true, r'''
277 class A {} 381 class A {}
278 class B extends A {} 382 class B extends A {}
279 ''', r''' 383 ''', r'''
280 class A {} 384 class A {}
281 class B extends A {} 385 class B extends A {}
282 '''); 386 ''');
283 } 387 }
284 388
(...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after
1581 _visitList(node.metadata, other.metadata); 1685 _visitList(node.metadata, other.metadata);
1582 _visitNode(node.identifier, other.identifier); 1686 _visitNode(node.identifier, other.identifier);
1583 } 1687 }
1584 1688
1585 static void assertSameResolution(CompilationUnit actual, 1689 static void assertSameResolution(CompilationUnit actual,
1586 CompilationUnit expected) { 1690 CompilationUnit expected) {
1587 _SameResolutionValidator validator = new _SameResolutionValidator(expected); 1691 _SameResolutionValidator validator = new _SameResolutionValidator(expected);
1588 actual.accept(validator); 1692 actual.accept(validator);
1589 } 1693 }
1590 } 1694 }
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