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

Unified Diff: dart/compiler/javatests/com/google/dart/compiler/parser/CommentTest.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/CommentTest.java
diff --git a/dart/compiler/javatests/com/google/dart/compiler/parser/CommentTest.java b/dart/compiler/javatests/com/google/dart/compiler/parser/CommentTest.java
deleted file mode 100644
index 1cd4aded874dfe4d475f8fbc99e120c051647990..0000000000000000000000000000000000000000
--- a/dart/compiler/javatests/com/google/dart/compiler/parser/CommentTest.java
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright (c) 2012, 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.common.collect.Lists;
-import com.google.dart.compiler.CompilerTestCase;
-import com.google.dart.compiler.DartCompilerListener;
-import com.google.dart.compiler.Source;
-import com.google.dart.compiler.ast.DartComment;
-import com.google.dart.compiler.ast.DartDeclaration;
-import com.google.dart.compiler.ast.DartNode;
-import com.google.dart.compiler.ast.DartUnit;
-import com.google.dart.compiler.common.SourceInfo;
-
-import java.util.List;
-
-/**
- * Tests to ensure the scanner is correctly recording comments, as defined
- * in the javadoc for <code>DartScanner.recordCommentLocation().</code>
- */
-public class CommentTest extends CompilerTestCase {
- private String source;
-
- private static String[] EXPECTED001 = {"/*\n * Beginning comment\n */",
- "// line comment", "// another", "/**/", "//", "/*/*nested*/*/",
- };
- private static String[] EXPECTED002 = {"/*\n*\n //comment\nX Y"};
-
- public void test001() {
- DartUnit unit = parseUnit("Comments.dart");
- compareComments(unit, EXPECTED001);
- }
-
- public void test002() {
- DartUnit unit = parseUnitErrors("BadCommentNegativeTest.dart",
- "Unexpected token 'ILLEGAL' (expected end of file)", 1, 1);
- compareComments(unit, EXPECTED002);
- }
-
- public void test003() {
- DartUnit unit = parseUnit("Comments2.dart");
- assertDeclComments(unit, "firstMethod", "/** Comments are good. */");
- assertDeclComments(unit, "secondMethod", null);
- }
-
- @Override
- protected DartParser makeParser(Source src, String sourceCode, DartCompilerListener listener) {
- source = sourceCode;
- return super.makeParser(src, sourceCode, listener);
- }
-
- private List<String> extractComments(DartUnit unit) {
- List<String> comments = Lists.newArrayList();
- List<DartComment> commentNodes = unit.getComments();
- for (DartComment commentNode : commentNodes) {
- SourceInfo sourceInfo = commentNode.getSourceInfo();
- String comment = source.substring(sourceInfo.getOffset(), sourceInfo.getEnd());
- comments.add(comment);
- }
- return comments;
- }
-
- private void compareComments(DartUnit unit, String[] expected) {
- List<String> comments = extractComments(unit);
- assertEquals(expected.length, comments.size());
- for (int i = 0; i < expected.length; i++) {
- assertEquals(expected[i], comments.get(i));
- }
- }
-
- private void assertDeclComments(DartUnit unit, String name, String comments) {
- for (DartNode node : unit.getTopLevelNodes()) {
- if (node instanceof DartDeclaration && node.getElement() != null
- && name.equals(node.getElement().getOriginalName())) {
- DartDeclaration<?> decl = (DartDeclaration<?>)node;
- String nodeComments = null;
-
- if (decl.getDartDoc() != null) {
- nodeComments = decl.getDartDoc().toSource();
- }
-
- assertEquals(comments, nodeComments);
- }
- }
- }
-}

Powered by Google App Engine
This is Rietveld 408576698