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

Side by Side Diff: pkg/polymer/test/build/code_extractor.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 // TODO(jmesserly): merge into import_inliner_test.dart. 5 // TODO(jmesserly): merge into import_inliner_test.dart.
6 // Keeping here for now so it's easier to see the diff. 6 // Keeping here for now so it's easier to see the diff.
7 part of polymer.test.build.import_inliner_test; 7 part of polymer.test.build.import_inliner_test;
8 8
9 void codeExtractorTests() { 9 void codeExtractorTests() {
10 testPhases('no changes', phases, { 10 testPhases('no changes', phases, {
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 ["a", "web/test.html.2.dart"], 157 ["a", "web/test.html.2.dart"],
158 ["a", "web/test.html.3.dart"], 158 ["a", "web/test.html.3.dart"],
159 ]), 159 ]),
160 'a|web/test.html.0.dart': 'library a.web.test2_html_0;\nmain1() { }', 160 'a|web/test.html.0.dart': 'library a.web.test2_html_0;\nmain1() { }',
161 'a|web/test.html.1.dart': 'library a.web.bar.test_html_1;\nmain2() { }', 161 'a|web/test.html.1.dart': 'library a.web.bar.test_html_1;\nmain2() { }',
162 'a|web/test.html.2.dart': 'library a.foo.test_html_2;\nmain3() { }', 162 'a|web/test.html.2.dart': 'library a.foo.test_html_2;\nmain3() { }',
163 'a|web/test.html.3.dart': 'library b.test_html_3;\nmain4() { }' 163 'a|web/test.html.3.dart': 'library b.test_html_3;\nmain4() { }'
164 }); 164 });
165 165
166 group('fixes import/export/part URIs', dartUriTests); 166 group('fixes import/export/part URIs', dartUriTests);
167 group('validates script-tag URIs', validateUriTests);
167 } 168 }
168 169
169 dartUriTests() { 170 dartUriTests() {
170 171
171 testPhases('from web folder', phases, { 172 testPhases('from web folder', phases, {
172 'a|web/test.html': 173 'a|web/test.html':
173 '<!DOCTYPE html><html><head>' 174 '<!DOCTYPE html><html><head>'
174 '<link rel="import" href="test2/foo.html">' 175 '<link rel="import" href="test2/foo.html">'
175 '</head><body></body></html>', 176 '</head><body></body></html>',
176 'a|web/test2/foo.html': 177 'a|web/test2/foo.html':
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 '<!DOCTYPE html><html><head></head><body>' 306 '<!DOCTYPE html><html><head></head><body>'
306 '<script type="application/dart;component=1">' 307 '<script type="application/dart;component=1">'
307 "import 'package:qux/qux.dart';" 308 "import 'package:qux/qux.dart';"
308 "import 'foo.dart';" 309 "import 'foo.dart';"
309 "export 'bar.dart';" 310 "export 'bar.dart';"
310 "part 'baz.dart';" 311 "part 'baz.dart';"
311 '</script>' 312 '</script>'
312 '</body></html>', 313 '</body></html>',
313 }); 314 });
314 } 315 }
316
317 validateUriTests() {
318
319 testPhases('script is inline', phases, {
320 'a|web/test.html':
321 '<!DOCTYPE html><html><body>'
322 '<script type="application/dart;component=1">'
323 'main(){}'
324 '</script>'
325 '</body></html>',
326 }, {
327 'a|web/test.html.scriptUrls': '[["a","web/test.html.0.dart"]]',
328 }, []);
329
330 testPhases('script src is valid', phases, {
331 'a|web/test.html':
332 '<!DOCTYPE html><html><body>'
333 '<script type="application/dart;component=1" src="a.dart"></script>'
334 '</body></html>',
335 'a|web/a.dart': 'main() {}',
336 }, {
337 'a|web/test.html.scriptUrls': '[["a","web/a.dart"]]',
338 }, []);
339
340 testPhases('script src is invalid', phases, {
341 'a|web/test.html':
342 '<!DOCTYPE html><html><body>\n'
343 '<script type="application/dart;component=1" src="a.dart"></script>'
344 '</body></html>',
345 }, {
346 'a|web/test.html.scriptUrls': '[]',
347 }, [
348 'warning: Script file at "a.dart" not found. (web/test.html 1 0)',
349 ]);
350
351 testPhases('many script src around, valid and invalid', phases, {
352 'a|web/test.html':
353 '<!DOCTYPE html><html><body>'
354 '<script type="application/dart;component=1" src="a.dart"></script>'
355 '\n<script type="application/dart;component=1" src="b.dart"></script>'
356 '\n<script type="application/dart;component=1" src="c.dart"></script>'
357 '\n<script type="application/dart;component=1" src="d.dart"></script>'
358 '</body></html>',
359 'a|web/a.dart': 'main() {}',
360 'a|web/c.dart': 'main() {}',
361 }, {
362 'a|web/test.html.scriptUrls': '[["a","web/a.dart"],["a","web/c.dart"]]',
363 }, [
364 'warning: Script file at "b.dart" not found. (web/test.html 1 0)',
365 'warning: Script file at "d.dart" not found. (web/test.html 3 0)',
366 ]);
367 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698