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

Unified Diff: pkg/front_end/test/src/base/uri_resolver_test.dart

Issue 2628653002: Fix Windows path handling in uri_resolver_test. (Closed)
Patch Set: Created 3 years, 11 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 | « no previous file | pkg/pkg.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/test/src/base/uri_resolver_test.dart
diff --git a/pkg/front_end/test/src/base/uri_resolver_test.dart b/pkg/front_end/test/src/base/uri_resolver_test.dart
index af00240f74df357235dda45c54b7d52c3b534d7f..627b4664d473d73e638c19528f97ba912d79c2fc 100644
--- a/pkg/front_end/test/src/base/uri_resolver_test.dart
+++ b/pkg/front_end/test/src/base/uri_resolver_test.dart
@@ -46,11 +46,11 @@ abstract class UriResolverTest {
}
void test_file() {
- _expectResolution('file:///foo.dart', _p('foo.dart'));
+ _expectResolution(_fileUri('foo.dart'), _p('foo.dart'));
}
void test_fileLongPath() {
- _expectResolution('file:///foo/bar.dart', _p('foo/bar.dart'));
+ _expectResolution(_fileUri('foo/bar.dart'), _p('foo/bar.dart'));
}
void test_noSchemeAbsolute() {
@@ -121,14 +121,27 @@ abstract class UriResolverTest {
expect(uriResolver.resolve(Uri.parse(uriString)), expectedResult);
}
+ /// Prepends "file:///", plus a Windows drive letter if applicable, to the
+ /// given path.
+ String _fileUri(String pathPart) {
+ if (pathContext.separator == '/') {
+ return 'file:///$pathPart';
+ } else {
+ return 'file:///C:/$pathPart';
+ }
+ }
+
/// Converts a posix style path into a path appropriate for the current path
/// context.
String _p(String posixPath) {
- return pathContext.fromUri(_u(posixPath));
+ if (!posixPath.startsWith('/')) posixPath = '/$posixPath';
+ if (pathContext.separator == '/') return posixPath;
+ // Windows
+ return 'C:${posixPath.replaceAll('/', pathContext.separator)}';
}
/// Converts a posix style path into a file URI.
- Uri _u(String posixPath) => Uri.parse('file:///$posixPath');
+ Uri _u(String posixPath) => pathContext.toUri(_p(posixPath));
}
/// Override of [UriResolverTest] which uses the native path context for the
« no previous file with comments | « no previous file | pkg/pkg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698