| 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 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 expect(resynthesized.kind, original.kind); | 516 expect(resynthesized.kind, original.kind); |
| 517 expect(resynthesized.location, original.location, reason: desc); | 517 expect(resynthesized.location, original.location, reason: desc); |
| 518 expect(resynthesized.name, original.name); | 518 expect(resynthesized.name, original.name); |
| 519 expect(resynthesized.nameOffset, original.nameOffset, reason: desc); | 519 expect(resynthesized.nameOffset, original.nameOffset, reason: desc); |
| 520 expect(resynthesized.documentationComment, original.documentationComment, | 520 expect(resynthesized.documentationComment, original.documentationComment, |
| 521 reason: desc); | 521 reason: desc); |
| 522 expect(resynthesized.docRange, original.docRange, reason: desc); | 522 expect(resynthesized.docRange, original.docRange, reason: desc); |
| 523 compareMetadata(resynthesized.metadata, original.metadata, desc); | 523 compareMetadata(resynthesized.metadata, original.metadata, desc); |
| 524 // Modifiers are a pain to test via handles. So just test them via the | 524 // Modifiers are a pain to test via handles. So just test them via the |
| 525 // actual element. | 525 // actual element. |
| 526 for (Modifier modifier in Modifier.values) { | 526 for (Modifier modifier in Modifier.persistedValues) { |
| 527 bool got = rImpl.hasModifier(modifier); | 527 bool got = rImpl.hasModifier(modifier); |
| 528 bool want = oImpl.hasModifier(modifier); | 528 bool want = oImpl.hasModifier(modifier); |
| 529 expect(got, want, | 529 expect(got, want, |
| 530 reason: 'Mismatch in $desc.$modifier: got $got, want $want'); | 530 reason: 'Mismatch in $desc.$modifier: got $got, want $want'); |
| 531 } | 531 } |
| 532 for (Modifier modifier in Modifier.transientValues) { |
| 533 bool got = rImpl.hasModifier(modifier); |
| 534 bool want = false; |
| 535 expect(got, false, |
| 536 reason: 'Mismatch in $desc.$modifier: got $got, want $want'); |
| 537 } |
| 538 |
| 532 // Validate members. | 539 // Validate members. |
| 533 if (oImpl is Member) { | 540 if (oImpl is Member) { |
| 534 expect(rImpl, new isInstanceOf<Member>(), reason: desc); | 541 expect(rImpl, new isInstanceOf<Member>(), reason: desc); |
| 535 } else { | 542 } else { |
| 536 expect(rImpl, isNot(new isInstanceOf<Member>()), reason: desc); | 543 expect(rImpl, isNot(new isInstanceOf<Member>()), reason: desc); |
| 537 } | 544 } |
| 538 } | 545 } |
| 539 | 546 |
| 540 void compareExecutableElements(ExecutableElement resynthesized, | 547 void compareExecutableElements(ExecutableElement resynthesized, |
| 541 ExecutableElement original, String desc) { | 548 ExecutableElement original, String desc) { |
| (...skipping 2965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3507 fail('Unexpectedly tried to get unlinked summary for $uri'); | 3514 fail('Unexpectedly tried to get unlinked summary for $uri'); |
| 3508 } | 3515 } |
| 3509 return serializedUnit; | 3516 return serializedUnit; |
| 3510 } | 3517 } |
| 3511 | 3518 |
| 3512 @override | 3519 @override |
| 3513 bool hasLibrarySummary(String uri) { | 3520 bool hasLibrarySummary(String uri) { |
| 3514 return true; | 3521 return true; |
| 3515 } | 3522 } |
| 3516 } | 3523 } |
| OLD | NEW |