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

Side by Side Diff: pkg/barback/test/package_graph/transform_test.dart

Issue 23543005: Make Transform a little more pleasant to use: (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise test code for handling primaryInput. Created 7 years, 3 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
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library barback.test.package_graph.transform_test; 5 library barback.test.package_graph.transform_test;
6 6
7 import 'package:barback/src/utils.dart'; 7 import 'package:barback/src/utils.dart';
8 import 'package:scheduled_test/scheduled_test.dart'; 8 import 'package:scheduled_test/scheduled_test.dart';
9 9
10 import '../utils.dart'; 10 import '../utils.dart';
(...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after
1088 1088
1089 updateSources(["pkg1|a.txt", "pkg2|a.inc"]); 1089 updateSources(["pkg1|a.txt", "pkg2|a.inc"]);
1090 expectAsset("pkg1|a.out", "a transformed"); 1090 expectAsset("pkg1|a.out", "a transformed");
1091 buildShouldSucceed(); 1091 buildShouldSucceed();
1092 1092
1093 modifyAsset("pkg2|a.inc", "b"); 1093 modifyAsset("pkg2|a.inc", "b");
1094 updateSources(["pkg2|a.inc"]); 1094 updateSources(["pkg2|a.inc"]);
1095 expectAsset("pkg1|a.out", "b"); 1095 expectAsset("pkg1|a.out", "b");
1096 buildShouldSucceed(); 1096 buildShouldSucceed();
1097 }); 1097 });
1098
1099 test("re-runs if the primary input is invalidated before accessing", () {
1100 var transformer1 = new RewriteTransformer("txt", "mid");
1101 var transformer2 = new RewriteTransformer("mid", "out");
1102
1103 initGraph([
1104 "app|foo.txt"
1105 ], {"app": [
1106 [transformer1],
1107 [transformer2]
1108 ]});
1109
1110 transformer2.pauseGetPrimary();
1111 updateSources(["app|foo.txt"]);
1112
1113 // Wait long enough to ensure that transformer1 has completed and
1114 // transformer2 has started.
1115 schedule(pumpEventQueue);
1116
1117 // Update the source again so that transformer1 invalidates the primary
1118 // input of transformer2.
1119 transformer1.pauseApply();
1120 updateSources(["app|foo.txt"]);
1121
1122 transformer2.resumeGetPrimary();
1123 transformer1.resumeApply();
1124
1125 expectAsset("app|foo.out", "foo.mid.out");
1126 buildShouldSucceed();
1127
1128 expect(transformer1.numRuns, completion(equals(2)));
1129 expect(transformer2.numRuns, completion(equals(2)));
1130 });
1098 }); 1131 });
1099 } 1132 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698