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'; |
11 import 'package:analyzer/error/listener.dart'; | 11 import 'package:analyzer/error/listener.dart'; |
12 import 'package:analyzer/src/dart/ast/token.dart'; | 12 import 'package:analyzer/src/dart/ast/token.dart'; |
13 import 'package:analyzer/src/dart/scanner/reader.dart'; | 13 import 'package:analyzer/src/dart/scanner/reader.dart'; |
14 import 'package:analyzer/src/dart/scanner/scanner.dart'; | 14 import 'package:analyzer/src/dart/scanner/scanner.dart'; |
15 import 'package:analyzer/src/generated/parser.dart'; | 15 import 'package:analyzer/src/generated/parser.dart'; |
16 import 'package:analyzer/src/generated/source.dart'; | 16 import 'package:analyzer/src/generated/source.dart'; |
17 import 'package:analyzer/src/generated/testing/ast_factory.dart'; | 17 import 'package:analyzer/src/generated/testing/ast_test_factory.dart'; |
18 import 'package:analyzer/src/generated/testing/token_factory.dart'; | 18 import 'package:analyzer/src/generated/testing/token_factory.dart'; |
19 import 'package:analyzer/src/generated/utilities_dart.dart'; | 19 import 'package:analyzer/src/generated/utilities_dart.dart'; |
20 import 'package:test/test.dart'; | 20 import 'package:test/test.dart'; |
21 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 21 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
22 | 22 |
23 import 'test_support.dart'; | 23 import 'test_support.dart'; |
24 | 24 |
25 main() { | 25 main() { |
26 defineReflectiveSuite(() { | 26 defineReflectiveSuite(() { |
27 defineReflectiveTests(ComplexParserTest); | 27 defineReflectiveTests(ComplexParserTest); |
(...skipping 10281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10309 expect(expression, new isInstanceOf<BinaryExpression>()); | 10309 expect(expression, new isInstanceOf<BinaryExpression>()); |
10310 BinaryExpression binaryExpression = expression; | 10310 BinaryExpression binaryExpression = expression; |
10311 expect(binaryExpression.leftOperand, isNotNull); | 10311 expect(binaryExpression.leftOperand, isNotNull); |
10312 expect(binaryExpression.operator, isNotNull); | 10312 expect(binaryExpression.operator, isNotNull); |
10313 expect(binaryExpression.operator.type, TokenType.BAR_BAR); | 10313 expect(binaryExpression.operator.type, TokenType.BAR_BAR); |
10314 expect(binaryExpression.rightOperand, isNotNull); | 10314 expect(binaryExpression.rightOperand, isNotNull); |
10315 } | 10315 } |
10316 | 10316 |
10317 void test_parseMapLiteral_empty() { | 10317 void test_parseMapLiteral_empty() { |
10318 Token token = TokenFactory.tokenFromKeyword(Keyword.CONST); | 10318 Token token = TokenFactory.tokenFromKeyword(Keyword.CONST); |
10319 TypeArgumentList typeArguments = AstFactory.typeArgumentList( | 10319 TypeArgumentList typeArguments = AstTestFactory.typeArgumentList( |
10320 [AstFactory.typeName4("String"), AstFactory.typeName4("int")]); | 10320 [AstTestFactory.typeName4("String"), AstTestFactory.typeName4("int")]); |
10321 createParser('{}'); | 10321 createParser('{}'); |
10322 MapLiteral literal = parser.parseMapLiteral(token, typeArguments); | 10322 MapLiteral literal = parser.parseMapLiteral(token, typeArguments); |
10323 expectNotNullIfNoErrors(literal); | 10323 expectNotNullIfNoErrors(literal); |
10324 listener.assertNoErrors(); | 10324 listener.assertNoErrors(); |
10325 expect(literal.constKeyword, token); | 10325 expect(literal.constKeyword, token); |
10326 expect(literal.typeArguments, typeArguments); | 10326 expect(literal.typeArguments, typeArguments); |
10327 expect(literal.leftBracket, isNotNull); | 10327 expect(literal.leftBracket, isNotNull); |
10328 expect(literal.entries, hasLength(0)); | 10328 expect(literal.entries, hasLength(0)); |
10329 expect(literal.rightBracket, isNotNull); | 10329 expect(literal.rightBracket, isNotNull); |
10330 } | 10330 } |
(...skipping 3095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13426 CompilationUnit _parseDirectives(String source, | 13426 CompilationUnit _parseDirectives(String source, |
13427 [List<ErrorCode> errorCodes = const <ErrorCode>[]]) { | 13427 [List<ErrorCode> errorCodes = const <ErrorCode>[]]) { |
13428 createParser(source); | 13428 createParser(source); |
13429 CompilationUnit unit = parser.parseDirectives2(); | 13429 CompilationUnit unit = parser.parseDirectives2(); |
13430 expect(unit, isNotNull); | 13430 expect(unit, isNotNull); |
13431 expect(unit.declarations, hasLength(0)); | 13431 expect(unit.declarations, hasLength(0)); |
13432 listener.assertErrorsWithCodes(errorCodes); | 13432 listener.assertErrorsWithCodes(errorCodes); |
13433 return unit; | 13433 return unit; |
13434 } | 13434 } |
13435 } | 13435 } |
OLD | NEW |