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

Side by Side Diff: dart/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/parser/SimpleParserTest.java

Issue 59073003: Version 0.8.10.4 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 1 month 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 /* 1 /*
2 * Copyright (c) 2012, the Dart project authors. 2 * Copyright (c) 2012, the Dart project authors.
3 * 3 *
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u se this file except 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u se this file except
5 * in compliance with the License. You may obtain a copy of the License at 5 * in compliance with the License. You may obtain a copy of the License at
6 * 6 *
7 * http://www.eclipse.org/legal/epl-v10.html 7 * http://www.eclipse.org/legal/epl-v10.html
8 * 8 *
9 * Unless required by applicable law or agreed to in writing, software distribut ed under the License 9 * Unless required by applicable law or agreed to in writing, software distribut ed under the License
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K IND, either express 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K IND, either express
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 } 185 }
186 186
187 public void test_isFunctionExpression_noName_block() throws Exception { 187 public void test_isFunctionExpression_noName_block() throws Exception {
188 assertTrue(isFunctionExpression("() {}")); 188 assertTrue(isFunctionExpression("() {}"));
189 } 189 }
190 190
191 public void test_isFunctionExpression_noName_expression() throws Exception { 191 public void test_isFunctionExpression_noName_expression() throws Exception {
192 assertTrue(isFunctionExpression("() => e")); 192 assertTrue(isFunctionExpression("() => e"));
193 } 193 }
194 194
195 public void test_isFunctionExpression_parameter_final() throws Exception {
196 assertTrue(isFunctionExpression("(final a) {}"));
197 assertTrue(isFunctionExpression("(final a, b) {}"));
198 assertTrue(isFunctionExpression("(final a, final b) {}"));
199 }
200
201 public void test_isFunctionExpression_parameter_final_typed() throws Exception {
202 assertTrue(isFunctionExpression("(final int a) {}"));
203 assertTrue(isFunctionExpression("(final prefix.List a) {}"));
204 assertTrue(isFunctionExpression("(final List<int> a) {}"));
205 assertTrue(isFunctionExpression("(final prefix.List<int> a) {}"));
206 }
207
195 public void test_isFunctionExpression_parameter_multiple() throws Exception { 208 public void test_isFunctionExpression_parameter_multiple() throws Exception {
196 assertTrue(isFunctionExpression("(a, b) {}")); 209 assertTrue(isFunctionExpression("(a, b) {}"));
197 } 210 }
198 211
199 public void test_isFunctionExpression_parameter_named() throws Exception { 212 public void test_isFunctionExpression_parameter_named() throws Exception {
200 assertTrue(isFunctionExpression("({a}) {}")); 213 assertTrue(isFunctionExpression("({a}) {}"));
201 } 214 }
202 215
203 public void test_isFunctionExpression_parameter_optional() throws Exception { 216 public void test_isFunctionExpression_parameter_optional() throws Exception {
204 assertTrue(isFunctionExpression("([a]) {}")); 217 assertTrue(isFunctionExpression("([a]) {}"));
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
923 assertSize(0, field.getMetadata()); 936 assertSize(0, field.getMetadata());
924 assertNull(field.getStaticKeyword()); 937 assertNull(field.getStaticKeyword());
925 VariableDeclarationList list = field.getFields(); 938 VariableDeclarationList list = field.getFields();
926 assertNotNull(list); 939 assertNotNull(list);
927 NodeList<VariableDeclaration> variables = list.getVariables(); 940 NodeList<VariableDeclaration> variables = list.getVariables();
928 assertSize(1, variables); 941 assertSize(1, variables);
929 VariableDeclaration variable = variables.get(0); 942 VariableDeclaration variable = variables.get(0);
930 assertNotNull(variable.getName()); 943 assertNotNull(variable.getName());
931 } 944 }
932 945
946 public void test_parseClassMember_field_namedOperator_withAssignment() throws Exception {
947 FieldDeclaration field = parse("parseClassMember", new Object[] {"C"}, "var operator = (5);");
948 assertNull(field.getDocumentationComment());
949 assertSize(0, field.getMetadata());
950 assertNull(field.getStaticKeyword());
951 VariableDeclarationList list = field.getFields();
952 assertNotNull(list);
953 NodeList<VariableDeclaration> variables = list.getVariables();
954 assertSize(1, variables);
955 VariableDeclaration variable = variables.get(0);
956 assertNotNull(variable.getName());
957 assertNotNull(variable.getInitializer());
958 }
959
933 public void test_parseClassMember_field_namedSet() throws Exception { 960 public void test_parseClassMember_field_namedSet() throws Exception {
934 FieldDeclaration field = parse("parseClassMember", new Object[] {"C"}, "var set;"); 961 FieldDeclaration field = parse("parseClassMember", new Object[] {"C"}, "var set;");
935 assertNull(field.getDocumentationComment()); 962 assertNull(field.getDocumentationComment());
936 assertSize(0, field.getMetadata()); 963 assertSize(0, field.getMetadata());
937 assertNull(field.getStaticKeyword()); 964 assertNull(field.getStaticKeyword());
938 VariableDeclarationList list = field.getFields(); 965 VariableDeclarationList list = field.getFields();
939 assertNotNull(list); 966 assertNotNull(list);
940 NodeList<VariableDeclaration> variables = list.getVariables(); 967 NodeList<VariableDeclaration> variables = list.getVariables();
941 assertSize(1, variables); 968 assertSize(1, variables);
942 VariableDeclaration variable = variables.get(0); 969 VariableDeclaration variable = variables.get(0);
(...skipping 3908 matching lines...) Expand 10 before | Expand all | Expand 10 after
4851 // Parse the source. 4878 // Parse the source.
4852 // 4879 //
4853 Parser parser = new Parser(null, listener); 4880 Parser parser = new Parser(null, listener);
4854 return (Token) invokeParserMethodImpl( 4881 return (Token) invokeParserMethodImpl(
4855 parser, 4882 parser,
4856 methodName, 4883 methodName,
4857 new Object[] {tokenStream}, 4884 new Object[] {tokenStream},
4858 tokenStream); 4885 tokenStream);
4859 } 4886 }
4860 } 4887 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698