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

Side by Side Diff: packages/barback/test/package_graph/transform/consume_input_test.dart

Issue 3014633002: Roll to pickup pool changes (Closed)
Patch Set: Created 3 years, 2 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
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.transform.pass_through_test; 5 library barback.test.package_graph.transform.pass_through_test;
6 6
7 import 'package:barback/src/utils.dart';
8 import 'package:scheduled_test/scheduled_test.dart'; 7 import 'package:scheduled_test/scheduled_test.dart';
9 8
10 import '../../utils.dart'; 9 import '../../utils.dart';
11 10
12 main() { 11 main() {
13 initConfig(); 12 initConfig();
14 test("a transform consumes its input without overwriting it", () { 13 test("a transform consumes its input without overwriting it", () {
15 initGraph([ 14 initGraph([
16 "app|foo.txt" 15 "app|foo.txt"
17 ], { 16 ], {
18 "app": [[new RewriteTransformer("txt", "out")..consumePrimary = true]] 17 "app": [
18 [new RewriteTransformer("txt", "out")..consumePrimary = true]
19 ]
19 }); 20 });
20 21
21 updateSources(["app|foo.txt"]); 22 updateSources(["app|foo.txt"]);
22 expectAsset("app|foo.out", "foo.out"); 23 expectAsset("app|foo.out", "foo.out");
23 expectNoAsset("app|foo.txt"); 24 expectNoAsset("app|foo.txt");
24 buildShouldSucceed(); 25 buildShouldSucceed();
25 }); 26 });
26 27
27 test("a transform consumes its input while a sibling overwrites it", () { 28 test("a transform consumes its input while a sibling overwrites it", () {
28 initGraph([ 29 initGraph([
29 "app|foo.txt" 30 "app|foo.txt"
30 ], { 31 ], {
31 "app": [[ 32 "app": [
32 new RewriteTransformer("txt", "out")..consumePrimary = true, 33 [
33 new RewriteTransformer("txt", "txt") 34 new RewriteTransformer("txt", "out")..consumePrimary = true,
34 ]] 35 new RewriteTransformer("txt", "txt")
36 ]
37 ]
35 }); 38 });
36 39
37 updateSources(["app|foo.txt"]); 40 updateSources(["app|foo.txt"]);
38 expectAsset("app|foo.out", "foo.out"); 41 expectAsset("app|foo.out", "foo.out");
39 expectAsset("app|foo.txt", "foo.txt"); 42 expectAsset("app|foo.txt", "foo.txt");
40 buildShouldSucceed(); 43 buildShouldSucceed();
41 }); 44 });
42 45
43 test("a transform stops consuming its input", () { 46 test("a transform stops consuming its input", () {
44 initGraph({ 47 initGraph({
45 "app|foo.txt": "yes" 48 "app|foo.txt": "yes"
46 }, { 49 }, {
47 "app": [[ 50 "app": [
48 new ConditionallyConsumePrimaryTransformer("txt", "out", "yes") 51 [new ConditionallyConsumePrimaryTransformer("txt", "out", "yes")]
49 ]] 52 ]
50 }); 53 });
51 54
52 updateSources(["app|foo.txt"]); 55 updateSources(["app|foo.txt"]);
53 expectAsset("app|foo.out", "yes.out"); 56 expectAsset("app|foo.out", "yes.out");
54 expectNoAsset("app|foo.txt"); 57 expectNoAsset("app|foo.txt");
55 buildShouldSucceed(); 58 buildShouldSucceed();
56 59
57 modifyAsset("app|foo.txt", "no"); 60 modifyAsset("app|foo.txt", "no");
58 updateSources(["app|foo.txt"]); 61 updateSources(["app|foo.txt"]);
59 expectAsset("app|foo.out", "no.out"); 62 expectAsset("app|foo.out", "no.out");
60 expectAsset("app|foo.txt", "no"); 63 expectAsset("app|foo.txt", "no");
61 buildShouldSucceed(); 64 buildShouldSucceed();
62 }); 65 });
63 66
64 test("two sibling transforms both consume their input", () { 67 test("two sibling transforms both consume their input", () {
65 initGraph(["app|foo.txt"], { 68 initGraph([
66 "app": [[ 69 "app|foo.txt"
67 new RewriteTransformer("txt", "one")..consumePrimary = true, 70 ], {
68 new RewriteTransformer("txt", "two")..consumePrimary = true 71 "app": [
69 ]] 72 [
73 new RewriteTransformer("txt", "one")..consumePrimary = true,
74 new RewriteTransformer("txt", "two")..consumePrimary = true
75 ]
76 ]
70 }); 77 });
71 78
72 updateSources(["app|foo.txt"]); 79 updateSources(["app|foo.txt"]);
73 expectAsset("app|foo.one", "foo.one"); 80 expectAsset("app|foo.one", "foo.one");
74 expectAsset("app|foo.two", "foo.two"); 81 expectAsset("app|foo.two", "foo.two");
75 expectNoAsset("app|foo.txt"); 82 expectNoAsset("app|foo.txt");
76 buildShouldSucceed(); 83 buildShouldSucceed();
77 }); 84 });
78 85
79 test("a transform stops consuming its input but a sibling is still " 86 test(
87 "a transform stops consuming its input but a sibling is still "
80 "consuming it", () { 88 "consuming it", () {
81 initGraph({ 89 initGraph({
82 "app|foo.txt": "yes" 90 "app|foo.txt": "yes"
83 }, { 91 }, {
84 "app": [[ 92 "app": [
85 new RewriteTransformer("txt", "one")..consumePrimary = true, 93 [
86 new ConditionallyConsumePrimaryTransformer("txt", "two", "yes") 94 new RewriteTransformer("txt", "one")..consumePrimary = true,
87 ]] 95 new ConditionallyConsumePrimaryTransformer("txt", "two", "yes")
96 ]
97 ]
88 }); 98 });
89 99
90 updateSources(["app|foo.txt"]); 100 updateSources(["app|foo.txt"]);
91 expectAsset("app|foo.one", "yes.one"); 101 expectAsset("app|foo.one", "yes.one");
92 expectAsset("app|foo.two", "yes.two"); 102 expectAsset("app|foo.two", "yes.two");
93 expectNoAsset("app|foo.txt"); 103 expectNoAsset("app|foo.txt");
94 buildShouldSucceed(); 104 buildShouldSucceed();
95 105
96 modifyAsset("app|foo.txt", "no"); 106 modifyAsset("app|foo.txt", "no");
97 updateSources(["app|foo.txt"]); 107 updateSources(["app|foo.txt"]);
98 expectAsset("app|foo.one", "no.one"); 108 expectAsset("app|foo.one", "no.one");
99 expectAsset("app|foo.two", "no.two"); 109 expectAsset("app|foo.two", "no.two");
100 expectNoAsset("app|foo.txt"); 110 expectNoAsset("app|foo.txt");
101 buildShouldSucceed(); 111 buildShouldSucceed();
102 }); 112 });
103 113
104 test("a transform consumes its input and emits nothing", () { 114 test("a transform consumes its input and emits nothing", () {
105 initGraph([ 115 initGraph([
106 "app|foo.txt" 116 "app|foo.txt"
107 ], { 117 ], {
108 "app": [[new EmitNothingTransformer("txt")..consumePrimary = true]] 118 "app": [
119 [new EmitNothingTransformer("txt")..consumePrimary = true]
120 ]
109 }); 121 });
110 122
111 updateSources(["app|foo.txt"]); 123 updateSources(["app|foo.txt"]);
112 expectNoAsset("app|foo.txt"); 124 expectNoAsset("app|foo.txt");
113 buildShouldSucceed(); 125 buildShouldSucceed();
114 }); 126 });
115 127
116 test("a transform consumes its input, then is removed", () { 128 test("a transform consumes its input, then is removed", () {
117 initGraph([ 129 initGraph([
118 "app|foo.txt" 130 "app|foo.txt"
119 ], { 131 ], {
120 "app": [[new RewriteTransformer("txt", "out")..consumePrimary = true]] 132 "app": [
133 [new RewriteTransformer("txt", "out")..consumePrimary = true]
134 ]
121 }); 135 });
122 136
123 updateSources(["app|foo.txt"]); 137 updateSources(["app|foo.txt"]);
124 expectAsset("app|foo.out", "foo.out"); 138 expectAsset("app|foo.out", "foo.out");
125 expectNoAsset("app|foo.txt"); 139 expectNoAsset("app|foo.txt");
126 buildShouldSucceed(); 140 buildShouldSucceed();
127 141
128 updateTransformers("app", [[]]); 142 updateTransformers("app", [[]]);
129 expectNoAsset("app|foo.out"); 143 expectNoAsset("app|foo.out");
130 expectAsset("app|foo.txt", "foo"); 144 expectAsset("app|foo.txt", "foo");
131 buildShouldSucceed(); 145 buildShouldSucceed();
132 }); 146 });
133 147
134 test("a transform consumes its input and emits nothing, then is removed", 148 test("a transform consumes its input and emits nothing, then is removed", () {
135 () {
136 initGraph([ 149 initGraph([
137 "app|foo.txt" 150 "app|foo.txt"
138 ], { 151 ], {
139 "app": [[new EmitNothingTransformer("txt")..consumePrimary = true]] 152 "app": [
153 [new EmitNothingTransformer("txt")..consumePrimary = true]
154 ]
140 }); 155 });
141 156
142 updateSources(["app|foo.txt"]); 157 updateSources(["app|foo.txt"]);
143 expectNoAsset("app|foo.txt"); 158 expectNoAsset("app|foo.txt");
144 buildShouldSucceed(); 159 buildShouldSucceed();
145 160
146 updateTransformers("app", [[]]); 161 updateTransformers("app", [[]]);
147 expectAsset("app|foo.txt", "foo"); 162 expectAsset("app|foo.txt", "foo");
148 buildShouldSucceed(); 163 buildShouldSucceed();
149 }); 164 });
150 165
151 test("a transform which consumes its input is added", () { 166 test("a transform which consumes its input is added", () {
152 initGraph([ 167 initGraph([
153 "app|foo.txt" 168 "app|foo.txt"
154 ], { 169 ], {
155 "app": [[]] 170 "app": [[]]
156 }); 171 });
157 172
158 updateSources(["app|foo.txt"]); 173 updateSources(["app|foo.txt"]);
159 expectNoAsset("app|foo.out"); 174 expectNoAsset("app|foo.out");
160 expectAsset("app|foo.txt", "foo"); 175 expectAsset("app|foo.txt", "foo");
161 buildShouldSucceed(); 176 buildShouldSucceed();
162 177
163 updateTransformers("app", [[ 178 updateTransformers("app", [
164 new RewriteTransformer("txt", "out")..consumePrimary = true 179 [new RewriteTransformer("txt", "out")..consumePrimary = true]
165 ]]); 180 ]);
166 expectAsset("app|foo.out", "foo.out"); 181 expectAsset("app|foo.out", "foo.out");
167 expectNoAsset("app|foo.txt"); 182 expectNoAsset("app|foo.txt");
168 buildShouldSucceed(); 183 buildShouldSucceed();
169 }); 184 });
170 } 185 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698