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

Side by Side Diff: compiler/javatests/com/google/dart/compiler/PackageLibraryManagerTest.java

Issue 11365196: Move JSSyntaxRegExp to core as a private member. This removes the last refrences to dart:coreimpl. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix two pending TODO's. Created 8 years, 1 month 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
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 package com.google.dart.compiler; 4 package com.google.dart.compiler;
5 5
6 import junit.framework.TestCase; 6 import junit.framework.TestCase;
7 7
8 import java.net.URI; 8 import java.net.URI;
9 9
10 public class PackageLibraryManagerTest extends TestCase { 10 public class PackageLibraryManagerTest extends TestCase {
(...skipping 16 matching lines...) Expand all
27 public void testExpand1() throws Exception { 27 public void testExpand1() throws Exception {
28 URI shortUri = new URI("dart:core"); 28 URI shortUri = new URI("dart:core");
29 URI fullUri = packageLibraryManager.expandRelativeDartUri(shortUri); 29 URI fullUri = packageLibraryManager.expandRelativeDartUri(shortUri);
30 assertNotNull(fullUri); 30 assertNotNull(fullUri);
31 assertEquals("dart", fullUri.getScheme()); 31 assertEquals("dart", fullUri.getScheme());
32 assertEquals("core", fullUri.getHost()); 32 assertEquals("core", fullUri.getHost());
33 assertTrue(getPath(fullUri).endsWith("/core.dart")); 33 assertTrue(getPath(fullUri).endsWith("/core.dart"));
34 } 34 }
35 35
36 public void testExpand2() throws Exception { 36 public void testExpand2() throws Exception {
37 URI shortUri = new URI("dart:coreimpl");
38 URI fullUri = packageLibraryManager.expandRelativeDartUri(shortUri);
39 assertNotNull(fullUri);
40 assertEquals("dart", fullUri.getScheme());
41 assertEquals("coreimpl", fullUri.getHost());
42 assertTrue(getPath(fullUri).endsWith("/coreimpl.dart"));
43 }
44
45 public void testExpand3() throws Exception {
46 URI shortUri = new URI("dart:coreimpl");
47 URI fullUri1 = packageLibraryManager.expandRelativeDartUri(shortUri);
48 URI fullUri2 = packageLibraryManager.expandRelativeDartUri(fullUri1);
49 assertNotNull(fullUri2);
50 assertEquals("dart", fullUri2.getScheme());
51 assertEquals("coreimpl", fullUri2.getHost());
52 assertTrue(getPath(fullUri2).endsWith("/coreimpl.dart"));
53 }
54
55 public void testExpand4() throws Exception {
56 URI shortUri = new URI("dart:doesnotexist"); 37 URI shortUri = new URI("dart:doesnotexist");
57 URI fullUri = packageLibraryManager.expandRelativeDartUri(shortUri); 38 URI fullUri = packageLibraryManager.expandRelativeDartUri(shortUri);
58 assertNull(fullUri); 39 assertNull(fullUri);
59 } 40 }
60 41
61 public void testTranslate1() throws Exception { 42 public void testTranslate1() throws Exception {
62 URI shortUri = new URI("dart:core"); 43 URI shortUri = new URI("dart:core");
63 URI fullUri = packageLibraryManager.expandRelativeDartUri(shortUri); 44 URI fullUri = packageLibraryManager.expandRelativeDartUri(shortUri);
64 URI translatedURI = packageLibraryManager.resolveDartUri(fullUri); 45 URI translatedURI = packageLibraryManager.resolveDartUri(fullUri);
65 assertNotNull(translatedURI); 46 assertNotNull(translatedURI);
66 String scheme = translatedURI.getScheme(); 47 String scheme = translatedURI.getScheme();
67 assertTrue(scheme.equals("file")); 48 assertTrue(scheme.equals("file"));
68 assertTrue(getPath(translatedURI).endsWith("/core.dart")); 49 assertTrue(getPath(translatedURI).endsWith("/core.dart"));
69 } 50 }
70 51
71 public void testTranslate2() throws Exception { 52 public void testTranslate2() throws Exception {
72 URI shortUri = new URI("dart:coreimpl");
73 URI fullUri = packageLibraryManager.expandRelativeDartUri(shortUri);
74 URI translatedURI = packageLibraryManager.resolveDartUri(fullUri);
75 assertNotNull(translatedURI);
76 String scheme = translatedURI.getScheme();
77 assertTrue(scheme.equals("file"));
78 assertTrue(getPath(translatedURI).endsWith("/coreimpl.dart"));
79 }
80
81 public void testTranslate3() throws Exception {
82 URI fullUri = new URI("dart://doesnotexist/some/file.dart"); 53 URI fullUri = new URI("dart://doesnotexist/some/file.dart");
83 URI translatedURI = packageLibraryManager.resolveDartUri(fullUri); 54 URI translatedURI = packageLibraryManager.resolveDartUri(fullUri);
84 assertNotNull(translatedURI); 55 assertNotNull(translatedURI);
85 String scheme = translatedURI.getScheme(); 56 String scheme = translatedURI.getScheme();
86 assertTrue(scheme.equals("file")); 57 assertTrue(scheme.equals("file"));
87 assertTrue(getPath(translatedURI).endsWith("some/file.dart")); 58 assertTrue(getPath(translatedURI).endsWith("some/file.dart"));
88 } 59 }
89 60
90 public void testPackageExpand1() throws Exception { 61 public void testPackageExpand1() throws Exception {
91 URI shortUri = new URI("package:test.dart"); 62 URI shortUri = new URI("package:test.dart");
(...skipping 17 matching lines...) Expand all
109 public void testPackageTranslate1() throws Exception { 80 public void testPackageTranslate1() throws Exception {
110 URI shortUri = new URI("package:test.dart"); 81 URI shortUri = new URI("package:test.dart");
111 URI fullUri = packageLibraryManager.expandRelativeDartUri(shortUri); 82 URI fullUri = packageLibraryManager.expandRelativeDartUri(shortUri);
112 URI translatedURI = packageLibraryManager.resolveDartUri(fullUri); 83 URI translatedURI = packageLibraryManager.resolveDartUri(fullUri);
113 assertNotNull(translatedURI); 84 assertNotNull(translatedURI);
114 String scheme = translatedURI.getScheme(); 85 String scheme = translatedURI.getScheme();
115 assertTrue(scheme.equals("file")); 86 assertTrue(scheme.equals("file"));
116 assertTrue(getPath(translatedURI).endsWith("/test.dart")); 87 assertTrue(getPath(translatedURI).endsWith("/test.dart"));
117 } 88 }
118 } 89 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698