Chromium Code Reviews| 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,44 @@ |
| +// 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 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(){ |
| + File sdkLibPath = new File(PackageLibraryManager.DEFAULT_SDK_PATH, "lib"); |
| + URI base = sdkLibPath.toURI(); |
| + SystemLibrariesReader reader = new SystemLibrariesReader(sdkLibPath); |
| + Map<String, Map<String, String>> librariesMap = reader.getLibrariesMap(); |
| + assertTrue(!librariesMap.isEmpty()); |
| + for (Entry<String, Map<String, String>> entry : librariesMap.entrySet()){ |
| + String path = entry.getValue().get("path"); |
| + File file; |
| + try { |
| + file = new File(base.resolve(new URI(null, null, path, null, null)).normalize()); |
| + } catch (URISyntaxException e) { |
| + 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.
|
| + } |
| + assertTrue(file.exists()); |
| + } |
| + } |
| + |
|
danrubel
2012/08/28 00:25:45
Perhaps some tests to sanity check other aspects i
keertip
2012/08/28 20:41:57
Done.
|
| +} |