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

Unified Diff: pkg/polymer/test/build/import_inliner_test.dart

Issue 394523002: Sanitize library names generated from file paths (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 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/import_inliner_test.dart
diff --git a/pkg/polymer/test/build/import_inliner_test.dart b/pkg/polymer/test/build/import_inliner_test.dart
index 281a3132a7d71bf1c9d7be4b61063f3c2c8fed5c..4fee9458d5bf9165c42709016730d1f030dfd7e1 100644
--- a/pkg/polymer/test/build/import_inliner_test.dart
+++ b/pkg/polymer/test/build/import_inliner_test.dart
@@ -159,6 +159,41 @@ void importTests() {
'a|web/second.js': '/*second*/'
});
+ testPhases('Cleans library names generated from file paths.', phases,
+ {
+ 'a|web/01_test.html':
+ '<!DOCTYPE html><html><head>'
+ '<script type="application/dart">/*1*/</script>'
+ '</head></html>',
+ 'a|web/foo_02_test.html':
+ '<!DOCTYPE html><html><head>'
+ '<script type="application/dart">/*2*/</script>'
+ '</head></html>',
+ 'a|web/test_03.html':
+ '<!DOCTYPE html><html><head>'
+ '<script type="application/dart">/*3*/</script>'
+ '</head></html>',
+ 'a|web/*test_%foo_04!.html':
+ '<!DOCTYPE html><html><head>'
+ '<script type="application/dart">/*4*/</script>'
+ '</head></html>',
+ 'a|web/%05_test.html':
+ '<!DOCTYPE html><html><head>'
+ '<script type="application/dart">/*5*/</script>'
+ '</head></html>',
+ }, {
+ 'a|web/01_test.html.0.dart':
+ 'library a.web._01_test_html_0;\n/*1*/', // Appends an _ if it starts with a number.
Siggi Cherem (dart-lang) 2014/07/14 19:34:11 nit: long lines. We can simply move the comments t
+ 'a|web/foo_02_test.html.0.dart':
+ 'library a.web.foo_02_test_html_0;\n/*2*/', // Allows numbers in the middle.
+ 'a|web/test_03.html.0.dart':
+ 'library a.web.test_03_html_0;\n/*3*/', // Allows numbers at the end.
+ 'a|web/*test_%foo_04!.html.0.dart':
+ 'library a.web.test_foo_04_html_0;\n/*4*/', // Strips invalid characters.
+ 'a|web/%05_test.html.0.dart':
+ 'library a.web._05_test_html_0;\n/*5*/', // Strips invalid characters and appends an _.
+ });
+
testPhases('no transformation outside web/', phases,
{
'a|lib/test.html':
@@ -741,7 +776,7 @@ void stylesheetTests() {
'a|web/test2.css':
'h1 { font-size: 70px; }',
});
-
+
testPhases('inlined tags keep original attributes', phases, {
'a|web/test.html':
'<!DOCTYPE html><html><head>'
@@ -787,7 +822,7 @@ void urlAttributeTests() {
'<script src="baz.jpg"></script>',
'a|web/foo/test_2.html':
'<foo-element src="baz.jpg"></foo-element>',
- });
+ });
}
void entryPointTests() {
@@ -807,7 +842,7 @@ void entryPointTests() {
'<script rel="import" href="../packages/b/bar/bar.js"></script>'
'</body></html>',
});
-
+
testPhases('two level deep entry points normalize correctly', phases, {
'a|web/test/well/test.html':
'<!DOCTYPE html><html><head>'
@@ -822,5 +857,5 @@ void entryPointTests() {
'<!DOCTYPE html><html><head></head><body>'
'<script rel="import" href="../../packages/b/bar/bar.js"></script>'
'</body></html>',
- });
+ });
}

Powered by Google App Engine
This is Rietveld 408576698