| 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 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 expect(resynthesized.kind, original.kind); | 527 expect(resynthesized.kind, original.kind); |
| 528 expect(resynthesized.location, original.location, reason: desc); | 528 expect(resynthesized.location, original.location, reason: desc); |
| 529 expect(resynthesized.name, original.name); | 529 expect(resynthesized.name, original.name); |
| 530 expect(resynthesized.nameOffset, original.nameOffset, reason: desc); | 530 expect(resynthesized.nameOffset, original.nameOffset, reason: desc); |
| 531 expect(resynthesized.documentationComment, original.documentationComment, | 531 expect(resynthesized.documentationComment, original.documentationComment, |
| 532 reason: desc); | 532 reason: desc); |
| 533 expect(resynthesized.docRange, original.docRange, reason: desc); | 533 expect(resynthesized.docRange, original.docRange, reason: desc); |
| 534 compareMetadata(resynthesized.metadata, original.metadata, desc); | 534 compareMetadata(resynthesized.metadata, original.metadata, desc); |
| 535 // Modifiers are a pain to test via handles. So just test them via the | 535 // Modifiers are a pain to test via handles. So just test them via the |
| 536 // actual element. | 536 // actual element. |
| 537 for (Modifier modifier in Modifier.values) { | 537 for (Modifier modifier in Modifier.persistedValues) { |
| 538 bool got = rImpl.hasModifier(modifier); | 538 bool got = rImpl.hasModifier(modifier); |
| 539 bool want = oImpl.hasModifier(modifier); | 539 bool want = oImpl.hasModifier(modifier); |
| 540 expect(got, want, | 540 expect(got, want, |
| 541 reason: 'Mismatch in $desc.$modifier: got $got, want $want'); | 541 reason: 'Mismatch in $desc.$modifier: got $got, want $want'); |
| 542 } | 542 } |
| 543 for (Modifier modifier in Modifier.transientValues) { |
| 544 bool got = rImpl.hasModifier(modifier); |
| 545 bool want = false; |
| 546 expect(got, false, |
| 547 reason: 'Mismatch in $desc.$modifier: got $got, want $want'); |
| 548 } |
| 549 |
| 543 // Validate members. | 550 // Validate members. |
| 544 if (oImpl is Member) { | 551 if (oImpl is Member) { |
| 545 expect(rImpl, new isInstanceOf<Member>(), reason: desc); | 552 expect(rImpl, new isInstanceOf<Member>(), reason: desc); |
| 546 } else { | 553 } else { |
| 547 expect(rImpl, isNot(new isInstanceOf<Member>()), reason: desc); | 554 expect(rImpl, isNot(new isInstanceOf<Member>()), reason: desc); |
| 548 } | 555 } |
| 549 } | 556 } |
| 550 | 557 |
| 551 void compareExecutableElements(ExecutableElement resynthesized, | 558 void compareExecutableElements(ExecutableElement resynthesized, |
| 552 ExecutableElement original, String desc) { | 559 ExecutableElement original, String desc) { |
| (...skipping 3125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3678 fail('Unexpectedly tried to get unlinked summary for $uri'); | 3685 fail('Unexpectedly tried to get unlinked summary for $uri'); |
| 3679 } | 3686 } |
| 3680 return serializedUnit; | 3687 return serializedUnit; |
| 3681 } | 3688 } |
| 3682 | 3689 |
| 3683 @override | 3690 @override |
| 3684 bool hasLibrarySummary(String uri) { | 3691 bool hasLibrarySummary(String uri) { |
| 3685 return true; | 3692 return true; |
| 3686 } | 3693 } |
| 3687 } | 3694 } |
| OLD | NEW |