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

Unified Diff: tools/testing/dart/browser_test.dart

Issue 10584014: Change test scripts to use Path library in most places, instead of strings. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address my own comments. Created 8 years, 6 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
Index: tools/testing/dart/browser_test.dart
diff --git a/tools/testing/dart/browser_test.dart b/tools/testing/dart/browser_test.dart
index f7dccc21a67413fcdbd9fab73b482d8108aec445..7b52bc13fad639d3da8a14977785787ba0e13ad3 100644
--- a/tools/testing/dart/browser_test.dart
+++ b/tools/testing/dart/browser_test.dart
@@ -27,35 +27,18 @@ String GetHtmlContents(String title,
</html>
""";
-/**
- * Returns the native [path] converted for use in a URI.
- */
-nativePathToUri(String path) {
- // This regexp matches Windows-like file names. Strictly speaking,
- // this prevents us from having a file named a:something on Linux,
- // but since this wrapping is a hack in the first place, it seems
- // better to exercise this path on all architectures.
- final re = const RegExp('^[a-z]:', ignoreCase: true);
- if (re.hasMatch(path)) {
- path = '/$path';
- }
- return path.replaceAll('\\', '/');
-}
-
-String WrapDartTestInLibrary(String test) =>
+String WrapDartTestInLibrary(Path test) =>
"""
#library('libraryWrapper');
-#source('${nativePathToUri(test)}');
+#source('$test');
""";
-String DartTestWrapper(String dartHome, String library) {
- dartHome = nativePathToUri(dartHome);
- library = nativePathToUri(library);
+String DartTestWrapper(Path dartHome, Path library) {
Anton Muhin 2012/06/26 13:22:18 nit: switch to => syntax here too?
Bill Hesse 2012/06/27 09:35:03 Done.
return """
#library('test');
-#import('${dartHome}/lib/unittest/unittest.dart', prefix: 'unittest');
-#import('${dartHome}/lib/unittest/html_config.dart', prefix: 'config');
+#import('${dartHome.append('lib/unittest/unittest.dart')}, prefix: 'unittest');
+#import('${dartHome.append('lib/unittest/html_config.dart')}, prefix: 'config');
#import('${library}', prefix: "Test");

Powered by Google App Engine
This is Rietveld 408576698