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

Side by Side Diff: pkg/polymer/test/build/script_compactor_test.dart

Issue 239433012: Detect and warn about missing scripts (rather than fail during the build) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
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 polymer.test.build.script_compactor_test; 5 library polymer.test.build.script_compactor_test;
6 6
7 import 'package:code_transformers/tests.dart' show testingDartSdkDirectory; 7 import 'package:code_transformers/tests.dart' show testingDartSdkDirectory;
8 import 'package:polymer/src/build/common.dart'; 8 import 'package:polymer/src/build/common.dart';
9 import 'package:polymer/src/build/script_compactor.dart'; 9 import 'package:polymer/src/build/script_compactor.dart';
10 import 'package:smoke/codegen/generator.dart' show DEFAULT_IMPORTS; 10 import 'package:smoke/codegen/generator.dart' show DEFAULT_IMPORTS;
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 declarations: { 101 declarations: {
102 smoke_0.XFoo: const {}, 102 smoke_0.XFoo: const {},
103 })); 103 }));
104 startPolymer([ 104 startPolymer([
105 i0.main, 105 i0.main,
106 () => Polymer.register(\'x-foo\', i0.XFoo), 106 () => Polymer.register(\'x-foo\', i0.XFoo),
107 ]); 107 ]);
108 } 108 }
109 '''.replaceAll('\n ', '\n'), 109 '''.replaceAll('\n ', '\n'),
110 }); 110 });
111 111
112 testPhases('use const expressions', phases, { 112 testPhases('use const expressions', phases, {
113 'a|web/test.html': 113 'a|web/test.html':
114 '<!DOCTYPE html><html><head>', 114 '<!DOCTYPE html><html><head>',
115 'a|web/test.html.scriptUrls': '[["a","web/a.dart"]]', 115 'a|web/test.html.scriptUrls': '[["a","web/a.dart"]]',
116 'a|web/b.dart': 116 'a|web/b.dart':
117 'library a;\n' 117 'library a;\n'
118 'const x = "x";\n', 118 'const x = "x";\n',
119 'a|web/c.dart': 119 'a|web/c.dart':
120 'part of a;\n' 120 'part of a;\n'
121 'const dash = "-";\n', 121 'const dash = "-";\n',
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 'a|web/test.html': 156 'a|web/test.html':
157 '<!DOCTYPE html><html><head>', 157 '<!DOCTYPE html><html><head>',
158 'a|web/test.html.scriptUrls': '[["a","web/a.dart"]]', 158 'a|web/test.html.scriptUrls': '[["a","web/a.dart"]]',
159 'a|web/a.dart': 159 'a|web/a.dart':
160 'library a;\n' 160 'library a;\n'
161 'import "package:polymer/polymer.dart";\n' 161 'import "package:polymer/polymer.dart";\n'
162 '@CustomTag("\${x}-foo")\n' // invalid, x is not defined 162 '@CustomTag("\${x}-foo")\n' // invalid, x is not defined
163 'class XFoo extends PolymerElement {\n' 163 'class XFoo extends PolymerElement {\n'
164 '}\n' 164 '}\n'
165 'main(){}', 165 'main(){}',
166 }, {}, [ 166 }, {
167 'a|web/test.html_bootstrap.dart':
168 '''$MAIN_HEADER
169 import 'a.dart' as i0;
170 ${DEFAULT_IMPORTS.join('\n')}
171 import 'a.dart' as smoke_0;
172 import 'package:polymer/polymer.dart' as smoke_1;
173
174 void main() {
175 useGeneratedCode(new StaticConfiguration(
176 checkedMode: false,
177 parents: {
178 smoke_0.XFoo: smoke_1.PolymerElement,
179 },
180 declarations: {
181 smoke_0.XFoo: const {},
182 }));
183 startPolymer([]);
184 }
185 '''.replaceAll('\n ', '\n'),
186
187 }, [
167 'warning: The parameter to @CustomTag seems to be invalid. ' 188 'warning: The parameter to @CustomTag seems to be invalid. '
168 '(web/a.dart 2 11)', 189 '(web/a.dart 2 11)',
190 'warning: no polymer initializers were found.',
191 ]);
192
193 testPhases('no polymer import (no warning, but no crash either)', phases, {
194 'a|web/test.html':
195 '<!DOCTYPE html><html><head>',
196 'a|web/test.html.scriptUrls': '[["a","web/a.dart"]]',
197 'a|web/a.dart':
198 'library a;\n'
199 'import "package:polymer/polymer.broken.import.dart";\n'
200 '@CustomTag("x-foo")\n'
201 'class XFoo extends PolymerElement {\n'
202 '}\n'
203 'main(){}',
204 }, {
205 'a|web/test.html_bootstrap.dart':
206 '''$MAIN_HEADER
207 import 'a.dart' as i0;
208 ${DEFAULT_IMPORTS.join('\n')}
209
210 void main() {
211 useGeneratedCode(new StaticConfiguration(
212 checkedMode: false));
213 startPolymer([]);
214 }
215 '''.replaceAll('\n ', '\n'),
216
217 }, [
218 'warning: no polymer initializers were found.',
169 ]); 219 ]);
170 220
171 testPhases('several scripts', phases, { 221 testPhases('several scripts', phases, {
172 'a|web/test.html': 222 'a|web/test.html':
173 '<!DOCTYPE html><html><head>' 223 '<!DOCTYPE html><html><head>'
174 '</head><body><div></div>', 224 '</head><body><div></div>',
175 'a|web/test.html.scriptUrls': 225 'a|web/test.html.scriptUrls':
176 '[["a", "web/a.dart"],["a", "web/b.dart"],["a", "web/c.dart"],' 226 '[["a", "web/a.dart"],["a", "web/b.dart"],["a", "web/c.dart"],'
177 '["a", "web/d.dart"]]', 227 '["a", "web/d.dart"]]',
178 'a|web/d.dart': 228 'a|web/d.dart':
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 void main() { 299 void main() {
250 useGeneratedCode(new StaticConfiguration( 300 useGeneratedCode(new StaticConfiguration(
251 checkedMode: false, 301 checkedMode: false,
252 parents: { 302 parents: {
253 smoke_5.XC1: smoke_1.PolymerElement, 303 smoke_5.XC1: smoke_1.PolymerElement,
254 smoke_5.XC2: smoke_1.PolymerElement, 304 smoke_5.XC2: smoke_1.PolymerElement,
255 smoke_0.XE: smoke_1.PolymerElement, 305 smoke_0.XE: smoke_1.PolymerElement,
256 smoke_2.XF1: smoke_1.PolymerElement, 306 smoke_2.XF1: smoke_1.PolymerElement,
257 smoke_3.XG2: smoke_1.PolymerElement, 307 smoke_3.XG2: smoke_1.PolymerElement,
258 smoke_4.XH1: smoke_1.PolymerElement, 308 smoke_4.XH1: smoke_1.PolymerElement,
259 }, 309 },
260 declarations: { 310 declarations: {
261 smoke_5.XC1: const {}, 311 smoke_5.XC1: const {},
262 smoke_5.XC2: const {}, 312 smoke_5.XC2: const {},
263 smoke_0.XE: const {}, 313 smoke_0.XE: const {},
264 smoke_2.XF1: const {}, 314 smoke_2.XF1: const {},
265 smoke_3.XG2: const {}, 315 smoke_3.XG2: const {},
266 smoke_4.XH1: const {}, 316 smoke_4.XH1: const {},
267 })); 317 }));
268 startPolymer([ 318 startPolymer([
269 i0.mA, 319 i0.mA,
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 names: { 648 names: {
599 #registerCallback: r'registerCallback', 649 #registerCallback: r'registerCallback',
600 })); 650 }));
601 startPolymer([ 651 startPolymer([
602 () => Polymer.register(\'x-foo\', i0.XFoo), 652 () => Polymer.register(\'x-foo\', i0.XFoo),
603 ]); 653 ]);
604 } 654 }
605 '''.replaceAll('\n ', '\n'), 655 '''.replaceAll('\n ', '\n'),
606 }); 656 });
607 } 657 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698