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

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

Issue 227123007: Only run [declareOutputs] once for each asset/transformer pair. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: changes from 224933002 Created 6 years, 8 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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.lazy_asset_test; 5 library barback.test.package_graph.lazy_asset_test;
6 6
7 import 'package:barback/barback.dart'; 7 import 'package:barback/barback.dart';
8 import 'package:barback/src/utils.dart'; 8 import 'package:barback/src/utils.dart';
9 import 'package:scheduled_test/scheduled_test.dart'; 9 import 'package:scheduled_test/scheduled_test.dart';
10 10
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 var transformer = new LazyRewriteTransformer("blub", "blab"); 75 var transformer = new LazyRewriteTransformer("blub", "blab");
76 initGraph(["app|foo.blub"], {"app": [ 76 initGraph(["app|foo.blub"], {"app": [
77 [transformer], 77 [transformer],
78 [new RewriteTransformer("blab", "blib")] 78 [new RewriteTransformer("blab", "blib")]
79 ]}); 79 ]});
80 updateSources(["app|foo.blub"]); 80 updateSources(["app|foo.blub"]);
81 buildShouldSucceed(); 81 buildShouldSucceed();
82 expect(transformer.numRuns, completion(equals(1))); 82 expect(transformer.numRuns, completion(equals(1)));
83 }); 83 });
84 84
85 // TODO(nweiz): enable these once DeclaringTransformers forward laziness
86 // properly (issue 16442).
87 //
88 // test("a lazy asset piped into a declaring transformer isn't eagerly " 85 // test("a lazy asset piped into a declaring transformer isn't eagerly "
89 // "compiled", () { 86 // "compiled", () {
90 // var transformer1 = new LazyRewriteTransformer("blub", "blab"); 87 // var transformer1 = new LazyRewriteTransformer("blub", "blab");
91 // var transformer2 = new DeclaringRewriteTransformer("blab", "blib"); 88 // var transformer2 = new DeclaringRewriteTransformer("blab", "blib");
92 // initGraph(["app|foo.blub"], {"app": [ 89 // initGraph(["app|foo.blub"], {"app": [
93 // [transformer1], [transformer2] 90 // [transformer1], [transformer2]
94 // ]}); 91 // ]});
95 // updateSources(["app|foo.blub"]); 92 // updateSources(["app|foo.blub"]);
96 // buildShouldSucceed(); 93 // buildShouldSucceed();
97 // expect(transformer1.numRuns, completion(equals(0))); 94 // expect(transformer1.numRuns, completion(equals(0)));
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 ]}); 219 ]});
223 220
224 updateSources(["app|foo.txt"]); 221 updateSources(["app|foo.txt"]);
225 expectNoAsset("app|foo.blab"); 222 expectNoAsset("app|foo.blab");
226 223
227 // Getting all assets will force every lazy transformer. This shouldn't 224 // Getting all assets will force every lazy transformer. This shouldn't
228 // cause the rewrite to apply, because foo.txt isn't primary. 225 // cause the rewrite to apply, because foo.txt isn't primary.
229 expectAllAssets(["app|foo.txt"]); 226 expectAllAssets(["app|foo.txt"]);
230 buildShouldSucceed(); 227 buildShouldSucceed();
231 }); 228 });
229
230 // Regression test
Bob Nystrom 2014/04/08 18:23:44 "."
nweiz 2014/04/08 23:42:33 Done.
231 test("a lazy transformer that doesn't apply updates its passed-through asset",
232 () {
233 initGraph(["app|foo.txt"], {"app": [
234 [new LazyRewriteTransformer("blub", "blab")]
235 ]});
236
237 // Pause the provider so that the transformer will start forwarding the
238 // asset while it's dirty.
239 pauseProvider();
240 updateSources(["app|foo.txt"]);
241 expectAssetDoesNotComplete("app|foo.txt");
242
243 resumeProvider();
244 expectAsset("app|foo.txt", "foo");
245 buildShouldSucceed();
246
247 modifyAsset("app|foo.txt", "bar");
248 updateSources(["app|foo.txt"]);
249 expectAsset("app|foo.txt", "bar");
250 buildShouldSucceed();
251 });
232 } 252 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698