Chromium Code Reviews| OLD | NEW |
|---|---|
| 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.declaring_transformer_test; | 5 library barback.test.package_graph.declaring_transformer_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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 213 // Once we make a request, [declaring] should force the lazy transformer and | 213 // Once we make a request, [declaring] should force the lazy transformer and |
| 214 // then run itself. | 214 // then run itself. |
| 215 expectAsset("app|out.three", "app|out.two.three"); | 215 expectAsset("app|out.three", "app|out.two.three"); |
| 216 buildShouldSucceed(); | 216 buildShouldSucceed(); |
| 217 | 217 |
| 218 // Now [declaring] should have run twice. This ensures that it didn't use | 218 // Now [declaring] should have run twice. This ensures that it didn't use |
| 219 // its original output for some reason. | 219 // its original output for some reason. |
| 220 expect(declaring.numRuns, completion(equals(2))); | 220 expect(declaring.numRuns, completion(equals(2))); |
| 221 }); | 221 }); |
| 222 | 222 |
| 223 // TODO(nweiz): Re-enable these when barback is capable of dealing with a | 223 group("with an error in declareOutputs", () { |
| 224 // changing [TransformNode.deferred] value. | 224 test("still runs apply", () { |
|
Bob Nystrom
2014/04/29 23:46:22
This seems like a perverse edge case to add comple
nweiz
2014/04/30 00:36:57
Why not apply it? As far as we know, it'll still f
Bob Nystrom
2014/04/30 19:21:24
Maybe, but it's also likely to be broken if it cou
| |
| 225 // group("with an error in declareOutputs", () { | 225 initGraph(["app|foo.txt"], {"app": [[ |
| 226 // test("still runs apply", () { | 226 new DeclaringBadTransformer("app|out.txt", |
| 227 // initGraph(["app|foo.txt"], {"app": [[ | 227 declareError: true, applyError: false) |
| 228 // new DeclaringBadTransformer("app|out.txt", | 228 ]]}); |
| 229 // declareError: true, applyError: false) | 229 |
| 230 // ]]}); | 230 updateSources(["app|foo.txt"]); |
| 231 // | 231 expectAsset("app|out.txt", "bad out"); |
| 232 // updateSources(["app|foo.txt"]); | 232 expectAsset("app|foo.txt", "foo"); |
| 233 // expectAsset("app|out.txt", "bad out"); | 233 buildShouldFail([isTransformerException(BadTransformer.ERROR)]); |
| 234 // expectAsset("app|foo.txt", "foo"); | 234 }); |
| 235 // buildShouldFail([isTransformerException(BadTransformer.ERROR)]); | 235 |
| 236 // }); | 236 test("waits for apply to complete before passing through the input even if " |
| 237 // | 237 "consumePrimary was called", () { |
| 238 // test("waits for apply to complete before passing through the input even i f " | 238 var transformer = new DeclaringBadTransformer("app|out.txt", |
| 239 // "consumePrimary was called", () { | 239 declareError: true, applyError: false)..consumePrimary = true; |
| 240 // var transformer = new DeclaringBadTransformer("app|out.txt", | 240 initGraph(["app|foo.txt"], {"app": [[transformer]]}); |
| 241 // declareError: true, applyError: false)..consumePrimary = true; | 241 |
| 242 // initGraph(["app|foo.txt"], {"app": [[transformer]]}); | 242 transformer.pauseApply(); |
| 243 // | 243 updateSources(["app|foo.txt"]); |
| 244 // transformer.pauseApply(); | 244 expectAssetDoesNotComplete("app|out.txt"); |
| 245 // updateSources(["app|foo.txt"]); | 245 expectAssetDoesNotComplete("app|foo.txt"); |
| 246 // expectAssetDoesNotComplete("app|out.txt"); | 246 |
| 247 // expectAssetDoesNotComplete("app|foo.txt"); | 247 transformer.resumeApply(); |
| 248 // | 248 expectAsset("app|out.txt", "bad out"); |
| 249 // transformer.resumeApply(); | 249 expectNoAsset("app|foo.txt"); |
| 250 // expectAsset("app|out.txt", "bad out"); | 250 buildShouldFail([isTransformerException(BadTransformer.ERROR)]); |
| 251 // expectNoAsset("app|foo.txt"); | 251 }); |
| 252 // buildShouldFail([isTransformerException(BadTransformer.ERROR)]); | 252 }); |
| 253 // }); | |
| 254 // }); | |
| 255 | 253 |
| 256 test("with an error in apply still passes through the input", () { | 254 test("with an error in apply still passes through the input", () { |
| 257 initGraph(["app|foo.txt"], {"app": [[ | 255 initGraph(["app|foo.txt"], {"app": [[ |
| 258 new DeclaringBadTransformer("app|out.txt", | 256 new DeclaringBadTransformer("app|out.txt", |
| 259 declareError: false, applyError: true) | 257 declareError: false, applyError: true) |
| 260 ]]}); | 258 ]]}); |
| 261 | 259 |
| 262 updateSources(["app|foo.txt"]); | 260 updateSources(["app|foo.txt"]); |
| 263 expectNoAsset("app|out.txt"); | 261 expectNoAsset("app|out.txt"); |
| 264 expectAsset("app|foo.txt", "foo"); | 262 expectAsset("app|foo.txt", "foo"); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 296 test("can declare outputs it doesn't emit", () { | 294 test("can declare outputs it doesn't emit", () { |
| 297 initGraph(["app|foo.txt"], {"app": [ | 295 initGraph(["app|foo.txt"], {"app": [ |
| 298 [new DeclareAssetsTransformer(["app|out.txt"], [])] | 296 [new DeclareAssetsTransformer(["app|out.txt"], [])] |
| 299 ]}); | 297 ]}); |
| 300 | 298 |
| 301 updateSources(["app|foo.txt"]); | 299 updateSources(["app|foo.txt"]); |
| 302 expectNoAsset("app|out.txt"); | 300 expectNoAsset("app|out.txt"); |
| 303 buildShouldSucceed(); | 301 buildShouldSucceed(); |
| 304 }); | 302 }); |
| 305 } | 303 } |
| OLD | NEW |