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

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

Issue 255483002: Expand barback's notion of dirtiness to understand declaredness. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 6 years, 7 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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 347
348 updateSources(["app|foo.txt"]); 348 updateSources(["app|foo.txt"]);
349 expectNoAsset("app|foo.blab"); 349 expectNoAsset("app|foo.blab");
350 350
351 // Getting all assets will force every lazy transformer. This shouldn't 351 // Getting all assets will force every lazy transformer. This shouldn't
352 // cause the rewrite to apply, because foo.txt isn't primary. 352 // cause the rewrite to apply, because foo.txt isn't primary.
353 expectAllAssets(["app|foo.txt"]); 353 expectAllAssets(["app|foo.txt"]);
354 buildShouldSucceed(); 354 buildShouldSucceed();
355 }); 355 });
356 356
357 test("a lazy transformer that generates fewer outputs than it declares is "
358 "forced when a declared but ungenerated output is requested", () {
359 initGraph({"app|foo.txt": "no"}, {"app": [
360 [new LazyCheckContentAndRenameTransformer(
361 oldExtension: "txt", oldContent: "yes",
362 newExtension: "out", newContent: "done")]
363 ]});
364
365 updateSources(["app|foo.txt"]);
366 expectNoAsset("app|foo.out");
367 buildShouldSucceed();
368
369 modifyAsset("app|foo.txt", "yes");
370 updateSources(["app|foo.txt"]);
371 expectAsset("app|foo.out", "done");
372 buildShouldSucceed();
373 });
374
357 // Regression tests. 375 // Regression tests.
358 376
359 test("a lazy transformer that doesn't apply updates its passed-through asset", 377 test("a lazy transformer that doesn't apply updates its passed-through asset",
360 () { 378 () {
361 initGraph(["app|foo.txt"], {"app": [ 379 initGraph(["app|foo.txt"], {"app": [
362 [new LazyRewriteTransformer("blub", "blab")] 380 [new LazyRewriteTransformer("blub", "blab")]
363 ]}); 381 ]});
364 382
365 // Pause the provider so that the transformer will start forwarding the 383 // Pause the provider so that the transformer will start forwarding the
366 // asset while it's dirty. 384 // asset while it's dirty.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 buildShouldSucceed(); 421 buildShouldSucceed();
404 422
405 // [assets] should run once for each time foo.in was updated. 423 // [assets] should run once for each time foo.in was updated.
406 expect(assets.numRuns, completion(equals(2))); 424 expect(assets.numRuns, completion(equals(2)));
407 425
408 // [rewrite] should run once against [assets]'s original output and once 426 // [rewrite] should run once against [assets]'s original output and once
409 // against its new output. 427 // against its new output.
410 expect(rewrite.numRuns, completion(equals(2))); 428 expect(rewrite.numRuns, completion(equals(2)));
411 }); 429 });
412 } 430 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698