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

Unified Diff: compiler/javatests/com/google/dart/compiler/SystemLibrariesReaderTest.java

Issue 10875079: add a class to read and parse libraries.dart file (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 4 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
« no previous file with comments | « compiler/javatests/com/google/dart/compiler/CompilerTests.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiler/javatests/com/google/dart/compiler/SystemLibrariesReaderTest.java
===================================================================
--- compiler/javatests/com/google/dart/compiler/SystemLibrariesReaderTest.java (revision 0)
+++ compiler/javatests/com/google/dart/compiler/SystemLibrariesReaderTest.java (revision 0)
@@ -0,0 +1,65 @@
+// 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;
+
+import com.google.dart.compiler.SystemLibrariesReader.DartLibrary;
+
+import junit.framework.TestCase;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Map;
+import java.util.Map.Entry;
+
+/**
+ * Test the {@link SystemLibrariesReader}
+ */
+public class SystemLibrariesReaderTest extends TestCase {
+
+
+ public void testLibrariesFileExists(){
+ File sdkLibPath = new File(PackageLibraryManager.DEFAULT_SDK_PATH, "lib");
+ File librariesFile = new File(new File(sdkLibPath, SystemLibrariesReader.INTERNAL_DIR), SystemLibrariesReader.LIBRARIES_FILE);
+ assertTrue(librariesFile.exists());
+ }
+
+ public void testLibrariesFileContent() throws URISyntaxException{
+ File sdkLibPath = new File(PackageLibraryManager.DEFAULT_SDK_PATH, "lib");
+ URI base = sdkLibPath.toURI();
+ SystemLibrariesReader reader = new SystemLibrariesReader(sdkLibPath);
+ Map<String, DartLibrary> librariesMap = reader.getLibrariesMap();
+ assertTrue(!librariesMap.isEmpty());
+ for (Entry<String, DartLibrary> entry : librariesMap.entrySet()) {
+ String path = entry.getValue().getPath();
+ File file = new File(base.resolve(new URI(null, null, path, null, null)).normalize());
+ assertTrue(file.exists());
+ }
+
+ // check content
+ // "coreimpl": const LibraryInfo(
+ // "coreimpl/coreimpl_runtime.dart",
+ // implementation: true,
+ // dart2jsPath: "compiler/implementation/lib/coreimpl.dart",
+ // dart2jsPatchPath: "compiler/implementation/lib/coreimpl_patch.dart")
+ DartLibrary library = librariesMap.get("dart:coreimpl");
+ assertTrue(library != null);
+ assertEquals("dart:coreimpl",library.getShortName());
+ assertTrue(library.isImplementation());
+ assertEquals("Shared", library.getCategory());
+
+ // "builtin": const LibraryInfo(
+ // "builtin/builtin_runtime.dart",
+ // category: "Server",
+ // platforms: VM_PLATFORM),
+ library = librariesMap.get("dart:builtin");
+ assertTrue(library != null);
+ assertEquals("dart:builtin",library.getShortName());
+ assertFalse(library.isImplementation());
+ assertTrue(library.isVmLibrary());
+ assertEquals("Server", library.getCategory());
+
+ }
+
+}
« no previous file with comments | « compiler/javatests/com/google/dart/compiler/CompilerTests.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698