| 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 analyzer.test.src.summary.summary_common; | 5 library analyzer.test.src.summary.summary_common; |
| 6 | 6 |
| 7 import 'package:analyzer/analyzer.dart'; | 7 import 'package:analyzer/analyzer.dart'; |
| 8 import 'package:analyzer/dart/ast/ast.dart'; | 8 import 'package:analyzer/dart/ast/ast.dart'; |
| 9 import 'package:analyzer/dart/element/element.dart'; | 9 import 'package:analyzer/dart/element/element.dart'; |
| 10 import 'package:analyzer/src/generated/engine.dart'; | 10 import 'package:analyzer/src/generated/engine.dart'; |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 unlinkedSourceUnit: unlinkedSourceUnit); | 607 unlinkedSourceUnit: unlinkedSourceUnit); |
| 608 } | 608 } |
| 609 | 609 |
| 610 /** | 610 /** |
| 611 * Verify that the given [typeRef] represents the type `void`. | 611 * Verify that the given [typeRef] represents the type `void`. |
| 612 */ | 612 */ |
| 613 void checkVoidTypeRef(EntityRef typeRef) { | 613 void checkVoidTypeRef(EntityRef typeRef) { |
| 614 checkTypeRef(typeRef, null, null, 'void'); | 614 checkTypeRef(typeRef, null, null, 'void'); |
| 615 } | 615 } |
| 616 | 616 |
| 617 fail_enum_value_documented() { | |
| 618 // TODO(paulberry): currently broken because of dartbug.com/25385 | |
| 619 String text = ''' | |
| 620 enum E { | |
| 621 /** | |
| 622 * Docs | |
| 623 */ | |
| 624 v | |
| 625 }'''; | |
| 626 UnlinkedEnumValue value = serializeEnumText(text).values[0]; | |
| 627 expect(value.documentationComment, isNotNull); | |
| 628 checkDocumentationComment(value.documentationComment, text); | |
| 629 } | |
| 630 | |
| 631 /** | 617 /** |
| 632 * Find the class with the given [className] in the summary, and return its | 618 * Find the class with the given [className] in the summary, and return its |
| 633 * [UnlinkedClass] data structure. If [unit] is not given, the class is | 619 * [UnlinkedClass] data structure. If [unit] is not given, the class is |
| 634 * looked for in the defining compilation unit. | 620 * looked for in the defining compilation unit. |
| 635 */ | 621 */ |
| 636 UnlinkedClass findClass(String className, | 622 UnlinkedClass findClass(String className, |
| 637 {bool failIfAbsent: false, UnlinkedUnit unit}) { | 623 {bool failIfAbsent: false, UnlinkedUnit unit}) { |
| 638 unit ??= unlinkedUnits[0]; | 624 unit ??= unlinkedUnits[0]; |
| 639 UnlinkedClass result; | 625 UnlinkedClass result; |
| 640 for (UnlinkedClass cls in unit.classes) { | 626 for (UnlinkedClass cls in unit.classes) { |
| (...skipping 3081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3722 expect(e.values, hasLength(2)); | 3708 expect(e.values, hasLength(2)); |
| 3723 expect(e.values[0].name, 'v1'); | 3709 expect(e.values[0].name, 'v1'); |
| 3724 expect(e.values[1].name, 'v2'); | 3710 expect(e.values[1].name, 'v2'); |
| 3725 } | 3711 } |
| 3726 | 3712 |
| 3727 test_enum_private() { | 3713 test_enum_private() { |
| 3728 serializeEnumText('enum _E { v1 }', '_E'); | 3714 serializeEnumText('enum _E { v1 }', '_E'); |
| 3729 expect(unlinkedUnits[0].publicNamespace.names, isEmpty); | 3715 expect(unlinkedUnits[0].publicNamespace.names, isEmpty); |
| 3730 } | 3716 } |
| 3731 | 3717 |
| 3718 test_enum_value_documented() { |
| 3719 String text = ''' |
| 3720 enum E { |
| 3721 /** |
| 3722 * Docs |
| 3723 */ |
| 3724 v |
| 3725 }'''; |
| 3726 UnlinkedEnumValue value = serializeEnumText(text).values[0]; |
| 3727 expect(value.documentationComment, isNotNull); |
| 3728 checkDocumentationComment(value.documentationComment, text); |
| 3729 } |
| 3730 |
| 3732 test_executable_abstract() { | 3731 test_executable_abstract() { |
| 3733 UnlinkedExecutable executable = | 3732 UnlinkedExecutable executable = |
| 3734 serializeClassText('abstract class C { f(); }').executables[0]; | 3733 serializeClassText('abstract class C { f(); }').executables[0]; |
| 3735 expect(executable.isAbstract, isTrue); | 3734 expect(executable.isAbstract, isTrue); |
| 3736 } | 3735 } |
| 3737 | 3736 |
| 3738 test_executable_concrete() { | 3737 test_executable_concrete() { |
| 3739 UnlinkedExecutable executable = | 3738 UnlinkedExecutable executable = |
| 3740 serializeClassText('abstract class C { f() {} }').executables[0]; | 3739 serializeClassText('abstract class C { f() {} }').executables[0]; |
| 3741 expect(executable.isAbstract, isFalse); | 3740 expect(executable.isAbstract, isFalse); |
| (...skipping 2822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6564 final String absoluteUri; | 6563 final String absoluteUri; |
| 6565 final String relativeUri; | 6564 final String relativeUri; |
| 6566 final int numTypeParameters; | 6565 final int numTypeParameters; |
| 6567 | 6566 |
| 6568 _PrefixExpectation(this.kind, this.name, | 6567 _PrefixExpectation(this.kind, this.name, |
| 6569 {this.inLibraryDefiningUnit: false, | 6568 {this.inLibraryDefiningUnit: false, |
| 6570 this.absoluteUri, | 6569 this.absoluteUri, |
| 6571 this.relativeUri, | 6570 this.relativeUri, |
| 6572 this.numTypeParameters: 0}); | 6571 this.numTypeParameters: 0}); |
| 6573 } | 6572 } |
| OLD | NEW |