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

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

Issue 20722006: Removed compiler/ directory from repository (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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: dart/compiler/javatests/com/google/dart/compiler/parser/ValidatingSyntaxTest.java
diff --git a/dart/compiler/javatests/com/google/dart/compiler/parser/ValidatingSyntaxTest.java b/dart/compiler/javatests/com/google/dart/compiler/parser/ValidatingSyntaxTest.java
deleted file mode 100755
index 5960da861ed53faf3c7e58f5f82278e544625373..0000000000000000000000000000000000000000
--- a/dart/compiler/javatests/com/google/dart/compiler/parser/ValidatingSyntaxTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-package com.google.dart.compiler.parser;
-
-import com.google.dart.compiler.ast.DartBinaryExpression;
-import com.google.dart.compiler.ast.DartClass;
-import com.google.dart.compiler.ast.DartExprStmt;
-import com.google.dart.compiler.ast.DartExpression;
-import com.google.dart.compiler.ast.DartMethodDefinition;
-import com.google.dart.compiler.ast.DartNode;
-import com.google.dart.compiler.ast.DartStatement;
-import com.google.dart.compiler.ast.DartStringLiteral;
-import com.google.dart.compiler.ast.DartUnit;
-import com.google.dart.compiler.ast.DartVariableStatement;
-
-import java.util.List;
-
-/**
- * Tests for the parser, which simply assert that valid source units parse
- * correctly. All tests invoking {@link #parseUnit} are designed such that they
- * will throw an exception if anything goes wrong in the parser.
- */
-public class ValidatingSyntaxTest extends AbstractParserTest {
-
- @Override
- public void testStrings() {
- DartUnit unit = parseUnit("Strings.dart");
-
- // Inspect the first method and check that the strings were
- // parsed correctly
- List<DartNode> nodes = unit.getTopLevelNodes();
- assertEquals(1, nodes.size());
- DartClass clazz = (DartClass) nodes.get(0);
- List<DartNode> members = clazz.getMembers();
- assertEquals(1, members.size());
- DartMethodDefinition m = (DartMethodDefinition) members.get(0);
- assertEquals("method", m.getName().toString());
- List<DartStatement> body = m.getFunction().getBody().getStatements();
-
- String[] expectedStrings = new String[] {
- "a simple constant",
- "a simple constant",
- "an escaped quote \".",
- "an escaped quote \'.",
- "a new \n line",
- "a new \n line",
- " multiline 1\n multiline 2\n ",
- " multiline 1\n multiline 2\n ",
- "multiline 1\n multiline 2\n ",
- "multiline 1\n multiline 2\n "};
- assertEquals(expectedStrings.length + 1, body.size());
- assertTrue(body.get(0) instanceof DartVariableStatement);
- for (int i = 0; i < expectedStrings.length; i++) {
- DartStatement s = body.get(i + 1);
- assertTrue(s instanceof DartExprStmt);
- DartExprStmt es = (DartExprStmt) s;
- DartExpression e = es.getExpression();
- assertTrue(e instanceof DartBinaryExpression);
- e = ((DartBinaryExpression) e).getArg2();
- assertTrue(e instanceof DartStringLiteral);
- assertEquals(expectedStrings[i], ((DartStringLiteral) e).getValue());
- }
- }
-
- @Override
- public void testStringsErrors() {
- parseUnitErrors("StringsErrorsNegativeTest.dart",
- "Unexpected token 'ILLEGAL'", 7, 13,
- "Unexpected token 'ILLEGAL'", 9, 9,
- "Unexpected token 'ILLEGAL'", 11, 9);
- }
-
- @Override
- protected DartUnit parseUnit(String srcName, String sourceCode, Object... errors) {
- if (errors.length > 0) {
- throw new RuntimeException("Expected errors not implemented");
- }
- return validateUnit(super.parseUnit(srcName, sourceCode));
- }
-
- private DartUnit validateUnit(DartUnit unit) {
- DartASTValidator validator = new DartASTValidator();
- unit.accept(validator);
- validator.assertValid();
- return unit;
- }
-
- @Override
- public void testTiming() {
- // Ignored.
- }
-}

Powered by Google App Engine
This is Rietveld 408576698