| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.src.serialization.elements_test; | 5 library test.src.serialization.elements_test; |
| 6 | 6 |
| 7 import 'dart:convert'; | 7 import 'dart:convert'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 expect(resynthesized.combinators.length, original.combinators.length); | 513 expect(resynthesized.combinators.length, original.combinators.length); |
| 514 for (int i = 0; i < resynthesized.combinators.length; i++) { | 514 for (int i = 0; i < resynthesized.combinators.length; i++) { |
| 515 compareNamespaceCombinators( | 515 compareNamespaceCombinators( |
| 516 resynthesized.combinators[i], original.combinators[i]); | 516 resynthesized.combinators[i], original.combinators[i]); |
| 517 } | 517 } |
| 518 } | 518 } |
| 519 | 519 |
| 520 void compareFieldElements( | 520 void compareFieldElements( |
| 521 FieldElementImpl resynthesized, FieldElementImpl original, String desc) { | 521 FieldElementImpl resynthesized, FieldElementImpl original, String desc) { |
| 522 comparePropertyInducingElements(resynthesized, original, desc); | 522 comparePropertyInducingElements(resynthesized, original, desc); |
| 523 // TODO(paulberry): test evaluationResult | |
| 524 } | 523 } |
| 525 | 524 |
| 526 void compareFunctionElements( | 525 void compareFunctionElements( |
| 527 FunctionElement resynthesized, FunctionElement original, String desc) { | 526 FunctionElement resynthesized, FunctionElement original, String desc) { |
| 528 compareExecutableElements(resynthesized, original, desc); | 527 compareExecutableElements(resynthesized, original, desc); |
| 529 } | 528 } |
| 530 | 529 |
| 531 void compareFunctionTypeAliasElements( | 530 void compareFunctionTypeAliasElements( |
| 532 FunctionTypeAliasElementImpl resynthesized, | 531 FunctionTypeAliasElementImpl resynthesized, |
| 533 FunctionTypeAliasElementImpl original, | 532 FunctionTypeAliasElementImpl original, |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 expect(resynthesized.setter, isNotNull); | 676 expect(resynthesized.setter, isNotNull); |
| 678 expect(resynthesized.setter.location, original.setter.location); | 677 expect(resynthesized.setter.location, original.setter.location); |
| 679 } | 678 } |
| 680 } | 679 } |
| 681 | 680 |
| 682 void compareTopLevelVariableElements( | 681 void compareTopLevelVariableElements( |
| 683 TopLevelVariableElementImpl resynthesized, | 682 TopLevelVariableElementImpl resynthesized, |
| 684 TopLevelVariableElementImpl original, | 683 TopLevelVariableElementImpl original, |
| 685 String desc) { | 684 String desc) { |
| 686 comparePropertyInducingElements(resynthesized, original, desc); | 685 comparePropertyInducingElements(resynthesized, original, desc); |
| 687 // TODO(paulberry): test evaluationResult | |
| 688 } | 686 } |
| 689 | 687 |
| 690 void compareTypeImpls( | 688 void compareTypeImpls( |
| 691 TypeImpl resynthesized, TypeImpl original, String desc) { | 689 TypeImpl resynthesized, TypeImpl original, String desc) { |
| 692 expect(resynthesized.element.location, original.element.location, | 690 expect(resynthesized.element.location, original.element.location, |
| 693 reason: desc); | 691 reason: desc); |
| 694 expect(resynthesized.name, original.name, reason: desc); | 692 expect(resynthesized.name, original.name, reason: desc); |
| 695 } | 693 } |
| 696 | 694 |
| 697 void compareTypeParameterElements(TypeParameterElementImpl resynthesized, | 695 void compareTypeParameterElements(TypeParameterElementImpl resynthesized, |
| (...skipping 1538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2236 test_function_entry_point_in_part() { | 2234 test_function_entry_point_in_part() { |
| 2237 addNamedSource('/a.dart', 'part of my.lib; main() {}'); | 2235 addNamedSource('/a.dart', 'part of my.lib; main() {}'); |
| 2238 checkLibrary('library my.lib; part "a.dart";'); | 2236 checkLibrary('library my.lib; part "a.dart";'); |
| 2239 } | 2237 } |
| 2240 | 2238 |
| 2241 test_function_external() { | 2239 test_function_external() { |
| 2242 checkLibrary('external f();'); | 2240 checkLibrary('external f();'); |
| 2243 } | 2241 } |
| 2244 | 2242 |
| 2245 test_function_parameter_kind_named() { | 2243 test_function_parameter_kind_named() { |
| 2246 // TODO(paulberry): also test default value. | |
| 2247 checkLibrary('f({x}) {}'); | 2244 checkLibrary('f({x}) {}'); |
| 2248 } | 2245 } |
| 2249 | 2246 |
| 2250 test_function_parameter_kind_positional() { | 2247 test_function_parameter_kind_positional() { |
| 2251 // TODO(paulberry): also test default value. | |
| 2252 checkLibrary('f([x]) {}'); | 2248 checkLibrary('f([x]) {}'); |
| 2253 } | 2249 } |
| 2254 | 2250 |
| 2255 test_function_parameter_kind_required() { | 2251 test_function_parameter_kind_required() { |
| 2256 checkLibrary('f(x) {}'); | 2252 checkLibrary('f(x) {}'); |
| 2257 } | 2253 } |
| 2258 | 2254 |
| 2259 test_function_parameter_parameters() { | 2255 test_function_parameter_parameters() { |
| 2260 checkLibrary('f(g(x, y)) {}'); | 2256 checkLibrary('f(g(x, y)) {}'); |
| 2261 } | 2257 } |
| (...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3144 fail('Unexpectedly tried to get unlinked summary for $uri'); | 3140 fail('Unexpectedly tried to get unlinked summary for $uri'); |
| 3145 } | 3141 } |
| 3146 return serializedUnit; | 3142 return serializedUnit; |
| 3147 } | 3143 } |
| 3148 | 3144 |
| 3149 @override | 3145 @override |
| 3150 bool hasLibrarySummary(String uri) { | 3146 bool hasLibrarySummary(String uri) { |
| 3151 return true; | 3147 return true; |
| 3152 } | 3148 } |
| 3153 } | 3149 } |
| OLD | NEW |