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

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

Issue 10949015: Issue 5052. Analyzer should treat assert as a keyword (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: compiler/javatests/com/google/dart/compiler/parser/SyntaxTest.java
diff --git a/compiler/javatests/com/google/dart/compiler/parser/SyntaxTest.java b/compiler/javatests/com/google/dart/compiler/parser/SyntaxTest.java
index d0eed60ac900cb6348c5ee21432c1491dd386629..8c6da26130eeaa7c5631dccf4d39ead78a9d8602 100644
--- a/compiler/javatests/com/google/dart/compiler/parser/SyntaxTest.java
+++ b/compiler/javatests/com/google/dart/compiler/parser/SyntaxTest.java
@@ -9,7 +9,9 @@ import com.google.dart.compiler.DartCompilerListener;
import com.google.dart.compiler.DartSourceTest;
import com.google.dart.compiler.ast.DartAnnotation;
import com.google.dart.compiler.ast.DartArrayLiteral;
+import com.google.dart.compiler.ast.DartAssertStatement;
import com.google.dart.compiler.ast.DartBinaryExpression;
+import com.google.dart.compiler.ast.DartBooleanLiteral;
import com.google.dart.compiler.ast.DartClass;
import com.google.dart.compiler.ast.DartComment;
import com.google.dart.compiler.ast.DartExprStmt;
@@ -103,12 +105,28 @@ public class SyntaxTest extends AbstractParserTest {
"}"));
}
+ public void test_assertStatement() {
+ DartUnit unit = parseUnit("function.dart", Joiner.on("\n").join(
+ "main() {",
+ " assert(true);",
+ "}"
+ ));
+ assertNotNull(unit);
+ assertEquals(1, unit.getTopLevelNodes().size());
+ DartMethodDefinition function = (DartMethodDefinition) unit.getTopLevelNodes().get(0);
+ assertNotNull(function);
+ DartStatement statement = function.getFunction().getBody().getStatements().get(0);
+ assertTrue(statement instanceof DartAssertStatement);
+ DartExpression expression = ((DartAssertStatement) statement).getCondition();
+ assertTrue(expression instanceof DartBooleanLiteral);
+ }
+
public void test_functionExpression_asStatement() {
DartUnit unit = parseUnit("function.dart", Joiner.on("\n").join(
"main() {",
" () {};",
"}"
- ));
+ ));
assertNotNull(unit);
assertEquals(1, unit.getTopLevelNodes().size());
DartMethodDefinition function = (DartMethodDefinition) unit.getTopLevelNodes().get(0);

Powered by Google App Engine
This is Rietveld 408576698