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

Side by Side Diff: pkg/analyzer_experimental/test/generated/parser_test.dart

Issue 22285004: New analyzer_experimental snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // This code was auto-generated, is not intended to be edited, and is subject to 1 // This code was auto-generated, is not intended to be edited, and is subject to
2 // significant change. Please see the README file for more information. 2 // significant change. Please see the README file for more information.
3 library engine.parser_test; 3 library engine.parser_test;
4 import 'dart:collection'; 4 import 'dart:collection';
5 import 'package:analyzer_experimental/src/generated/java_core.dart'; 5 import 'package:analyzer_experimental/src/generated/java_core.dart';
6 import 'package:analyzer_experimental/src/generated/java_engine.dart'; 6 import 'package:analyzer_experimental/src/generated/java_engine.dart';
7 import 'package:analyzer_experimental/src/generated/java_junit.dart'; 7 import 'package:analyzer_experimental/src/generated/java_junit.dart';
8 import 'package:analyzer_experimental/src/generated/source.dart'; 8 import 'package:analyzer_experimental/src/generated/source.dart';
9 import 'package:analyzer_experimental/src/generated/error.dart'; 9 import 'package:analyzer_experimental/src/generated/error.dart';
10 import 'package:analyzer_experimental/src/generated/scanner.dart'; 10 import 'package:analyzer_experimental/src/generated/scanner.dart';
(...skipping 13 matching lines...) Expand all
24 */ 24 */
25 class SimpleParserTest extends ParserTestCase { 25 class SimpleParserTest extends ParserTestCase {
26 void fail_parseCommentReference_this() { 26 void fail_parseCommentReference_this() {
27 CommentReference reference = ParserTestCase.parse("parseCommentReference", < Object> ["this", 5], ""); 27 CommentReference reference = ParserTestCase.parse("parseCommentReference", < Object> ["this", 5], "");
28 SimpleIdentifier identifier = EngineTestCase.assertInstanceOf(SimpleIdentifi er, reference.identifier); 28 SimpleIdentifier identifier = EngineTestCase.assertInstanceOf(SimpleIdentifi er, reference.identifier);
29 JUnitTestCase.assertNotNull(identifier.token); 29 JUnitTestCase.assertNotNull(identifier.token);
30 JUnitTestCase.assertEquals("a", identifier.name); 30 JUnitTestCase.assertEquals("a", identifier.name);
31 JUnitTestCase.assertEquals(5, identifier.offset); 31 JUnitTestCase.assertEquals(5, identifier.offset);
32 } 32 }
33 void test_computeStringValue_emptyInterpolationPrefix() { 33 void test_computeStringValue_emptyInterpolationPrefix() {
34 JUnitTestCase.assertEquals("", computeStringValue("'''")); 34 JUnitTestCase.assertEquals("", computeStringValue("'''", true, false));
35 } 35 }
36 void test_computeStringValue_escape_b() { 36 void test_computeStringValue_escape_b() {
37 JUnitTestCase.assertEquals("\b", computeStringValue("'\\b'")); 37 JUnitTestCase.assertEquals("\b", computeStringValue("'\\b'", true, true));
38 } 38 }
39 void test_computeStringValue_escape_f() { 39 void test_computeStringValue_escape_f() {
40 JUnitTestCase.assertEquals("\f", computeStringValue("'\\f'")); 40 JUnitTestCase.assertEquals("\f", computeStringValue("'\\f'", true, true));
41 } 41 }
42 void test_computeStringValue_escape_n() { 42 void test_computeStringValue_escape_n() {
43 JUnitTestCase.assertEquals("\n", computeStringValue("'\\n'")); 43 JUnitTestCase.assertEquals("\n", computeStringValue("'\\n'", true, true));
44 } 44 }
45 void test_computeStringValue_escape_notSpecial() { 45 void test_computeStringValue_escape_notSpecial() {
46 JUnitTestCase.assertEquals(":", computeStringValue("'\\:'")); 46 JUnitTestCase.assertEquals(":", computeStringValue("'\\:'", true, true));
47 } 47 }
48 void test_computeStringValue_escape_r() { 48 void test_computeStringValue_escape_r() {
49 JUnitTestCase.assertEquals("\r", computeStringValue("'\\r'")); 49 JUnitTestCase.assertEquals("\r", computeStringValue("'\\r'", true, true));
50 } 50 }
51 void test_computeStringValue_escape_t() { 51 void test_computeStringValue_escape_t() {
52 JUnitTestCase.assertEquals("\t", computeStringValue("'\\t'")); 52 JUnitTestCase.assertEquals("\t", computeStringValue("'\\t'", true, true));
53 } 53 }
54 void test_computeStringValue_escape_u_fixed() { 54 void test_computeStringValue_escape_u_fixed() {
55 JUnitTestCase.assertEquals("\u4321", computeStringValue("'\\u4321'")); 55 JUnitTestCase.assertEquals("\u4321", computeStringValue("'\\u4321'", true, t rue));
56 } 56 }
57 void test_computeStringValue_escape_u_variable() { 57 void test_computeStringValue_escape_u_variable() {
58 JUnitTestCase.assertEquals("\u0123", computeStringValue("'\\u{123}'")); 58 JUnitTestCase.assertEquals("\u0123", computeStringValue("'\\u{123}'", true, true));
59 } 59 }
60 void test_computeStringValue_escape_v() { 60 void test_computeStringValue_escape_v() {
61 JUnitTestCase.assertEquals("\u000B", computeStringValue("'\\v'")); 61 JUnitTestCase.assertEquals("\u000B", computeStringValue("'\\v'", true, true) );
62 } 62 }
63 void test_computeStringValue_escape_x() { 63 void test_computeStringValue_escape_x() {
64 JUnitTestCase.assertEquals("\u00FF", computeStringValue("'\\xFF'")); 64 JUnitTestCase.assertEquals("\u00FF", computeStringValue("'\\xFF'", true, tru e));
65 } 65 }
66 void test_computeStringValue_noEscape_single() { 66 void test_computeStringValue_noEscape_single() {
67 JUnitTestCase.assertEquals("text", computeStringValue("'text'")); 67 JUnitTestCase.assertEquals("text", computeStringValue("'text'", true, true)) ;
68 } 68 }
69 void test_computeStringValue_noEscape_triple() { 69 void test_computeStringValue_noEscape_triple() {
70 JUnitTestCase.assertEquals("text", computeStringValue("'''text'''")); 70 JUnitTestCase.assertEquals("text", computeStringValue("'''text'''", true, tr ue));
71 } 71 }
72 void test_computeStringValue_raw_single() { 72 void test_computeStringValue_raw_single() {
73 JUnitTestCase.assertEquals("text", computeStringValue("r'text'")); 73 JUnitTestCase.assertEquals("text", computeStringValue("r'text'", true, true) );
74 } 74 }
75 void test_computeStringValue_raw_triple() { 75 void test_computeStringValue_raw_triple() {
76 JUnitTestCase.assertEquals("text", computeStringValue("r'''text'''")); 76 JUnitTestCase.assertEquals("text", computeStringValue("r'''text'''", true, t rue));
77 } 77 }
78 void test_computeStringValue_raw_withEscape() { 78 void test_computeStringValue_raw_withEscape() {
79 JUnitTestCase.assertEquals("two\\nlines", computeStringValue("r'two\\nlines' ")); 79 JUnitTestCase.assertEquals("two\\nlines", computeStringValue("r'two\\nlines' ", true, true));
80 }
81 void test_computeStringValue_triple_internalQuote_first_empty() {
82 JUnitTestCase.assertEquals("'", computeStringValue("''''", true, false));
83 }
84 void test_computeStringValue_triple_internalQuote_first_nonEmpty() {
85 JUnitTestCase.assertEquals("'text", computeStringValue("''''text", true, fal se));
86 }
87 void test_computeStringValue_triple_internalQuote_last_empty() {
88 JUnitTestCase.assertEquals("", computeStringValue("'''", false, true));
89 }
90 void test_computeStringValue_triple_internalQuote_last_nonEmpty() {
91 JUnitTestCase.assertEquals("text", computeStringValue("text'''", false, true ));
80 } 92 }
81 void test_constFactory() { 93 void test_constFactory() {
82 ParserTestCase.parse("parseClassMember", <Object> ["C"], "const factory C() = A;"); 94 ParserTestCase.parse("parseClassMember", <Object> ["C"], "const factory C() = A;");
83 } 95 }
84 void test_createSyntheticIdentifier() { 96 void test_createSyntheticIdentifier() {
85 SimpleIdentifier identifier = createSyntheticIdentifier(); 97 SimpleIdentifier identifier = createSyntheticIdentifier();
86 JUnitTestCase.assertTrue(identifier.isSynthetic); 98 JUnitTestCase.assertTrue(identifier.isSynthetic);
87 } 99 }
88 void test_createSyntheticStringLiteral() { 100 void test_createSyntheticStringLiteral() {
89 SimpleStringLiteral literal = createSyntheticStringLiteral(); 101 SimpleStringLiteral literal = createSyntheticStringLiteral();
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 JUnitTestCase.assertNotNull(propertyAccess.propertyName); 331 JUnitTestCase.assertNotNull(propertyAccess.propertyName);
320 } 332 }
321 void test_parseAssignableExpression_expression_dot() { 333 void test_parseAssignableExpression_expression_dot() {
322 PropertyAccess propertyAccess = ParserTestCase.parse("parseAssignableExpress ion", <Object> [false], "(x).y"); 334 PropertyAccess propertyAccess = ParserTestCase.parse("parseAssignableExpress ion", <Object> [false], "(x).y");
323 JUnitTestCase.assertNotNull(propertyAccess.target); 335 JUnitTestCase.assertNotNull(propertyAccess.target);
324 JUnitTestCase.assertNotNull(propertyAccess.operator); 336 JUnitTestCase.assertNotNull(propertyAccess.operator);
325 JUnitTestCase.assertNotNull(propertyAccess.propertyName); 337 JUnitTestCase.assertNotNull(propertyAccess.propertyName);
326 } 338 }
327 void test_parseAssignableExpression_expression_index() { 339 void test_parseAssignableExpression_expression_index() {
328 IndexExpression expression = ParserTestCase.parse("parseAssignableExpression ", <Object> [false], "(x)[y]"); 340 IndexExpression expression = ParserTestCase.parse("parseAssignableExpression ", <Object> [false], "(x)[y]");
329 JUnitTestCase.assertNotNull(expression.array); 341 JUnitTestCase.assertNotNull(expression.target);
330 JUnitTestCase.assertNotNull(expression.leftBracket); 342 JUnitTestCase.assertNotNull(expression.leftBracket);
331 JUnitTestCase.assertNotNull(expression.index); 343 JUnitTestCase.assertNotNull(expression.index);
332 JUnitTestCase.assertNotNull(expression.rightBracket); 344 JUnitTestCase.assertNotNull(expression.rightBracket);
333 } 345 }
334 void test_parseAssignableExpression_identifier() { 346 void test_parseAssignableExpression_identifier() {
335 SimpleIdentifier identifier = ParserTestCase.parse("parseAssignableExpressio n", <Object> [false], "x"); 347 SimpleIdentifier identifier = ParserTestCase.parse("parseAssignableExpressio n", <Object> [false], "x");
336 JUnitTestCase.assertNotNull(identifier); 348 JUnitTestCase.assertNotNull(identifier);
337 } 349 }
338 void test_parseAssignableExpression_identifier_args_dot() { 350 void test_parseAssignableExpression_identifier_args_dot() {
339 PropertyAccess propertyAccess = ParserTestCase.parse("parseAssignableExpress ion", <Object> [false], "x(y).z"); 351 PropertyAccess propertyAccess = ParserTestCase.parse("parseAssignableExpress ion", <Object> [false], "x(y).z");
340 MethodInvocation invocation = propertyAccess.target as MethodInvocation; 352 MethodInvocation invocation = propertyAccess.target as MethodInvocation;
341 JUnitTestCase.assertEquals("x", invocation.methodName.name); 353 JUnitTestCase.assertEquals("x", invocation.methodName.name);
342 ArgumentList argumentList = invocation.argumentList; 354 ArgumentList argumentList = invocation.argumentList;
343 JUnitTestCase.assertNotNull(argumentList); 355 JUnitTestCase.assertNotNull(argumentList);
344 EngineTestCase.assertSize(1, argumentList.arguments); 356 EngineTestCase.assertSize(1, argumentList.arguments);
345 JUnitTestCase.assertNotNull(propertyAccess.operator); 357 JUnitTestCase.assertNotNull(propertyAccess.operator);
346 JUnitTestCase.assertNotNull(propertyAccess.propertyName); 358 JUnitTestCase.assertNotNull(propertyAccess.propertyName);
347 } 359 }
348 void test_parseAssignableExpression_identifier_dot() { 360 void test_parseAssignableExpression_identifier_dot() {
349 PropertyAccess propertyAccess = ParserTestCase.parse("parseAssignableExpress ion", <Object> [false], "x.y"); 361 PropertyAccess propertyAccess = ParserTestCase.parse("parseAssignableExpress ion", <Object> [false], "x.y");
350 JUnitTestCase.assertNotNull(propertyAccess.target); 362 JUnitTestCase.assertNotNull(propertyAccess.target);
351 JUnitTestCase.assertNotNull(propertyAccess.operator); 363 JUnitTestCase.assertNotNull(propertyAccess.operator);
352 JUnitTestCase.assertNotNull(propertyAccess.propertyName); 364 JUnitTestCase.assertNotNull(propertyAccess.propertyName);
353 } 365 }
354 void test_parseAssignableExpression_identifier_index() { 366 void test_parseAssignableExpression_identifier_index() {
355 IndexExpression expression = ParserTestCase.parse("parseAssignableExpression ", <Object> [false], "x[y]"); 367 IndexExpression expression = ParserTestCase.parse("parseAssignableExpression ", <Object> [false], "x[y]");
356 JUnitTestCase.assertNotNull(expression.array); 368 JUnitTestCase.assertNotNull(expression.target);
357 JUnitTestCase.assertNotNull(expression.leftBracket); 369 JUnitTestCase.assertNotNull(expression.leftBracket);
358 JUnitTestCase.assertNotNull(expression.index); 370 JUnitTestCase.assertNotNull(expression.index);
359 JUnitTestCase.assertNotNull(expression.rightBracket); 371 JUnitTestCase.assertNotNull(expression.rightBracket);
360 } 372 }
361 void test_parseAssignableExpression_super_dot() { 373 void test_parseAssignableExpression_super_dot() {
362 PropertyAccess propertyAccess = ParserTestCase.parse("parseAssignableExpress ion", <Object> [false], "super.y"); 374 PropertyAccess propertyAccess = ParserTestCase.parse("parseAssignableExpress ion", <Object> [false], "super.y");
363 EngineTestCase.assertInstanceOf(SuperExpression, propertyAccess.target); 375 EngineTestCase.assertInstanceOf(SuperExpression, propertyAccess.target);
364 JUnitTestCase.assertNotNull(propertyAccess.operator); 376 JUnitTestCase.assertNotNull(propertyAccess.operator);
365 JUnitTestCase.assertNotNull(propertyAccess.propertyName); 377 JUnitTestCase.assertNotNull(propertyAccess.propertyName);
366 } 378 }
367 void test_parseAssignableExpression_super_index() { 379 void test_parseAssignableExpression_super_index() {
368 IndexExpression expression = ParserTestCase.parse("parseAssignableExpression ", <Object> [false], "super[y]"); 380 IndexExpression expression = ParserTestCase.parse("parseAssignableExpression ", <Object> [false], "super[y]");
369 EngineTestCase.assertInstanceOf(SuperExpression, expression.array); 381 EngineTestCase.assertInstanceOf(SuperExpression, expression.target);
370 JUnitTestCase.assertNotNull(expression.leftBracket); 382 JUnitTestCase.assertNotNull(expression.leftBracket);
371 JUnitTestCase.assertNotNull(expression.index); 383 JUnitTestCase.assertNotNull(expression.index);
372 JUnitTestCase.assertNotNull(expression.rightBracket); 384 JUnitTestCase.assertNotNull(expression.rightBracket);
373 } 385 }
374 void test_parseAssignableSelector_dot() { 386 void test_parseAssignableSelector_dot() {
375 PropertyAccess selector = ParserTestCase.parse("parseAssignableSelector", <O bject> [null, true], ".x"); 387 PropertyAccess selector = ParserTestCase.parse("parseAssignableSelector", <O bject> [null, true], ".x");
376 JUnitTestCase.assertNotNull(selector.operator); 388 JUnitTestCase.assertNotNull(selector.operator);
377 JUnitTestCase.assertNotNull(selector.propertyName); 389 JUnitTestCase.assertNotNull(selector.propertyName);
378 } 390 }
379 void test_parseAssignableSelector_index() { 391 void test_parseAssignableSelector_index() {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 JUnitTestCase.assertNotNull(statement.semicolon); 459 JUnitTestCase.assertNotNull(statement.semicolon);
448 } 460 }
449 void test_parseBreakStatement_noLabel() { 461 void test_parseBreakStatement_noLabel() {
450 BreakStatement statement = ParserTestCase.parse5("parseBreakStatement", "bre ak;", [ParserErrorCode.BREAK_OUTSIDE_OF_LOOP]); 462 BreakStatement statement = ParserTestCase.parse5("parseBreakStatement", "bre ak;", [ParserErrorCode.BREAK_OUTSIDE_OF_LOOP]);
451 JUnitTestCase.assertNotNull(statement.keyword); 463 JUnitTestCase.assertNotNull(statement.keyword);
452 JUnitTestCase.assertNull(statement.label); 464 JUnitTestCase.assertNull(statement.label);
453 JUnitTestCase.assertNotNull(statement.semicolon); 465 JUnitTestCase.assertNotNull(statement.semicolon);
454 } 466 }
455 void test_parseCascadeSection_i() { 467 void test_parseCascadeSection_i() {
456 IndexExpression section = ParserTestCase.parse5("parseCascadeSection", "..[i ]", []); 468 IndexExpression section = ParserTestCase.parse5("parseCascadeSection", "..[i ]", []);
457 JUnitTestCase.assertNull(section.array); 469 JUnitTestCase.assertNull(section.target);
458 JUnitTestCase.assertNotNull(section.leftBracket); 470 JUnitTestCase.assertNotNull(section.leftBracket);
459 JUnitTestCase.assertNotNull(section.index); 471 JUnitTestCase.assertNotNull(section.index);
460 JUnitTestCase.assertNotNull(section.rightBracket); 472 JUnitTestCase.assertNotNull(section.rightBracket);
461 } 473 }
462 void test_parseCascadeSection_ia() { 474 void test_parseCascadeSection_ia() {
463 FunctionExpressionInvocation section = ParserTestCase.parse5("parseCascadeSe ction", "..[i](b)", []); 475 FunctionExpressionInvocation section = ParserTestCase.parse5("parseCascadeSe ction", "..[i](b)", []);
464 EngineTestCase.assertInstanceOf(IndexExpression, section.function); 476 EngineTestCase.assertInstanceOf(IndexExpression, section.function);
465 JUnitTestCase.assertNotNull(section.argumentList); 477 JUnitTestCase.assertNotNull(section.argumentList);
466 } 478 }
467 void test_parseCascadeSection_p() { 479 void test_parseCascadeSection_p() {
(...skipping 2353 matching lines...) Expand 10 before | Expand all | Expand 10 after
2821 JUnitTestCase.assertEquals(TokenType.MINUS_MINUS, expression.operator.type); 2833 JUnitTestCase.assertEquals(TokenType.MINUS_MINUS, expression.operator.type);
2822 } 2834 }
2823 void test_parsePostfixExpression_increment() { 2835 void test_parsePostfixExpression_increment() {
2824 PostfixExpression expression = ParserTestCase.parse5("parsePostfixExpression ", "i++", []); 2836 PostfixExpression expression = ParserTestCase.parse5("parsePostfixExpression ", "i++", []);
2825 JUnitTestCase.assertNotNull(expression.operand); 2837 JUnitTestCase.assertNotNull(expression.operand);
2826 JUnitTestCase.assertNotNull(expression.operator); 2838 JUnitTestCase.assertNotNull(expression.operator);
2827 JUnitTestCase.assertEquals(TokenType.PLUS_PLUS, expression.operator.type); 2839 JUnitTestCase.assertEquals(TokenType.PLUS_PLUS, expression.operator.type);
2828 } 2840 }
2829 void test_parsePostfixExpression_none_indexExpression() { 2841 void test_parsePostfixExpression_none_indexExpression() {
2830 IndexExpression expression = ParserTestCase.parse5("parsePostfixExpression", "a[0]", []); 2842 IndexExpression expression = ParserTestCase.parse5("parsePostfixExpression", "a[0]", []);
2831 JUnitTestCase.assertNotNull(expression.array); 2843 JUnitTestCase.assertNotNull(expression.target);
2832 JUnitTestCase.assertNotNull(expression.index); 2844 JUnitTestCase.assertNotNull(expression.index);
2833 } 2845 }
2834 void test_parsePostfixExpression_none_methodInvocation() { 2846 void test_parsePostfixExpression_none_methodInvocation() {
2835 MethodInvocation expression = ParserTestCase.parse5("parsePostfixExpression" , "a.m()", []); 2847 MethodInvocation expression = ParserTestCase.parse5("parsePostfixExpression" , "a.m()", []);
2836 JUnitTestCase.assertNotNull(expression.target); 2848 JUnitTestCase.assertNotNull(expression.target);
2837 JUnitTestCase.assertNotNull(expression.methodName); 2849 JUnitTestCase.assertNotNull(expression.methodName);
2838 JUnitTestCase.assertNotNull(expression.argumentList); 2850 JUnitTestCase.assertNotNull(expression.argumentList);
2839 } 2851 }
2840 void test_parsePostfixExpression_none_propertyAccess() { 2852 void test_parsePostfixExpression_none_propertyAccess() {
2841 PrefixedIdentifier expression = ParserTestCase.parse5("parsePostfixExpressio n", "a.b", []); 2853 PrefixedIdentifier expression = ParserTestCase.parse5("parsePostfixExpressio n", "a.b", []);
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
3190 JUnitTestCase.assertNotNull(statement.expression); 3202 JUnitTestCase.assertNotNull(statement.expression);
3191 JUnitTestCase.assertNotNull(statement.rightParenthesis); 3203 JUnitTestCase.assertNotNull(statement.rightParenthesis);
3192 JUnitTestCase.assertNotNull(statement.leftBracket); 3204 JUnitTestCase.assertNotNull(statement.leftBracket);
3193 EngineTestCase.assertSize(1, statement.members); 3205 EngineTestCase.assertSize(1, statement.members);
3194 EngineTestCase.assertSize(3, statement.members[0].statements); 3206 EngineTestCase.assertSize(3, statement.members[0].statements);
3195 JUnitTestCase.assertNotNull(statement.rightBracket); 3207 JUnitTestCase.assertNotNull(statement.rightBracket);
3196 } 3208 }
3197 void test_parseSymbolLiteral_multiple() { 3209 void test_parseSymbolLiteral_multiple() {
3198 SymbolLiteral literal = ParserTestCase.parse5("parseSymbolLiteral", "#a.b.c" , []); 3210 SymbolLiteral literal = ParserTestCase.parse5("parseSymbolLiteral", "#a.b.c" , []);
3199 JUnitTestCase.assertNotNull(literal.poundSign); 3211 JUnitTestCase.assertNotNull(literal.poundSign);
3200 NodeList<SimpleIdentifier> components = literal.components; 3212 List<Token> components = literal.components;
3201 EngineTestCase.assertSize(3, components); 3213 EngineTestCase.assertLength(3, components);
3202 JUnitTestCase.assertEquals("a", components[0].name); 3214 JUnitTestCase.assertEquals("a", components[0].lexeme);
3203 JUnitTestCase.assertEquals("b", components[1].name); 3215 JUnitTestCase.assertEquals("b", components[1].lexeme);
3204 JUnitTestCase.assertEquals("c", components[2].name); 3216 JUnitTestCase.assertEquals("c", components[2].lexeme);
3217 }
3218 void test_parseSymbolLiteral_operator() {
3219 SymbolLiteral literal = ParserTestCase.parse5("parseSymbolLiteral", "#==", [ ]);
3220 JUnitTestCase.assertNotNull(literal.poundSign);
3221 List<Token> components = literal.components;
3222 EngineTestCase.assertLength(1, components);
3223 JUnitTestCase.assertEquals("==", components[0].lexeme);
3205 } 3224 }
3206 void test_parseSymbolLiteral_single() { 3225 void test_parseSymbolLiteral_single() {
3207 SymbolLiteral literal = ParserTestCase.parse5("parseSymbolLiteral", "#a", [] ); 3226 SymbolLiteral literal = ParserTestCase.parse5("parseSymbolLiteral", "#a", [] );
3208 JUnitTestCase.assertNotNull(literal.poundSign); 3227 JUnitTestCase.assertNotNull(literal.poundSign);
3209 NodeList<SimpleIdentifier> components = literal.components; 3228 List<Token> components = literal.components;
3210 EngineTestCase.assertSize(1, components); 3229 EngineTestCase.assertLength(1, components);
3211 JUnitTestCase.assertEquals("a", components[0].name); 3230 JUnitTestCase.assertEquals("a", components[0].lexeme);
3212 } 3231 }
3213 void test_parseThrowExpression() { 3232 void test_parseThrowExpression() {
3214 ThrowExpression expression = ParserTestCase.parse5("parseThrowExpression", " throw x;", []); 3233 ThrowExpression expression = ParserTestCase.parse5("parseThrowExpression", " throw x;", []);
3215 JUnitTestCase.assertNotNull(expression.keyword); 3234 JUnitTestCase.assertNotNull(expression.keyword);
3216 JUnitTestCase.assertNotNull(expression.expression); 3235 JUnitTestCase.assertNotNull(expression.expression);
3217 } 3236 }
3218 void test_parseThrowExpressionWithoutCascade() { 3237 void test_parseThrowExpressionWithoutCascade() {
3219 ThrowExpression expression = ParserTestCase.parse5("parseThrowExpressionWith outCascade", "throw x;", []); 3238 ThrowExpression expression = ParserTestCase.parse5("parseThrowExpressionWith outCascade", "throw x;", []);
3220 JUnitTestCase.assertNotNull(expression.keyword); 3239 JUnitTestCase.assertNotNull(expression.keyword);
3221 JUnitTestCase.assertNotNull(expression.expression); 3240 JUnitTestCase.assertNotNull(expression.expression);
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
3746 void test_skipTypeName_simple() { 3765 void test_skipTypeName_simple() {
3747 Token following = skip("skipTypeName", "C +"); 3766 Token following = skip("skipTypeName", "C +");
3748 JUnitTestCase.assertNotNull(following); 3767 JUnitTestCase.assertNotNull(following);
3749 JUnitTestCase.assertEquals(TokenType.PLUS, following.type); 3768 JUnitTestCase.assertEquals(TokenType.PLUS, following.type);
3750 } 3769 }
3751 3770
3752 /** 3771 /**
3753 * Invoke the method [Parser#computeStringValue] with the given argument. 3772 * Invoke the method [Parser#computeStringValue] with the given argument.
3754 * 3773 *
3755 * @param lexeme the argument to the method 3774 * @param lexeme the argument to the method
3775 * @param first `true` if this is the first token in a string literal
3776 * @param last `true` if this is the last token in a string literal
3756 * @return the result of invoking the method 3777 * @return the result of invoking the method
3757 * @throws Exception if the method could not be invoked or throws an exception 3778 * @throws Exception if the method could not be invoked or throws an exception
3758 */ 3779 */
3759 String computeStringValue(String lexeme) { 3780 String computeStringValue(String lexeme, bool first, bool last) {
3760 AnalysisErrorListener listener = new AnalysisErrorListener_21(); 3781 AnalysisErrorListener listener = new AnalysisErrorListener_22();
3761 Parser parser = new Parser(null, listener); 3782 Parser parser = new Parser(null, listener);
3762 return invokeParserMethodImpl(parser, "computeStringValue", <Object> [lexeme ], null) as String; 3783 return invokeParserMethodImpl(parser, "computeStringValue", <Object> [lexeme , first, last], null) as String;
3763 } 3784 }
3764 3785
3765 /** 3786 /**
3766 * Invoke the method [Parser#createSyntheticIdentifier] with the parser set to the token 3787 * Invoke the method [Parser#createSyntheticIdentifier] with the parser set to the token
3767 * stream produced by scanning the given source. 3788 * stream produced by scanning the given source.
3768 * 3789 *
3769 * @param source the source to be scanned to produce the token stream being te sted 3790 * @param source the source to be scanned to produce the token stream being te sted
3770 * @return the result of invoking the method 3791 * @return the result of invoking the method
3771 * @throws Exception if the method could not be invoked or throws an exception 3792 * @throws Exception if the method could not be invoked or throws an exception
3772 */ 3793 */
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
3923 runJUnitTest(__test, __test.test_computeStringValue_raw_single); 3944 runJUnitTest(__test, __test.test_computeStringValue_raw_single);
3924 }); 3945 });
3925 _ut.test('test_computeStringValue_raw_triple', () { 3946 _ut.test('test_computeStringValue_raw_triple', () {
3926 final __test = new SimpleParserTest(); 3947 final __test = new SimpleParserTest();
3927 runJUnitTest(__test, __test.test_computeStringValue_raw_triple); 3948 runJUnitTest(__test, __test.test_computeStringValue_raw_triple);
3928 }); 3949 });
3929 _ut.test('test_computeStringValue_raw_withEscape', () { 3950 _ut.test('test_computeStringValue_raw_withEscape', () {
3930 final __test = new SimpleParserTest(); 3951 final __test = new SimpleParserTest();
3931 runJUnitTest(__test, __test.test_computeStringValue_raw_withEscape); 3952 runJUnitTest(__test, __test.test_computeStringValue_raw_withEscape);
3932 }); 3953 });
3954 _ut.test('test_computeStringValue_triple_internalQuote_first_empty', () {
3955 final __test = new SimpleParserTest();
3956 runJUnitTest(__test, __test.test_computeStringValue_triple_internalQuote _first_empty);
3957 });
3958 _ut.test('test_computeStringValue_triple_internalQuote_first_nonEmpty', () {
3959 final __test = new SimpleParserTest();
3960 runJUnitTest(__test, __test.test_computeStringValue_triple_internalQuote _first_nonEmpty);
3961 });
3962 _ut.test('test_computeStringValue_triple_internalQuote_last_empty', () {
3963 final __test = new SimpleParserTest();
3964 runJUnitTest(__test, __test.test_computeStringValue_triple_internalQuote _last_empty);
3965 });
3966 _ut.test('test_computeStringValue_triple_internalQuote_last_nonEmpty', () {
3967 final __test = new SimpleParserTest();
3968 runJUnitTest(__test, __test.test_computeStringValue_triple_internalQuote _last_nonEmpty);
3969 });
3933 _ut.test('test_constFactory', () { 3970 _ut.test('test_constFactory', () {
3934 final __test = new SimpleParserTest(); 3971 final __test = new SimpleParserTest();
3935 runJUnitTest(__test, __test.test_constFactory); 3972 runJUnitTest(__test, __test.test_constFactory);
3936 }); 3973 });
3937 _ut.test('test_createSyntheticIdentifier', () { 3974 _ut.test('test_createSyntheticIdentifier', () {
3938 final __test = new SimpleParserTest(); 3975 final __test = new SimpleParserTest();
3939 runJUnitTest(__test, __test.test_createSyntheticIdentifier); 3976 runJUnitTest(__test, __test.test_createSyntheticIdentifier);
3940 }); 3977 });
3941 _ut.test('test_createSyntheticStringLiteral', () { 3978 _ut.test('test_createSyntheticStringLiteral', () {
3942 final __test = new SimpleParserTest(); 3979 final __test = new SimpleParserTest();
(...skipping 1704 matching lines...) Expand 10 before | Expand all | Expand 10 after
5647 runJUnitTest(__test, __test.test_parseSwitchStatement_labeledCase); 5684 runJUnitTest(__test, __test.test_parseSwitchStatement_labeledCase);
5648 }); 5685 });
5649 _ut.test('test_parseSwitchStatement_labeledStatementInCase', () { 5686 _ut.test('test_parseSwitchStatement_labeledStatementInCase', () {
5650 final __test = new SimpleParserTest(); 5687 final __test = new SimpleParserTest();
5651 runJUnitTest(__test, __test.test_parseSwitchStatement_labeledStatementIn Case); 5688 runJUnitTest(__test, __test.test_parseSwitchStatement_labeledStatementIn Case);
5652 }); 5689 });
5653 _ut.test('test_parseSymbolLiteral_multiple', () { 5690 _ut.test('test_parseSymbolLiteral_multiple', () {
5654 final __test = new SimpleParserTest(); 5691 final __test = new SimpleParserTest();
5655 runJUnitTest(__test, __test.test_parseSymbolLiteral_multiple); 5692 runJUnitTest(__test, __test.test_parseSymbolLiteral_multiple);
5656 }); 5693 });
5694 _ut.test('test_parseSymbolLiteral_operator', () {
5695 final __test = new SimpleParserTest();
5696 runJUnitTest(__test, __test.test_parseSymbolLiteral_operator);
5697 });
5657 _ut.test('test_parseSymbolLiteral_single', () { 5698 _ut.test('test_parseSymbolLiteral_single', () {
5658 final __test = new SimpleParserTest(); 5699 final __test = new SimpleParserTest();
5659 runJUnitTest(__test, __test.test_parseSymbolLiteral_single); 5700 runJUnitTest(__test, __test.test_parseSymbolLiteral_single);
5660 }); 5701 });
5661 _ut.test('test_parseThrowExpression', () { 5702 _ut.test('test_parseThrowExpression', () {
5662 final __test = new SimpleParserTest(); 5703 final __test = new SimpleParserTest();
5663 runJUnitTest(__test, __test.test_parseThrowExpression); 5704 runJUnitTest(__test, __test.test_parseThrowExpression);
5664 }); 5705 });
5665 _ut.test('test_parseThrowExpressionWithoutCascade', () { 5706 _ut.test('test_parseThrowExpressionWithoutCascade', () {
5666 final __test = new SimpleParserTest(); 5707 final __test = new SimpleParserTest();
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
5958 final __test = new SimpleParserTest(); 5999 final __test = new SimpleParserTest();
5959 runJUnitTest(__test, __test.test_skipTypeName_parameterized); 6000 runJUnitTest(__test, __test.test_skipTypeName_parameterized);
5960 }); 6001 });
5961 _ut.test('test_skipTypeName_simple', () { 6002 _ut.test('test_skipTypeName_simple', () {
5962 final __test = new SimpleParserTest(); 6003 final __test = new SimpleParserTest();
5963 runJUnitTest(__test, __test.test_skipTypeName_simple); 6004 runJUnitTest(__test, __test.test_skipTypeName_simple);
5964 }); 6005 });
5965 }); 6006 });
5966 } 6007 }
5967 } 6008 }
5968 class AnalysisErrorListener_21 implements AnalysisErrorListener { 6009 class AnalysisErrorListener_22 implements AnalysisErrorListener {
5969 void onError(AnalysisError event) { 6010 void onError(AnalysisError event) {
5970 JUnitTestCase.fail("Unexpected compilation error: ${event.message} (${event. offset}, ${event.length})"); 6011 JUnitTestCase.fail("Unexpected compilation error: ${event.message} (${event. offset}, ${event.length})");
5971 } 6012 }
5972 } 6013 }
5973 /** 6014 /**
5974 * The class `ComplexParserTest` defines parser tests that test the parsing of m ore complex 6015 * The class `ComplexParserTest` defines parser tests that test the parsing of m ore complex
5975 * code fragments or the interactions between multiple parsing methods. For exam ple, tests to ensure 6016 * code fragments or the interactions between multiple parsing methods. For exam ple, tests to ensure
5976 * that the precedence of operations is being handled correctly should be define d in this class. 6017 * that the precedence of operations is being handled correctly should be define d in this class.
5977 * 6018 *
5978 * Simpler tests should be defined in the class [SimpleParserTest]. 6019 * Simpler tests should be defined in the class [SimpleParserTest].
(...skipping 3270 matching lines...) Expand 10 before | Expand all | Expand 10 after
9249 RecoveryParserTest.dartSuite(); 9290 RecoveryParserTest.dartSuite();
9250 SimpleParserTest.dartSuite(); 9291 SimpleParserTest.dartSuite();
9251 } 9292 }
9252 Map<String, MethodTrampoline> _methodTable_Parser = <String, MethodTrampoline> { 9293 Map<String, MethodTrampoline> _methodTable_Parser = <String, MethodTrampoline> {
9253 'parseCompilationUnit_1': new MethodTrampoline(1, (Parser target, arg0) => tar get.parseCompilationUnit(arg0)), 9294 'parseCompilationUnit_1': new MethodTrampoline(1, (Parser target, arg0) => tar get.parseCompilationUnit(arg0)),
9254 'parseExpression_1': new MethodTrampoline(1, (Parser target, arg0) => target.p arseExpression(arg0)), 9295 'parseExpression_1': new MethodTrampoline(1, (Parser target, arg0) => target.p arseExpression(arg0)),
9255 'parseStatement_1': new MethodTrampoline(1, (Parser target, arg0) => target.pa rseStatement(arg0)), 9296 'parseStatement_1': new MethodTrampoline(1, (Parser target, arg0) => target.pa rseStatement(arg0)),
9256 'parseStatements_1': new MethodTrampoline(1, (Parser target, arg0) => target.p arseStatements(arg0)), 9297 'parseStatements_1': new MethodTrampoline(1, (Parser target, arg0) => target.p arseStatements(arg0)),
9257 'advance_0': new MethodTrampoline(0, (Parser target) => target.advance()), 9298 'advance_0': new MethodTrampoline(0, (Parser target) => target.advance()),
9258 'appendScalarValue_5': new MethodTrampoline(5, (Parser target, arg0, arg1, arg 2, arg3, arg4) => target.appendScalarValue(arg0, arg1, arg2, arg3, arg4)), 9299 'appendScalarValue_5': new MethodTrampoline(5, (Parser target, arg0, arg1, arg 2, arg3, arg4) => target.appendScalarValue(arg0, arg1, arg2, arg3, arg4)),
9259 'computeStringValue_1': new MethodTrampoline(1, (Parser target, arg0) => targe t.computeStringValue(arg0)), 9300 'computeStringValue_3': new MethodTrampoline(3, (Parser target, arg0, arg1, ar g2) => target.computeStringValue(arg0, arg1, arg2)),
9260 'convertToFunctionDeclaration_1': new MethodTrampoline(1, (Parser target, arg0 ) => target.convertToFunctionDeclaration(arg0)), 9301 'convertToFunctionDeclaration_1': new MethodTrampoline(1, (Parser target, arg0 ) => target.convertToFunctionDeclaration(arg0)),
9261 'couldBeStartOfCompilationUnitMember_0': new MethodTrampoline(0, (Parser targe t) => target.couldBeStartOfCompilationUnitMember()), 9302 'couldBeStartOfCompilationUnitMember_0': new MethodTrampoline(0, (Parser targe t) => target.couldBeStartOfCompilationUnitMember()),
9262 'createSyntheticIdentifier_0': new MethodTrampoline(0, (Parser target) => targ et.createSyntheticIdentifier()), 9303 'createSyntheticIdentifier_0': new MethodTrampoline(0, (Parser target) => targ et.createSyntheticIdentifier()),
9263 'createSyntheticStringLiteral_0': new MethodTrampoline(0, (Parser target) => t arget.createSyntheticStringLiteral()), 9304 'createSyntheticStringLiteral_0': new MethodTrampoline(0, (Parser target) => t arget.createSyntheticStringLiteral()),
9264 'createSyntheticToken_1': new MethodTrampoline(1, (Parser target, arg0) => tar get.createSyntheticToken(arg0)), 9305 'createSyntheticToken_1': new MethodTrampoline(1, (Parser target, arg0) => tar get.createSyntheticToken(arg0)),
9265 'ensureAssignable_1': new MethodTrampoline(1, (Parser target, arg0) => target. ensureAssignable(arg0)), 9306 'ensureAssignable_1': new MethodTrampoline(1, (Parser target, arg0) => target. ensureAssignable(arg0)),
9266 'expect_1': new MethodTrampoline(1, (Parser target, arg0) => target.expect(arg 0)), 9307 'expect_1': new MethodTrampoline(1, (Parser target, arg0) => target.expect(arg 0)),
9267 'findRange_2': new MethodTrampoline(2, (Parser target, arg0, arg1) => target.f indRange(arg0, arg1)), 9308 'findRange_2': new MethodTrampoline(2, (Parser target, arg0, arg1) => target.f indRange(arg0, arg1)),
9268 'getCodeBlockRanges_1': new MethodTrampoline(1, (Parser target, arg0) => targe t.getCodeBlockRanges(arg0)), 9309 'getCodeBlockRanges_1': new MethodTrampoline(1, (Parser target, arg0) => targe t.getCodeBlockRanges(arg0)),
9269 'getEndToken_1': new MethodTrampoline(1, (Parser target, arg0) => target.getEn dToken(arg0)), 9310 'getEndToken_1': new MethodTrampoline(1, (Parser target, arg0) => target.getEn dToken(arg0)),
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
9421 'validateModifiersForTopLevelFunction_1': new MethodTrampoline(1, (Parser targ et, arg0) => target.validateModifiersForTopLevelFunction(arg0)), 9462 'validateModifiersForTopLevelFunction_1': new MethodTrampoline(1, (Parser targ et, arg0) => target.validateModifiersForTopLevelFunction(arg0)),
9422 'validateModifiersForTopLevelVariable_1': new MethodTrampoline(1, (Parser targ et, arg0) => target.validateModifiersForTopLevelVariable(arg0)), 9463 'validateModifiersForTopLevelVariable_1': new MethodTrampoline(1, (Parser targ et, arg0) => target.validateModifiersForTopLevelVariable(arg0)),
9423 'validateModifiersForTypedef_1': new MethodTrampoline(1, (Parser target, arg0) => target.validateModifiersForTypedef(arg0)),}; 9464 'validateModifiersForTypedef_1': new MethodTrampoline(1, (Parser target, arg0) => target.validateModifiersForTypedef(arg0)),};
9424 9465
9425 9466
9426 Object invokeParserMethodImpl(Parser parser, String methodName, List<Object> obj ects, Token tokenStream) { 9467 Object invokeParserMethodImpl(Parser parser, String methodName, List<Object> obj ects, Token tokenStream) {
9427 parser.currentToken = tokenStream; 9468 parser.currentToken = tokenStream;
9428 MethodTrampoline method = _methodTable_Parser['${methodName}_${objects.length} ']; 9469 MethodTrampoline method = _methodTable_Parser['${methodName}_${objects.length} '];
9429 return method.invoke(parser, objects); 9470 return method.invoke(parser, objects);
9430 } 9471 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698