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

Unified Diff: dart/tests/compiler/dart2js/uri_extras_test.dart

Issue 10914094: Improve [relativize] for Windows. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dart/pkg/dartdoc/mirrors/dart2js_mirror.dart ('k') | dart/utils/compiler/build_helper.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/tests/compiler/dart2js/uri_extras_test.dart
diff --git a/dart/tests/compiler/dart2js/uri_extras_test.dart b/dart/tests/compiler/dart2js/uri_extras_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..651865bf827a145ef02dd2c3e7562b27e7a7ee3c
--- /dev/null
+++ b/dart/tests/compiler/dart2js/uri_extras_test.dart
@@ -0,0 +1,70 @@
+// 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.
+
+#import('dart:uri');
+
+#import('../../../lib/compiler/implementation/util/uri_extras.dart');
+
+
+void testRelativize() {
+ void c(String expected, String base, String path, bool isWindows) {
+ if (isWindows === null) {
+ c(expected, base, path, true);
+ c(expected, base, path, false);
+ return;
+ }
+ String r;
+
+ r = relativize(new Uri.fromString('file:$base'),
+ new Uri.fromString('file:$path'),
+ isWindows);
+ Expect.stringEquals(expected, r);
+
+ r = relativize(new Uri.fromString('FILE:$base'),
+ new Uri.fromString('FILE:$path'),
+ isWindows);
+ Expect.stringEquals(expected, r);
+
+ r = relativize(new Uri.fromString('file:$base'),
+ new Uri.fromString('FILE:$path'),
+ isWindows);
+ Expect.stringEquals(expected, r);
+
+ r = relativize(new Uri.fromString('FILE:$base'),
+ new Uri.fromString('file:$path'),
+ isWindows);
+ Expect.stringEquals(expected, r);
+ }
+ c('bar', '/', '/bar', null);
+ c('/bar', '/foo', '/bar', null);
+ c('/bar', '/foo/', '/bar', null);
+
+ c('bar', '///c:/', '///c:/bar', true);
+ c('/c:/bar', '///c:/foo', '///c:/bar', true);
+ c('/c:/bar', '///c:/foo/', '///c:/bar', true);
+
+ c('BAR', '///c:/', '///c:/BAR', true);
+ c('/c:/BAR', '///c:/foo', '///c:/BAR', true);
+ c('/c:/BAR', '///c:/foo/', '///c:/BAR', true);
+
+ c('../lib/compiler/implementation/dart2js.dart',
+ '///C:/Users/person/dart_checkout_for_stuff/dart/ReleaseIA32/dart.exe',
+ '///c:/Users/person/dart_checkout_for_stuff/dart/lib/compiler/'
+ 'implementation/dart2js.dart',
+ true);
+
+ c('/Users/person/file.dart', '/users/person/', '/Users/person/file.dart',
+ false);
+
+ c('file.dart', '/Users/person/', '/Users/person/file.dart', null);
+
+ c('../person/file.dart', '/Users/other/', '/Users/person/file.dart', false);
+
+ c('/Users/person/file.dart', '/Users/other/', '/Users/person/file.dart',
+ true);
+}
+
+void main() {
+ testRelativize();
+}
« no previous file with comments | « dart/pkg/dartdoc/mirrors/dart2js_mirror.dart ('k') | dart/utils/compiler/build_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698