OLD | NEW |
---|---|
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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_test; | 5 library barback.test.package_graph.transform_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'; |
11 | 11 |
12 // This tests the behavior of barback under many operations happening in quick | |
13 // succession. Since Barback is so asynchronous, it's easy for it to have subtle | |
14 // dependencies on the commonly-used and -tested usage patterns. These tests | |
15 // exist to stress-test less-common usage patterns in order root out additional | |
Bob Nystrom
2013/10/29 17:25:29
"order root" -> "order to root".
nweiz
2013/10/29 19:27:26
Done.
| |
16 // bugs. | |
17 | |
12 main() { | 18 main() { |
13 initConfig(); | 19 initConfig(); |
14 | 20 |
15 test("updates sources many times", () { | 21 test("updates sources many times", () { |
16 initGraph(["app|foo.txt"], { | 22 initGraph(["app|foo.txt"], { |
17 "app": [[new RewriteTransformer("txt", "out")]] | 23 "app": [[new RewriteTransformer("txt", "out")]] |
18 }); | 24 }); |
19 | 25 |
20 for (var i = 0; i < 1000; i++) { | 26 for (var i = 0; i < 1000; i++) { |
21 updateSources(["app|foo.txt"]); | 27 updateSources(["app|foo.txt"]); |
(...skipping 16 matching lines...) Expand all Loading... | |
38 expectNoAsset("app|foo.out"); | 44 expectNoAsset("app|foo.out"); |
39 expectNoAsset("app|foo.txt"); | 45 expectNoAsset("app|foo.txt"); |
40 buildShouldSucceed(); | 46 buildShouldSucceed(); |
41 }); | 47 }); |
42 | 48 |
43 test("updates transformers many times", () { | 49 test("updates transformers many times", () { |
44 var rewrite = new RewriteTransformer("txt", "out"); | 50 var rewrite = new RewriteTransformer("txt", "out"); |
45 initGraph(["app|foo.txt"], {"app": [[rewrite]]}); | 51 initGraph(["app|foo.txt"], {"app": [[rewrite]]}); |
46 updateSources(["app|foo.txt"]); | 52 updateSources(["app|foo.txt"]); |
47 | 53 |
48 for (var i = 0; i < 1; i++) { | 54 for (var i = 0; i < 1000; i++) { |
49 updateTransformers("app", [[rewrite]]); | 55 updateTransformers("app", [[rewrite]]); |
50 } | 56 } |
51 | 57 |
52 expectAsset("app|foo.out", "foo.out"); | 58 expectAsset("app|foo.out", "foo.out"); |
53 buildShouldSucceed(); | 59 buildShouldSucceed(); |
54 }); | 60 }); |
55 | 61 |
56 test("updates and removes transformers many times", () { | 62 test("updates and removes transformers many times", () { |
57 var rewrite = new RewriteTransformer("txt", "out"); | 63 var rewrite = new RewriteTransformer("txt", "out"); |
58 initGraph(["app|foo.txt"], {"app": [[rewrite]]}); | 64 initGraph(["app|foo.txt"], {"app": [[rewrite]]}); |
59 updateSources(["app|foo.txt"]); | 65 updateSources(["app|foo.txt"]); |
60 | 66 |
61 for (var i = 0; i < 1; i++) { | 67 for (var i = 0; i < 1000; i++) { |
62 updateTransformers("app", [[rewrite]]); | 68 updateTransformers("app", [[rewrite]]); |
63 updateTransformers("app", [[]]); | 69 updateTransformers("app", [[]]); |
64 } | 70 } |
65 | 71 |
66 expectAsset("app|foo.txt", "foo"); | 72 expectAsset("app|foo.txt", "foo"); |
67 expectNoAsset("app|foo.out"); | 73 expectNoAsset("app|foo.out"); |
68 buildShouldSucceed(); | 74 buildShouldSucceed(); |
69 }); | 75 }); |
70 } | 76 } |
OLD | NEW |