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

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

Issue 11638049: Convert unittest to use "package:" imports. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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 | « pkg/unittest/test/unittest_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/testing/dart/browser_test.dart
diff --git a/tools/testing/dart/browser_test.dart b/tools/testing/dart/browser_test.dart
index 0694db3f68f07c4c5bbbe1bc3a4276df21a1d252..619b8c70fc5fbca4f9a8dad843d6b2e1c5695c1f 100644
--- a/tools/testing/dart/browser_test.dart
+++ b/tools/testing/dart/browser_test.dart
@@ -54,12 +54,19 @@ library libraryWrapper;
part '$test';
""";
-String dartTestWrapper(Path dartHome, Path library) =>
-"""
+String dartTestWrapper(Path dartHome, Path library) {
+ // Tests inside "pkg" import unittest using "package:". All others use a
+ // relative path. The imports need to agree, so use a matching form here.
+ var unitTest = dartHome.append("pkg/unittest/lib").toString();
+ if (library.relativeTo(dartHome).segments().contains("pkg")) {
+ unitTest = 'package:unittest';
+ }
+
+ return """
library test;
-import '${dartHome.append('pkg/unittest/lib/unittest.dart')}' as unittest;
-import '${dartHome.append('pkg/unittest/lib/html_config.dart')}' as config;
+import '$unitTest/unittest.dart' as unittest;
+import '$unitTest/html_config.dart' as config;
import '${library}' as Test;
main() {
@@ -67,4 +74,4 @@ main() {
unittest.group('', Test.main);
}
""";
-
+}
« no previous file with comments | « pkg/unittest/test/unittest_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698