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

Side by Side Diff: pkg/barback/test/transformer/bad.dart

Issue 21226004: Refactor the barback tests somewhat. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes. Created 7 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 import 'dart:async';
6
7 import 'package:barback/barback.dart';
8 import 'package:barback/src/utils.dart';
9
10 import 'mock.dart';
11
12 /// A transformer that throws an exception when run, after generating the
13 /// given outputs.
14 class BadTransformer extends MockTransformer {
15 /// The error it throws.
16 static const ERROR = "I am a bad transformer!";
17
18 /// The list of asset names that it should output.
19 final List<String> outputs;
20
21 BadTransformer(this.outputs);
22
23 Future<bool> doIsPrimary(Asset asset) => new Future.value(true);
24
25 Future doApply(Transform transform) {
26 return newFuture(() {
27 // Create the outputs first.
28 for (var output in outputs) {
29 var id = new AssetId.parse(output);
30 transform.addOutput(new Asset.fromString(id, output));
31 }
32
33 // Then fail.
34 throw ERROR;
35 });
36 }
37 }
OLDNEW
« no previous file with comments | « pkg/barback/test/package_graph/transform_test.dart ('k') | pkg/barback/test/transformer/check_content.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698