OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 library polymer.test.transform.script_compactor_test; | |
6 | |
7 import 'package:polymer/src/transform/script_compactor.dart'; | |
8 import 'package:unittest/compact_vm_config.dart'; | |
9 | |
10 import 'common.dart'; | |
11 | |
12 void main() { | |
13 useCompactVMConfiguration(); | |
14 | |
15 testPhases('no changes', [[new ScriptCompactor()]], { | |
16 'a|test.html': '<!DOCTYPE html><html></html>', | |
17 }, { | |
18 'a|test.html': '<!DOCTYPE html><html></html>', | |
19 }); | |
20 | |
21 testPhases('single script', [[new ScriptCompactor()]], { | |
22 'a|test.html': | |
23 '<!DOCTYPE html><html><head>' | |
24 '<script type="application/dart" src="a.dart"></script>', | |
25 }, { | |
26 'a|test.html': | |
27 '<!DOCTYPE html><html><head></head><body>' | |
28 '<script type="application/dart" ' | |
29 'src="test.html_bootstrap.dart"></script>' | |
30 '</body></html>', | |
31 | |
32 'a|test.html_bootstrap.dart': | |
33 'library app_bootstrap;\n\n' | |
Jennifer Messerly
2013/08/19 22:57:26
this would be a good use case for triple quote :)
Siggi Cherem (dart-lang)
2013/08/21 20:35:42
Done.
| |
34 "import 'package:polymer/polymer.dart';\n" | |
35 "import 'dart:mirrors' show currentMirrorSystem;\n\n" | |
36 "import 'a.dart' as i0;\n\n" | |
37 'void main() {\n' | |
38 ' initPolymer([\n' | |
39 " 'a.dart',\n" | |
40 ' ],\n' | |
41 ' currentMirrorSystem().findLibrary(const Symbol(' | |
42 "'app_bootstrap'))\n" | |
43 ' .first.uri.toString());\n' | |
44 '}\n', | |
45 }); | |
46 | |
47 testPhases('several scripts', [[new ScriptCompactor()]], { | |
48 'a|test.html': | |
49 '<!DOCTYPE html><html><head>' | |
50 '<script type="application/dart" src="a.dart"></script>' | |
51 '<script type="application/dart" src="b.dart"></script>' | |
52 '</head><body><div>' | |
53 '<script type="application/dart" src="c.dart"></script>' | |
54 '</div>' | |
55 '<script type="application/dart" src="d.dart"></script>', | |
56 }, { | |
57 'a|test.html': | |
58 '<!DOCTYPE html><html><head></head><body><div></div>' | |
59 '<script type="application/dart" ' | |
60 'src="test.html_bootstrap.dart"></script>' | |
61 '</body></html>', | |
62 | |
63 'a|test.html_bootstrap.dart': | |
64 'library app_bootstrap;\n\n' | |
65 "import 'package:polymer/polymer.dart';\n" | |
66 "import 'dart:mirrors' show currentMirrorSystem;\n\n" | |
67 "import 'a.dart' as i0;\n" | |
68 "import 'b.dart' as i1;\n" | |
69 "import 'c.dart' as i2;\n" | |
70 "import 'd.dart' as i3;\n\n" | |
71 'void main() {\n' | |
72 ' initPolymer([\n' | |
73 " 'a.dart',\n" | |
74 " 'b.dart',\n" | |
75 " 'c.dart',\n" | |
76 " 'd.dart',\n" | |
77 ' ],\n' | |
78 ' currentMirrorSystem().findLibrary(const Symbol(' | |
79 "'app_bootstrap'))\n" | |
80 ' .first.uri.toString());\n' | |
81 '}\n', | |
82 }); | |
83 } | |
OLD | NEW |