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

Unified Diff: pkg/barback/test/package_graph/collisions_test.dart

Issue 195993005: Don't pass an asset through a transformer that produces an error. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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
« no previous file with comments | « pkg/barback/lib/src/transform_node.dart ('k') | pkg/barback/test/package_graph/errors_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/barback/test/package_graph/collisions_test.dart
diff --git a/pkg/barback/test/package_graph/errors_test.dart b/pkg/barback/test/package_graph/collisions_test.dart
similarity index 53%
copy from pkg/barback/test/package_graph/errors_test.dart
copy to pkg/barback/test/package_graph/collisions_test.dart
index 2728859aa2849987793c4e06fd1ed5907d5bb4f6..6740f7e98ecb1ffd53d2a3084627bda78fa03f8d 100644
--- a/pkg/barback/test/package_graph/errors_test.dart
+++ b/pkg/barback/test/package_graph/collisions_test.dart
@@ -12,167 +12,6 @@ import '../utils.dart';
main() {
initConfig();
- test("errors if two transformers output the same file", () {
Bob Nystrom 2014/03/13 16:56:47 Why are these tests deleted?
nweiz 2014/03/13 19:31:37 This is a new file, collisions_test; these tests s
- initGraph(["app|foo.a"], {"app": [
- [
- new RewriteTransformer("a", "b"),
- new RewriteTransformer("a", "b")
- ]
- ]});
- updateSources(["app|foo.a"]);
-
- buildShouldFail([isAssetCollisionException("app|foo.b")]);
- });
-
- test("errors if a new transformer outputs the same file as an old "
- "transformer", () {
- initGraph(["app|foo.a", "app|foo.b"], {"app": [
- [
- new RewriteTransformer("a", "c"),
- new RewriteTransformer("b", "c")
- ]
- ]});
- updateSources(["app|foo.a"]);
- expectAsset("app|foo.c", "foo.c");
- buildShouldSucceed();
-
- updateSources(["app|foo.b"]);
- buildShouldFail([isAssetCollisionException("app|foo.c")]);
- });
-
- test("does not report asset not found errors in results", () {
- initGraph(["app|bar.txt"]);
-
- // Trigger a build.
- updateSources(["app|bar.txt"]);
-
- expectNoAsset("app|foo.txt");
- buildShouldSucceed();
- });
-
- test("reports an error for an unprovided package", () {
- initGraph();
- expect(() => updateSourcesSync(["unknown|foo.txt"]), throwsArgumentError);
- });
-
- test("reports an error for an unprovided source", () {
- initGraph(["app|known.txt"], {"app": [
- // Have a dummy transformer so that barback at least tries to load the
- // asset.
- [new RewriteTransformer("a", "b")]
- ]});
-
- updateSources(["app|unknown.txt"]);
-
- buildShouldFail([
- isAssetLoadException("app|unknown.txt",
- isAssetNotFoundException("app|unknown.txt"))
- ]);
- });
-
- test("reports missing input errors in results", () {
- initGraph({"app|a.txt": "a.inc"}, {"app": [
- [new ManyToOneTransformer("txt")]
- ]});
-
- updateSources(["app|a.txt"]);
- expectNoAsset("app|a.out");
- buildShouldFail([isMissingInputException("app|a.inc")]);
- });
-
- test("reports an error if a transformer emits an asset for another package",
- () {
- initGraph(["app|foo.txt"], {
- "app": [[new CreateAssetTransformer("wrong|foo.txt")]]
- });
-
- updateSources(["app|foo.txt"]);
- buildShouldFail([isInvalidOutputException("wrong|foo.txt")]);
- });
-
- test("fails if a non-primary input is removed", () {
- initGraph({
- "app|a.txt": "a.inc,b.inc,c.inc",
- "app|a.inc": "a",
- "app|b.inc": "b",
- "app|c.inc": "c"
- }, {"app": [
- [new ManyToOneTransformer("txt")]
- ]});
-
- updateSources(["app|a.txt", "app|a.inc", "app|b.inc", "app|c.inc"]);
- expectAsset("app|a.out", "abc");
- buildShouldSucceed();
-
- removeSources(["app|b.inc"]);
- buildShouldFail([isMissingInputException("app|b.inc")]);
- expectNoAsset("app|a.out");
- });
-
- test("catches transformer exceptions and reports them", () {
- initGraph(["app|foo.txt"], {"app": [
- [new BadTransformer(["app|foo.out"])]
- ]});
-
- updateSources(["app|foo.txt"]);
- expectNoAsset("app|foo.out");
- buildShouldFail([isTransformerException(equals(BadTransformer.ERROR))]);
- });
-
- test("catches errors even if nothing is waiting for process results", () {
- initGraph(["app|foo.txt"], {"app": [[new BadTransformer([])]]});
-
- updateSources(["app|foo.txt"]);
- // Note: No asset requests here.
- buildShouldFail([isTransformerException(equals(BadTransformer.ERROR))]);
- });
-
- test("discards outputs from failed transforms", () {
- initGraph(["app|foo.txt"], {"app": [
- [new BadTransformer(["a.out", "b.out"])]
- ]});
-
- updateSources(["app|foo.txt"]);
- expectNoAsset("app|a.out");
- });
-
- test("fails if only one package fails", () {
- initGraph(["pkg1|foo.txt", "pkg2|foo.txt"],
- {"pkg1": [[new BadTransformer([])]]});
-
- updateSources(["pkg1|foo.txt", "pkg2|foo.txt"]);
- expectAsset("pkg2|foo.txt", "foo");
- buildShouldFail([isTransformerException(equals(BadTransformer.ERROR))]);
- });
-
- test("emits multiple failures if multiple packages fail", () {
- initGraph(["pkg1|foo.txt", "pkg2|foo.txt"], {
- "pkg1": [[new BadTransformer([])]],
- "pkg2": [[new BadTransformer([])]]
- });
-
- updateSources(["pkg1|foo.txt", "pkg2|foo.txt"]);
- buildShouldFail([
- isTransformerException(equals(BadTransformer.ERROR)),
- isTransformerException(equals(BadTransformer.ERROR))
- ]);
- });
-
- test("an error loading an asset removes the asset from the graph", () {
- initGraph(["app|foo.txt"], {"app": [
- // Have a dummy transformer so that barback at least tries to load the
- // asset.
- [new RewriteTransformer("a", "b")]
- ]});
-
- setAssetError("app|foo.txt");
- updateSources(["app|foo.txt"]);
- expectNoAsset("app|foo.txt");
- buildShouldFail([
- isAssetLoadException("app|foo.txt", isMockLoadException("app|foo.txt"))
- ]);
- });
-
test("a collision returns the first-produced output", () {
var rewrite1 = new RewriteTransformer("one", "out");
var rewrite2 = new RewriteTransformer("two", "out");
« no previous file with comments | « pkg/barback/lib/src/transform_node.dart ('k') | pkg/barback/test/package_graph/errors_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698