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/token.dart'; | 8 import 'package:analyzer/dart/ast/token.dart'; |
9 import 'package:analyzer/dart/ast/visitor.dart'; | 9 import 'package:analyzer/dart/ast/visitor.dart'; |
10 import 'package:analyzer/error/error.dart'; | 10 import 'package:analyzer/error/error.dart'; |
(...skipping 2752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2763 } | 2763 } |
2764 | 2764 |
2765 void test_withWithoutExtends() { | 2765 void test_withWithoutExtends() { |
2766 createParser('class A with B, C {}'); | 2766 createParser('class A with B, C {}'); |
2767 ClassDeclaration declaration = | 2767 ClassDeclaration declaration = |
2768 parser.parseClassDeclaration(emptyCommentAndMetadata(), null); | 2768 parser.parseClassDeclaration(emptyCommentAndMetadata(), null); |
2769 expectNotNullIfNoErrors(declaration); | 2769 expectNotNullIfNoErrors(declaration); |
2770 listener.assertErrorsWithCodes([ParserErrorCode.WITH_WITHOUT_EXTENDS]); | 2770 listener.assertErrorsWithCodes([ParserErrorCode.WITH_WITHOUT_EXTENDS]); |
2771 } | 2771 } |
2772 | 2772 |
2773 void test_wrongSeparatorForNamedParameter() { | |
2774 createParser('(a, {b = 0})'); | |
2775 FormalParameterList list = parser.parseFormalParameterList(); | |
2776 expectNotNullIfNoErrors(list); | |
2777 listener.assertErrorsWithCodes( | |
2778 [ParserErrorCode.WRONG_SEPARATOR_FOR_NAMED_PARAMETER]); | |
2779 } | |
2780 | |
2781 void test_wrongSeparatorForPositionalParameter() { | 2773 void test_wrongSeparatorForPositionalParameter() { |
2782 createParser('(a, [b : 0])'); | 2774 createParser('(a, [b : 0])'); |
2783 FormalParameterList list = parser.parseFormalParameterList(); | 2775 FormalParameterList list = parser.parseFormalParameterList(); |
2784 expectNotNullIfNoErrors(list); | 2776 expectNotNullIfNoErrors(list); |
2785 listener.assertErrorsWithCodes( | 2777 listener.assertErrorsWithCodes( |
2786 [ParserErrorCode.WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER]); | 2778 [ParserErrorCode.WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER]); |
2787 } | 2779 } |
2788 | 2780 |
2789 void test_wrongTerminatorForParameterGroup_named() { | 2781 void test_wrongTerminatorForParameterGroup_named() { |
2790 createParser('(a, {b, c])'); | 2782 createParser('(a, {b, c])'); |
(...skipping 10651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13442 CompilationUnit _parseDirectives(String source, | 13434 CompilationUnit _parseDirectives(String source, |
13443 [List<ErrorCode> errorCodes = ErrorCode.EMPTY_LIST]) { | 13435 [List<ErrorCode> errorCodes = ErrorCode.EMPTY_LIST]) { |
13444 createParser(source); | 13436 createParser(source); |
13445 CompilationUnit unit = parser.parseDirectives2(); | 13437 CompilationUnit unit = parser.parseDirectives2(); |
13446 expect(unit, isNotNull); | 13438 expect(unit, isNotNull); |
13447 expect(unit.declarations, hasLength(0)); | 13439 expect(unit.declarations, hasLength(0)); |
13448 listener.assertErrorsWithCodes(errorCodes); | 13440 listener.assertErrorsWithCodes(errorCodes); |
13449 return unit; | 13441 return unit; |
13450 } | 13442 } |
13451 } | 13443 } |
OLD | NEW |