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

Side by Side 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, 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4 package com.google.dart.compiler;
5
6 import junit.framework.TestCase;
7
8 import java.io.File;
9 import java.net.URI;
10 import java.net.URISyntaxException;
11 import java.util.Map;
12 import java.util.Map.Entry;
13
14 /**
15 * Test the {@link SystemLibrariesReader}
16 */
17 public class SystemLibrariesReaderTest extends TestCase {
18
19
20 public void testLibrariesFileExists(){
21 File sdkLibPath = new File(PackageLibraryManager.DEFAULT_SDK_PATH, "lib");
22 File librariesFile = new File(new File(sdkLibPath, SystemLibrariesReader.INT ERNAL_DIR), SystemLibrariesReader.LIBRARIES_FILE);
23 assertTrue(librariesFile.exists());
24 }
25
26 public void testLibrariesFileContent(){
27 File sdkLibPath = new File(PackageLibraryManager.DEFAULT_SDK_PATH, "lib");
28 URI base = sdkLibPath.toURI();
29 SystemLibrariesReader reader = new SystemLibrariesReader(sdkLibPath);
30 Map<String, Map<String, String>> librariesMap = reader.getLibrariesMap();
31 assertTrue(!librariesMap.isEmpty());
32 for (Entry<String, Map<String, String>> entry : librariesMap.entrySet()){
33 String path = entry.getValue().get("path");
34 File file;
35 try {
36 file = new File(base.resolve(new URI(null, null, path, null, null)).norma lize());
37 } catch (URISyntaxException e) {
38 continue;
danrubel 2012/08/28 00:25:45 Seems like we should fail if it cannot be resolved
keertip 2012/08/28 20:41:57 Done.
39 }
40 assertTrue(file.exists());
41 }
42 }
43
danrubel 2012/08/28 00:25:45 Perhaps some tests to sanity check other aspects i
keertip 2012/08/28 20:41:57 Done.
44 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698