Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Side by Side Diff: pkg/analyzer/test/generated/parser_fasta_test.dart

Issue 2731313002: Fixes for map literal tests. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/parser_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 import 'package:analyzer/dart/ast/ast.dart'; 5 import 'package:analyzer/dart/ast/ast.dart';
6 import 'package:analyzer/dart/ast/token.dart' as analyzer; 6 import 'package:analyzer/dart/ast/token.dart' as analyzer;
7 import 'package:analyzer/dart/element/element.dart'; 7 import 'package:analyzer/dart/element/element.dart';
8 import 'package:analyzer/error/error.dart'; 8 import 'package:analyzer/error/error.dart';
9 import 'package:analyzer/src/generated/parser.dart' as analyzer; 9 import 'package:analyzer/src/generated/parser.dart' as analyzer;
10 import 'package:analyzer/src/generated/utilities_dart.dart'; 10 import 'package:analyzer/src/generated/utilities_dart.dart';
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 } 544 }
545 545
546 @override 546 @override
547 @failingTest 547 @failingTest
548 void test_parseListOrMapLiteral_map_type() { 548 void test_parseListOrMapLiteral_map_type() {
549 super.test_parseListOrMapLiteral_map_type(); 549 super.test_parseListOrMapLiteral_map_type();
550 } 550 }
551 551
552 @override 552 @override
553 @failingTest 553 @failingTest
554 void test_parseMapLiteral_empty() {
555 super.test_parseMapLiteral_empty();
556 }
557
558 @override
559 @failingTest
560 void test_parseMapLiteral_multiple() {
561 super.test_parseMapLiteral_multiple();
562 }
563
564 @override
565 @failingTest
566 void test_parseMapLiteral_single() {
567 super.test_parseMapLiteral_single();
568 }
569
570 @override
571 @failingTest
572 void test_parseMapLiteralEntry_complex() {
573 super.test_parseMapLiteralEntry_complex();
574 }
575
576 @override
577 @failingTest
578 void test_parseMapLiteralEntry_int() {
579 super.test_parseMapLiteralEntry_int();
580 }
581
582 @override
583 @failingTest
584 void test_parseMapLiteralEntry_string() {
585 super.test_parseMapLiteralEntry_string();
586 }
587
588 @override
589 @failingTest
590 void 554 void
591 test_parsePostfixExpression_none_methodInvocation_question_dot_typeArgumen tComments() { 555 test_parsePostfixExpression_none_methodInvocation_question_dot_typeArgumen tComments() {
592 super 556 super
593 .test_parsePostfixExpression_none_methodInvocation_question_dot_typeArgu mentComments(); 557 .test_parsePostfixExpression_none_methodInvocation_question_dot_typeArgu mentComments();
594 } 558 }
595 559
596 @override 560 @override
597 @failingTest 561 @failingTest
598 void 562 void
599 test_parsePostfixExpression_none_methodInvocation_typeArgumentComments() { 563 test_parsePostfixExpression_none_methodInvocation_typeArgumentComments() {
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
942 MapLiteral parseMapLiteral( 906 MapLiteral parseMapLiteral(
943 analyzer.Token token, String typeArgumentsCode, String code) { 907 analyzer.Token token, String typeArgumentsCode, String code) {
944 String sc = ''; 908 String sc = '';
945 if (token != null) { 909 if (token != null) {
946 sc += token.lexeme + ' '; 910 sc += token.lexeme + ' ';
947 } 911 }
948 if (typeArgumentsCode != null) { 912 if (typeArgumentsCode != null) {
949 sc += typeArgumentsCode; 913 sc += typeArgumentsCode;
950 } 914 }
951 sc += code; 915 sc += code;
952 return _parseExpression(sc); 916 return _parseMapLiteralCode(sc);
953 } 917 }
954 918
955 @override 919 @override
956 MapLiteralEntry parseMapLiteralEntry(String code) { 920 MapLiteralEntry parseMapLiteralEntry(String code) {
957 return (_parseExpression('{$code}') as MapLiteral).entries.single; 921 return _parseMapLiteralCode('{$code}').entries.single;
958 } 922 }
959 923
960 @override 924 @override
961 Expression parseMultiplicativeExpression(String code) { 925 Expression parseMultiplicativeExpression(String code) {
962 return _parseExpression(code); 926 return _parseExpression(code);
963 } 927 }
964 928
965 @override 929 @override
966 InstanceCreationExpression parseNewExpression(String code) { 930 InstanceCreationExpression parseNewExpression(String code) {
967 return _parseExpression(code); 931 return _parseExpression(code);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
1048 @override 1012 @override
1049 PrefixExpression parseUnaryExpression(String code) { 1013 PrefixExpression parseUnaryExpression(String code) {
1050 return _parseExpression(code); 1014 return _parseExpression(code);
1051 } 1015 }
1052 1016
1053 Expression _parseExpression(String code) { 1017 Expression _parseExpression(String code) {
1054 var statement = parseStatement('$code;') as ExpressionStatement; 1018 var statement = parseStatement('$code;') as ExpressionStatement;
1055 return statement.expression; 1019 return statement.expression;
1056 } 1020 }
1057 1021
1022 MapLiteral _parseMapLiteralCode(String code) {
1023 var statement =
1024 parseStatement('var v = $code;') as VariableDeclarationStatement;
1025 return statement.variables.variables.single.initializer as MapLiteral;
1026 }
1027
1058 Object _runParser( 1028 Object _runParser(
1059 String source, ParseFunction getParseFunction(fasta.Parser parser), 1029 String source, ParseFunction getParseFunction(fasta.Parser parser),
1060 [List<ErrorCode> errorCodes = const <ErrorCode>[]]) { 1030 [List<ErrorCode> errorCodes = const <ErrorCode>[]]) {
1061 if (errorCodes.isNotEmpty) { 1031 if (errorCodes.isNotEmpty) {
1062 // TODO(paulberry): Check that the parser generates the proper errors. 1032 // TODO(paulberry): Check that the parser generates the proper errors.
1063 throw new UnimplementedError(); 1033 throw new UnimplementedError();
1064 } 1034 }
1065 createParser(source); 1035 createParser(source);
1066 return _parserProxy._run(getParseFunction); 1036 return _parserProxy._run(getParseFunction);
1067 } 1037 }
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
1542 void test_parseTypeAlias_genericFunction_typeParameters_voidReturnType() { 1512 void test_parseTypeAlias_genericFunction_typeParameters_voidReturnType() {
1543 super.test_parseTypeAlias_genericFunction_typeParameters_voidReturnType(); 1513 super.test_parseTypeAlias_genericFunction_typeParameters_voidReturnType();
1544 } 1514 }
1545 1515
1546 @override 1516 @override
1547 @failingTest 1517 @failingTest
1548 void test_parseTypeAlias_genericFunction_voidReturnType() { 1518 void test_parseTypeAlias_genericFunction_voidReturnType() {
1549 super.test_parseTypeAlias_genericFunction_voidReturnType(); 1519 super.test_parseTypeAlias_genericFunction_voidReturnType();
1550 } 1520 }
1551 } 1521 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/parser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698