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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: pkg/polymer/test/build/code_extractor.dart
diff --git a/pkg/polymer/test/build/code_extractor.dart b/pkg/polymer/test/build/code_extractor.dart
index beeafcbbd4c365f458870d6186b989c14e75a62d..813d13d80a3858ac0b96b17b7b23d21e4ab1fd10 100644
--- a/pkg/polymer/test/build/code_extractor.dart
+++ b/pkg/polymer/test/build/code_extractor.dart
@@ -164,6 +164,7 @@ void codeExtractorTests() {
});
group('fixes import/export/part URIs', dartUriTests);
+ group('validates script-tag URIs', validateUriTests);
}
dartUriTests() {
@@ -312,3 +313,55 @@ dartUriTests() {
'</body></html>',
});
}
+
+validateUriTests() {
+
+ testPhases('script is inline', phases, {
+ 'a|web/test.html':
+ '<!DOCTYPE html><html><body>'
+ '<script type="application/dart;component=1">'
+ 'main(){}'
+ '</script>'
+ '</body></html>',
+ }, {
+ 'a|web/test.html.scriptUrls': '[["a","web/test.html.0.dart"]]',
+ }, []);
+
+ testPhases('script src is valid', phases, {
+ 'a|web/test.html':
+ '<!DOCTYPE html><html><body>'
+ '<script type="application/dart;component=1" src="a.dart"></script>'
+ '</body></html>',
+ 'a|web/a.dart': 'main() {}',
+ }, {
+ 'a|web/test.html.scriptUrls': '[["a","web/a.dart"]]',
+ }, []);
+
+ testPhases('script src is invalid', phases, {
+ 'a|web/test.html':
+ '<!DOCTYPE html><html><body>\n'
+ '<script type="application/dart;component=1" src="a.dart"></script>'
+ '</body></html>',
+ }, {
+ 'a|web/test.html.scriptUrls': '[]',
+ }, [
+ 'warning: Script file at "a.dart" not found. (web/test.html 1 0)',
+ ]);
+
+ testPhases('many script src around, valid and invalid', phases, {
+ 'a|web/test.html':
+ '<!DOCTYPE html><html><body>'
+ '<script type="application/dart;component=1" src="a.dart"></script>'
+ '\n<script type="application/dart;component=1" src="b.dart"></script>'
+ '\n<script type="application/dart;component=1" src="c.dart"></script>'
+ '\n<script type="application/dart;component=1" src="d.dart"></script>'
+ '</body></html>',
+ 'a|web/a.dart': 'main() {}',
+ 'a|web/c.dart': 'main() {}',
+ }, {
+ 'a|web/test.html.scriptUrls': '[["a","web/a.dart"],["a","web/c.dart"]]',
+ }, [
+ 'warning: Script file at "b.dart" not found. (web/test.html 1 0)',
+ 'warning: Script file at "d.dart" not found. (web/test.html 3 0)',
+ ]);
+}

Powered by Google App Engine
This is Rietveld 408576698