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

Unified Diff: pkg/code_transformers/lib/tests.dart

Issue 140203007: Adding package:code_transformers for unifying common transformers code (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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: pkg/code_transformers/lib/tests.dart
diff --git a/pkg/code_transformers/lib/tests.dart b/pkg/code_transformers/lib/tests.dart
new file mode 100644
index 0000000000000000000000000000000000000000..aba827ce94e79c4c68f2295589d28e53d12acddf
--- /dev/null
+++ b/pkg/code_transformers/lib/tests.dart
@@ -0,0 +1,38 @@
+// 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 code_transformers.tests;
Siggi Cherem (dart-lang) 2014/02/14 02:13:37 might be worth adding a library comment for this o
blois 2014/02/19 21:42:58 Done.
+
+import 'dart:async' show Future;
+
+import 'package:barback/barback.dart' show Transformer;
+import 'package:unittest/unittest.dart';
+
+import 'src/test_harness.dart';
+
+/// Defines a test which invokes [updateTransformers]
Siggi Cherem (dart-lang) 2014/02/14 02:13:37 minor nit: add a '.' at the end
blois 2014/02/19 21:42:58 Done.
+testPhases(String testName, List<List<Transformer>> phases,
+ Map<String, String> inputs, Map<String, String> results,
+ [List<String> messages]) {
+ test(testName,
+ () => updateTransformers(phases, inputs: inputs, results: results,
+ messages: messages));
+}
+
+/// Updates the provided transformers with [inputs] as asset inputs then
+/// validates that [results] were generated.
+///
+/// The keys for inputs and results are 'package_name|lib/file.dart'.
+/// Only files which are specified in results are validated.
+///
+/// If [messages] is non-null then this will validate that only the specified
+/// messages were generated, ignoring info messages.
+Future updateTransformers(List<List<Transformer>> phases,
Siggi Cherem (dart-lang) 2014/02/14 02:13:37 mmm, normally I don't think of transformers as bei
blois 2014/02/19 21:42:58 Done.
+ {Map<String, String> inputs: const {},
+ Map<String, String> results: const {},
+ List<String> messages: const []}) {
+
+ var helper = new TestHelper(phases, inputs, messages)..run();
+ return helper.checkAll(results).then((_) => helper.tearDown());
+}

Powered by Google App Engine
This is Rietveld 408576698