| 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.transform.pass_through_test; | 5 library barback.test.package_graph.transform.pass_through_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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 | 183 |
| 184 updateSources(["pkg1|a.txt", "pkg2|a.inc"]); | 184 updateSources(["pkg1|a.txt", "pkg2|a.inc"]); |
| 185 expectAsset("pkg1|a.out", "a transformed"); | 185 expectAsset("pkg1|a.out", "a transformed"); |
| 186 buildShouldSucceed(); | 186 buildShouldSucceed(); |
| 187 | 187 |
| 188 modifyAsset("pkg2|a.inc", "b"); | 188 modifyAsset("pkg2|a.inc", "b"); |
| 189 updateSources(["pkg2|a.inc"]); | 189 updateSources(["pkg2|a.inc"]); |
| 190 expectAsset("pkg1|a.out", "b"); | 190 expectAsset("pkg1|a.out", "b"); |
| 191 buildShouldSucceed(); | 191 buildShouldSucceed(); |
| 192 }); | 192 }); |
| 193 | |
| 194 test("re-runs if the primary input is invalidated before accessing", () { | |
| 195 var transformer1 = new RewriteTransformer("txt", "mid"); | |
| 196 var transformer2 = new RewriteTransformer("mid", "out"); | |
| 197 | |
| 198 initGraph([ | |
| 199 "app|foo.txt" | |
| 200 ], {"app": [ | |
| 201 [transformer1], | |
| 202 [transformer2] | |
| 203 ]}); | |
| 204 | |
| 205 transformer2.pausePrimaryInput(); | |
| 206 updateSources(["app|foo.txt"]); | |
| 207 | |
| 208 // Wait long enough to ensure that transformer1 has completed and | |
| 209 // transformer2 has started. | |
| 210 schedule(pumpEventQueue); | |
| 211 | |
| 212 // Update the source again so that transformer1 invalidates the primary | |
| 213 // input of transformer2. | |
| 214 transformer1.pauseApply(); | |
| 215 updateSources(["app|foo.txt"]); | |
| 216 | |
| 217 transformer2.resumePrimaryInput(); | |
| 218 transformer1.resumeApply(); | |
| 219 | |
| 220 expectAsset("app|foo.out", "foo.mid.out"); | |
| 221 buildShouldSucceed(); | |
| 222 | |
| 223 expect(transformer1.numRuns, completion(equals(2))); | |
| 224 expect(transformer2.numRuns, completion(equals(2))); | |
| 225 }); | |
| 226 } | 193 } |
| OLD | NEW |