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

Unified Diff: dart/compiler/javatests/com/google/dart/compiler/common/LibrarySourceFileTest.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/common/LibrarySourceFileTest.java
diff --git a/dart/compiler/javatests/com/google/dart/compiler/common/LibrarySourceFileTest.java b/dart/compiler/javatests/com/google/dart/compiler/common/LibrarySourceFileTest.java
deleted file mode 100644
index 7dd449898b9e3bf1b3d19ff50b3dac253e5bd6f5..0000000000000000000000000000000000000000
--- a/dart/compiler/javatests/com/google/dart/compiler/common/LibrarySourceFileTest.java
+++ /dev/null
@@ -1,110 +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.common;
-
-import com.google.common.collect.Sets;
-import com.google.dart.compiler.AbstractSourceFileTest;
-import com.google.dart.compiler.DartCompilationError;
-import com.google.dart.compiler.DartCompilerListener;
-import com.google.dart.compiler.ErrorSeverity;
-import com.google.dart.compiler.LibrarySource;
-import com.google.dart.compiler.UrlLibrarySource;
-import com.google.dart.compiler.ast.LibraryNode;
-import com.google.dart.compiler.ast.LibraryUnit;
-import com.google.dart.compiler.parser.DartParser;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Iterator;
-
-/**
- * Tests {@link LibrarySource}
- */
-public class LibrarySourceFileTest extends AbstractSourceFileTest {
- private LibraryUnit libUnit;
-
- public void testGetImports() throws IOException {
- LibraryUnit libUnit = getLibraryUnit("LibrarySourceFileTest.dart");
- Iterable<LibraryNode> imports = libUnit.getImportPaths();
- assertFalse(imports.iterator().hasNext());
- }
-
- public void testGetAppImports() throws IOException {
- LibraryUnit appUnit = getLibraryUnit("ApplicationSourceFileTest.dart");
- Iterable<LibraryNode> imports = appUnit.getImportPaths();
- Iterator<LibraryNode> iter = imports.iterator();
- assertEquals("somedir/somelib.dart", iter.next().getText());
- assertFalse(iter.hasNext());
- }
-
- public void testGetSources() throws IOException {
- LibraryUnit libUnit = getLibraryUnit("LibrarySourceFileTest.dart");
- Iterable<LibraryNode> sources = libUnit.getSourcePaths();
- Iterator<LibraryNode> iter = sources.iterator();
- assertEquals("OneSourceFile.dart", iter.next().getText());
- assertEquals("Source2.dart", iter.next().getText());
- assertEquals("subdir/Source3.dart", iter.next().getText());
- assertEquals(libUnit.getSelfSourcePath(), iter.next());
- assertFalse(iter.hasNext());
- }
-
- public void testGetAppSources() throws IOException {
- LibraryUnit appUnit = getLibraryUnit("ApplicationSourceFileTest.dart");
- Iterable<LibraryNode> paths = appUnit.getSourcePaths();
- Iterator<LibraryNode> iter = paths.iterator();
- assertEquals("MyFirstApp.dart", iter.next().getText());
- assertEquals("AnotherSource2.dart", iter.next().getText());
- assertEquals("subdir2/Source3x.dart", iter.next().getText());
- assertEquals(libUnit.getSelfSourcePath(), iter.next());
- assertFalse(iter.hasNext());
- }
-
- /**
- * Answer the {@link LibraryUnit} on which tests are performed
- *
- * @param filePath the path to the file relative to the test class
- * @return the library unit (not <code>null</code>)
- */
- protected LibraryUnit getLibraryUnit(String filePath) throws IOException {
- File tempFile = createTempFile(filePath);
- return getLibraryUnit(tempFile);
- }
-
- protected LibraryUnit getLibraryUnit(String filePath, String source) throws IOException {
- File tempFile = createTempFile(filePath, source);
- return getLibraryUnit(tempFile);
- }
-
- protected LibraryUnit getLibraryUnit(File file) {
- if (libUnit == null) {
- UrlLibrarySource lib = new UrlLibrarySource(file);
-
- DartCompilerListener listener = new DartCompilerListener.Empty() {
- @Override
- public void onError(DartCompilationError event) {
- // Ignore warnings when testing.
- if (event.getErrorCode().getErrorSeverity() == ErrorSeverity.WARNING) {
- return;
- }
- // Rethrow error.
- throw new RuntimeException(event.getMessage());
- }
- };
-
- try {
- libUnit = new DartParser(
- lib,
- DartParser.read(lib),
- false,
- Sets.<String>newHashSet(),
- listener,
- null).preProcessLibraryDirectives(lib);
- } catch (IOException ioEx) {
- libUnit = null;
- }
- }
- return libUnit;
- }
-}

Powered by Google App Engine
This is Rietveld 408576698