| 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 analyzer.test.generated.parser_test; | 5 library analyzer.test.generated.parser_test; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
| 8 import 'package:analyzer/dart/ast/standard_ast_factory.dart'; | 8 import 'package:analyzer/dart/ast/standard_ast_factory.dart'; |
| 9 import 'package:analyzer/dart/ast/token.dart'; | 9 import 'package:analyzer/dart/ast/token.dart'; |
| 10 import 'package:analyzer/dart/ast/visitor.dart'; | 10 import 'package:analyzer/dart/ast/visitor.dart'; |
| (...skipping 13737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13748 Directive directive = parseFullDirective(); | 13748 Directive directive = parseFullDirective(); |
| 13749 expect(directive, isNotNull); | 13749 expect(directive, isNotNull); |
| 13750 assertNoErrors(); | 13750 assertNoErrors(); |
| 13751 expect(directive, new isInstanceOf<LibraryDirective>()); | 13751 expect(directive, new isInstanceOf<LibraryDirective>()); |
| 13752 LibraryDirective libraryDirective = directive; | 13752 LibraryDirective libraryDirective = directive; |
| 13753 expect(libraryDirective.libraryKeyword, isNotNull); | 13753 expect(libraryDirective.libraryKeyword, isNotNull); |
| 13754 expect(libraryDirective.name, isNotNull); | 13754 expect(libraryDirective.name, isNotNull); |
| 13755 expect(libraryDirective.semicolon, isNotNull); | 13755 expect(libraryDirective.semicolon, isNotNull); |
| 13756 } | 13756 } |
| 13757 | 13757 |
| 13758 void test_parseDirective_library_1_component() { |
| 13759 createParser("library a;"); |
| 13760 var lib = parseFullDirective() as LibraryDirective; |
| 13761 expect(lib.name.components, hasLength(1)); |
| 13762 expect(lib.name.components[0].name, 'a'); |
| 13763 } |
| 13764 |
| 13765 void test_parseDirective_library_2_components() { |
| 13766 createParser("library a.b;"); |
| 13767 var lib = parseFullDirective() as LibraryDirective; |
| 13768 expect(lib.name.components, hasLength(2)); |
| 13769 expect(lib.name.components[0].name, 'a'); |
| 13770 expect(lib.name.components[1].name, 'b'); |
| 13771 } |
| 13772 |
| 13773 void test_parseDirective_library_3_components() { |
| 13774 createParser("library a.b.c;"); |
| 13775 var lib = parseFullDirective() as LibraryDirective; |
| 13776 expect(lib.name.components, hasLength(3)); |
| 13777 expect(lib.name.components[0].name, 'a'); |
| 13778 expect(lib.name.components[1].name, 'b'); |
| 13779 expect(lib.name.components[2].name, 'c'); |
| 13780 } |
| 13781 |
| 13758 void test_parseDirective_part() { | 13782 void test_parseDirective_part() { |
| 13759 createParser("part 'lib/lib.dart';"); | 13783 createParser("part 'lib/lib.dart';"); |
| 13760 Directive directive = parseFullDirective(); | 13784 Directive directive = parseFullDirective(); |
| 13761 expect(directive, isNotNull); | 13785 expect(directive, isNotNull); |
| 13762 assertNoErrors(); | 13786 assertNoErrors(); |
| 13763 expect(directive, new isInstanceOf<PartDirective>()); | 13787 expect(directive, new isInstanceOf<PartDirective>()); |
| 13764 PartDirective partDirective = directive; | 13788 PartDirective partDirective = directive; |
| 13765 expect(partDirective.partKeyword, isNotNull); | 13789 expect(partDirective.partKeyword, isNotNull); |
| 13766 expect(partDirective.uri, isNotNull); | 13790 expect(partDirective.uri, isNotNull); |
| 13767 expect(partDirective.semicolon, isNotNull); | 13791 expect(partDirective.semicolon, isNotNull); |
| 13768 } | 13792 } |
| 13769 | 13793 |
| 13794 void test_parseDirective_part_of_1_component() { |
| 13795 createParser("part of a;"); |
| 13796 var partOf = parseFullDirective() as PartOfDirective; |
| 13797 expect(partOf.libraryName.components, hasLength(1)); |
| 13798 expect(partOf.libraryName.components[0].name, 'a'); |
| 13799 } |
| 13800 |
| 13801 void test_parseDirective_part_of_2_components() { |
| 13802 createParser("part of a.b;"); |
| 13803 var partOf = parseFullDirective() as PartOfDirective; |
| 13804 expect(partOf.libraryName.components, hasLength(2)); |
| 13805 expect(partOf.libraryName.components[0].name, 'a'); |
| 13806 expect(partOf.libraryName.components[1].name, 'b'); |
| 13807 } |
| 13808 |
| 13809 void test_parseDirective_part_of_3_components() { |
| 13810 createParser("part of a.b.c;"); |
| 13811 var partOf = parseFullDirective() as PartOfDirective; |
| 13812 expect(partOf.libraryName.components, hasLength(3)); |
| 13813 expect(partOf.libraryName.components[0].name, 'a'); |
| 13814 expect(partOf.libraryName.components[1].name, 'b'); |
| 13815 expect(partOf.libraryName.components[2].name, 'c'); |
| 13816 } |
| 13817 |
| 13770 void test_parseDirective_partOf() { | 13818 void test_parseDirective_partOf() { |
| 13771 createParser("part of l;"); | 13819 createParser("part of l;"); |
| 13772 Directive directive = parseFullDirective(); | 13820 Directive directive = parseFullDirective(); |
| 13773 expect(directive, isNotNull); | 13821 expect(directive, isNotNull); |
| 13774 assertNoErrors(); | 13822 assertNoErrors(); |
| 13775 expect(directive, new isInstanceOf<PartOfDirective>()); | 13823 expect(directive, new isInstanceOf<PartOfDirective>()); |
| 13776 PartOfDirective partOfDirective = directive; | 13824 PartOfDirective partOfDirective = directive; |
| 13777 expect(partOfDirective.partKeyword, isNotNull); | 13825 expect(partOfDirective.partKeyword, isNotNull); |
| 13778 expect(partOfDirective.ofKeyword, isNotNull); | 13826 expect(partOfDirective.ofKeyword, isNotNull); |
| 13779 expect(partOfDirective.libraryName, isNotNull); | 13827 expect(partOfDirective.libraryName, isNotNull); |
| (...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14491 expect(typeAlias.name, isNotNull); | 14539 expect(typeAlias.name, isNotNull); |
| 14492 expect(typeAlias.typeParameters, isNull); | 14540 expect(typeAlias.typeParameters, isNull); |
| 14493 expect(typeAlias.semicolon, isNotNull); | 14541 expect(typeAlias.semicolon, isNotNull); |
| 14494 GenericFunctionType functionType = typeAlias.functionType; | 14542 GenericFunctionType functionType = typeAlias.functionType; |
| 14495 expect(functionType, isNotNull); | 14543 expect(functionType, isNotNull); |
| 14496 expect(functionType.parameters, isNotNull); | 14544 expect(functionType.parameters, isNotNull); |
| 14497 expect(functionType.returnType, isNotNull); | 14545 expect(functionType.returnType, isNotNull); |
| 14498 expect(functionType.typeParameters, isNull); | 14546 expect(functionType.typeParameters, isNull); |
| 14499 } | 14547 } |
| 14500 } | 14548 } |
| OLD | NEW |