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

Side by Side Diff: compiler/javatests/com/google/dart/compiler/parser/SyntaxTest.java

Issue 10545159: Fix for 3607 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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
« no previous file with comments | « compiler/java/com/google/dart/compiler/parser/DartParser.java ('k') | no next file » | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 package com.google.dart.compiler.parser; 5 package com.google.dart.compiler.parser;
6 6
7 import com.google.common.base.Joiner; 7 import com.google.common.base.Joiner;
8 import com.google.dart.compiler.DartCompilerListener; 8 import com.google.dart.compiler.DartCompilerListener;
9 import com.google.dart.compiler.DartSourceTest; 9 import com.google.dart.compiler.DartSourceTest;
10 import com.google.dart.compiler.ast.DartArrayLiteral; 10 import com.google.dart.compiler.ast.DartArrayLiteral;
11 import com.google.dart.compiler.ast.DartBinaryExpression; 11 import com.google.dart.compiler.ast.DartBinaryExpression;
12 import com.google.dart.compiler.ast.DartClass; 12 import com.google.dart.compiler.ast.DartClass;
13 import com.google.dart.compiler.ast.DartExprStmt; 13 import com.google.dart.compiler.ast.DartExprStmt;
14 import com.google.dart.compiler.ast.DartExpression; 14 import com.google.dart.compiler.ast.DartExpression;
15 import com.google.dart.compiler.ast.DartField; 15 import com.google.dart.compiler.ast.DartField;
16 import com.google.dart.compiler.ast.DartFieldDefinition; 16 import com.google.dart.compiler.ast.DartFieldDefinition;
17 import com.google.dart.compiler.ast.DartIdentifier; 17 import com.google.dart.compiler.ast.DartIdentifier;
18 import com.google.dart.compiler.ast.DartIntegerLiteral; 18 import com.google.dart.compiler.ast.DartIntegerLiteral;
19 import com.google.dart.compiler.ast.DartMapLiteral; 19 import com.google.dart.compiler.ast.DartMapLiteral;
20 import com.google.dart.compiler.ast.DartMethodDefinition; 20 import com.google.dart.compiler.ast.DartMethodDefinition;
21 import com.google.dart.compiler.ast.DartNode; 21 import com.google.dart.compiler.ast.DartNode;
22 import com.google.dart.compiler.ast.DartPropertyAccess; 22 import com.google.dart.compiler.ast.DartPropertyAccess;
23 import com.google.dart.compiler.ast.DartReturnStatement;
24 import com.google.dart.compiler.ast.DartStatement; 23 import com.google.dart.compiler.ast.DartStatement;
25 import com.google.dart.compiler.ast.DartStringInterpolation; 24 import com.google.dart.compiler.ast.DartStringInterpolation;
26 import com.google.dart.compiler.ast.DartStringLiteral; 25 import com.google.dart.compiler.ast.DartStringLiteral;
27 import com.google.dart.compiler.ast.DartTryStatement; 26 import com.google.dart.compiler.ast.DartTryStatement;
28 import com.google.dart.compiler.ast.DartTypeExpression; 27 import com.google.dart.compiler.ast.DartTypeExpression;
29 import com.google.dart.compiler.ast.DartTypeNode; 28 import com.google.dart.compiler.ast.DartTypeNode;
30 import com.google.dart.compiler.ast.DartUnaryExpression; 29 import com.google.dart.compiler.ast.DartUnaryExpression;
31 import com.google.dart.compiler.ast.DartUnit; 30 import com.google.dart.compiler.ast.DartUnit;
32 import com.google.dart.compiler.ast.DartVariableStatement; 31 import com.google.dart.compiler.ast.DartVariableStatement;
33 32
34 import java.util.List; 33 import java.util.List;
35 34
36 public class SyntaxTest extends AbstractParserTest { 35 public class SyntaxTest extends AbstractParserTest {
37 36
37 public void test_getter() {
38 DartUnit unit = parseUnit("getter.dart", Joiner.on("\n").join(
39 "class G {",
40 " // Old getter syntax",
41 " int get g1() => 1;",
42 " // New getter syntax",
43 " int get g2 => 2;",
44 "}"));
45 }
46
47 public void test_setter() {
48 DartUnit unit = parseUnit("setter.dart", Joiner.on("\n").join(
49 "class G {",
50 " // Old setter syntax",
51 " void set g1(int v) {}",
52 " // New setter syntax",
53 " void set g2=(int v) {}",
54 "}"));
55 }
56
38 /** 57 /**
39 * There was bug when "identA.identB" always considered as constructor declara tion. But it can be 58 * There was bug when "identA.identB" always considered as constructor declara tion. But it can be
40 * constructor only if "identA" is name of enclosing class. 59 * constructor only if "identA" is name of enclosing class.
41 * <p> 60 * <p>
42 * http://code.google.com/p/dart/issues/detail?id=513 61 * http://code.google.com/p/dart/issues/detail?id=513
43 */ 62 */
44 public void testQualifiedReturnType() { 63 public void testQualifiedReturnType() {
45 DartUnit unit = parseUnit("QualifiedReturnTypeB.dart"); 64 DartUnit unit = parseUnit("QualifiedReturnTypeB.dart");
46 assertEquals( 65 assertEquals(
47 Joiner.on("\n").join( 66 Joiner.on("\n").join(
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 parseUnit("phony_bogus_escaped_newline.dart", 605 parseUnit("phony_bogus_escaped_newline.dart",
587 Joiner.on("\n").join( 606 Joiner.on("\n").join(
588 "class A {", 607 "class A {",
589 " var foo = \"not really multiline\\\n", 608 " var foo = \"not really multiline\\\n",
590 "\";", 609 "\";",
591 "}"), 610 "}"),
592 ParserErrorCode.UNEXPECTED_TOKEN, 2, 13, 611 ParserErrorCode.UNEXPECTED_TOKEN, 2, 13,
593 ParserErrorCode.EXPECTED_TOKEN, 4, 1); 612 ParserErrorCode.EXPECTED_TOKEN, 4, 1);
594 } 613 }
595 } 614 }
OLDNEW
« no previous file with comments | « compiler/java/com/google/dart/compiler/parser/DartParser.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698