| OLD | NEW |
| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 } | 45 } |
| 46 }''', r''' | 46 }''', r''' |
| 47 class C { | 47 class C { |
| 48 int m(int p) { | 48 int m(int p) { |
| 49 int product = p * p; | 49 int product = p * p; |
| 50 return product + product; | 50 return product + product; |
| 51 } | 51 } |
| 52 }'''); | 52 }'''); |
| 53 } | 53 } |
| 54 | 54 |
| 55 void test_compilationUnitMatches_true_different() { | |
| 56 _assertCompilationUnitMatches(true, r''' | |
| 57 class C { | |
| 58 int m(int p) { | |
| 59 return p + p; | |
| 60 } | |
| 61 }''', r''' | |
| 62 class C { | |
| 63 int m(int p) { | |
| 64 return (p * p) + (p * p); | |
| 65 } | |
| 66 }'''); | |
| 67 } | |
| 68 | |
| 69 void test_compilationUnitMatches_true_same() { | |
| 70 String content = r''' | |
| 71 class C { | |
| 72 int m(int p) { | |
| 73 return p + p; | |
| 74 } | |
| 75 }'''; | |
| 76 _assertCompilationUnitMatches(true, content, content); | |
| 77 } | |
| 78 | |
| 79 void test_false_class_list_add() { | 55 void test_false_class_list_add() { |
| 80 _assertCompilationUnitMatches(false, r''' | 56 _assertCompilationUnitMatches(false, r''' |
| 81 class A {} | 57 class A {} |
| 82 class B {} | 58 class B {} |
| 83 ''', r''' | 59 ''', r''' |
| 84 class A {} | 60 class A {} |
| 85 class B {} | 61 class B {} |
| 86 class C {} | 62 class C {} |
| 87 '''); | 63 '''); |
| 88 } | 64 } |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 class A {} | 233 class A {} |
| 258 class B {} | 234 class B {} |
| 259 class C extends Object with A, B {} | 235 class C extends Object with A, B {} |
| 260 ''', r''' | 236 ''', r''' |
| 261 class A {} | 237 class A {} |
| 262 class B {} | 238 class B {} |
| 263 class C extends Object with B, A {} | 239 class C extends Object with B, A {} |
| 264 '''); | 240 '''); |
| 265 } | 241 } |
| 266 | 242 |
| 267 void test_methodDeclarationMatches_false_parameter() { | |
| 268 _assertMethodMatches(false, r''' | |
| 269 class C { | |
| 270 int m(int p) { | |
| 271 return p + p; | |
| 272 } | |
| 273 }''', r''' | |
| 274 class C { | |
| 275 int m(int p, int q) { | |
| 276 return (p * q) + (q * p); | |
| 277 } | |
| 278 }'''); | |
| 279 } | |
| 280 | |
| 281 void test_methodDeclarationMatches_true_different() { | |
| 282 _assertMethodMatches(true, r''' | |
| 283 class C { | |
| 284 int m(int p) { | |
| 285 return p + p; | |
| 286 } | |
| 287 }''', r''' | |
| 288 class C { | |
| 289 int m(int p) { | |
| 290 return (p * p) + (p * p); | |
| 291 } | |
| 292 }'''); | |
| 293 } | |
| 294 | |
| 295 void test_methodDeclarationMatches_true_same() { | |
| 296 String content = r''' | |
| 297 class C { | |
| 298 int m(int p) { | |
| 299 return p + p; | |
| 300 } | |
| 301 }'''; | |
| 302 _assertMethodMatches(true, content, content); | |
| 303 } | |
| 304 | |
| 305 void test_true_class_list_reorder() { | 243 void test_true_class_list_reorder() { |
| 306 _assertCompilationUnitMatches(true, r''' | 244 _assertCompilationUnitMatches(true, r''' |
| 307 class A {} | 245 class A {} |
| 308 class B {} | 246 class B {} |
| 309 class C {} | 247 class C {} |
| 310 ''', r''' | 248 ''', r''' |
| 311 class C {} | 249 class C {} |
| 312 class A {} | 250 class A {} |
| 313 class B {} | 251 class B {} |
| 314 '''); | 252 '''); |
| (...skipping 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1643 _visitList(node.metadata, other.metadata); | 1581 _visitList(node.metadata, other.metadata); |
| 1644 _visitNode(node.identifier, other.identifier); | 1582 _visitNode(node.identifier, other.identifier); |
| 1645 } | 1583 } |
| 1646 | 1584 |
| 1647 static void assertSameResolution(CompilationUnit actual, | 1585 static void assertSameResolution(CompilationUnit actual, |
| 1648 CompilationUnit expected) { | 1586 CompilationUnit expected) { |
| 1649 _SameResolutionValidator validator = new _SameResolutionValidator(expected); | 1587 _SameResolutionValidator validator = new _SameResolutionValidator(expected); |
| 1650 actual.accept(validator); | 1588 actual.accept(validator); |
| 1651 } | 1589 } |
| 1652 } | 1590 } |
| OLD | NEW |