Index: pkg/code_transformers/lib/src/test_harness.dart |
diff --git a/pkg/polymer/test/build/common.dart b/pkg/code_transformers/lib/src/test_harness.dart |
similarity index 76% |
copy from pkg/polymer/test/build/common.dart |
copy to pkg/code_transformers/lib/src/test_harness.dart |
index d7ca4151c727ce97e63c681a3711031e580d90b5..db5390902d1b53cc4978da332e1d5a2198d23719 100644 |
--- a/pkg/polymer/test/build/common.dart |
+++ b/pkg/code_transformers/lib/src/test_harness.dart |
@@ -1,8 +1,9 @@ |
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
+// Copyright (c) 2014, 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. |
-library polymer.test.build.common; |
+/// Utilities for creating unit tests of Barback transformers. |
+library code_transformers.src.test_harness; |
import 'dart:async'; |
@@ -20,15 +21,12 @@ String _removeTrailingWhitespace(String str) => |
str.splitMapJoin('\n', |
onNonMatch: (s) => s.replaceAll(new RegExp(r'\s+$'), '')); |
-/** |
- * A helper package provider that has files stored in memory, also wraps |
- * [Barback] to simply our tests. |
- */ |
+/// A helper package provider that has files stored in memory, also wraps |
+/// [Barback] to simply our tests. |
class TestHelper implements PackageProvider { |
- /** |
- * Maps from an asset string identifier of the form 'package|path' to the |
- * file contents. |
- */ |
+ |
+ /// Maps from an asset string identifier of the form 'package|path' to the |
+ /// file contents. |
final Map<String, String> files; |
final Iterable<String> packages; |
final List<String> messages; |
@@ -88,10 +86,8 @@ class TestHelper implements PackageProvider { |
logSubscription.cancel(); |
} |
- /** |
- * Tells barback which files have changed, and thus anything that depends on |
- * it on should be computed. By default mark all the input files. |
- */ |
+ /// Tells barback which files have changed, and thus anything that depends on |
+ /// it on should be computed. By default mark all the input files. |
void run([Iterable<String> paths]) { |
if (paths == null) paths = files.keys; |
barback.updateSources(paths.map(idFromString)); |
@@ -126,20 +122,3 @@ class TestHelper implements PackageProvider { |
}); |
} |
} |
- |
-testPhases(String testName, List<List<Transformer>> phases, |
- Map<String, String> inputFiles, Map<String, String> expectedFiles, |
- [List<String> expectedMessages]) { |
- test(testName, () { |
- var helper = new TestHelper(phases, inputFiles, expectedMessages)..run(); |
- return helper.checkAll(expectedFiles).then((_) => helper.tearDown()); |
- }); |
-} |
- |
-const WEB_COMPONENTS_TAG = |
- '<script src="packages/web_components/platform.js"></script>\n' |
- '<script src="packages/web_components/dart_support.js"></script>\n'; |
- |
-const INTEROP_TAG = '<script src="packages/browser/interop.js"></script>\n'; |
-const DART_JS_TAG = '<script src="packages/browser/dart.js"></script>'; |
- |