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

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

Issue 180933002: combine script extractor and import inliner (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix multiple linked scripts Created 6 years, 9 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
« no previous file with comments | « pkg/polymer/test/build/code_extractor.dart ('k') | pkg/polymer/test/build/common.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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.build.code_extractor_test;
6
7 import 'package:polymer/src/build/code_extractor.dart';
8 import 'package:polymer/src/build/common.dart';
9 import 'package:unittest/compact_vm_config.dart';
10
11 import 'common.dart';
12
13 void main() {
14 useCompactVMConfiguration();
15 var phases = [[new InlineCodeExtractor(new TransformOptions())]];
16
17 testPhases('no changes', phases, {
18 'a|web/test.html': '<!DOCTYPE html><html></html>',
19 }, {
20 'a|web/test.html': '<!DOCTYPE html><html></html>',
21 });
22
23 testPhases('single script, no library in script', phases, {
24 'a|web/test.html':
25 '<!DOCTYPE html><html><head>'
26 '<script type="application/dart">main() { }</script>',
27 }, {
28 'a|web/test.html':
29 '<!DOCTYPE html><html><head>'
30 '<script type="application/dart" src="test.html.0.dart"></script>'
31 '</head><body></body></html>',
32
33 'a|web/test.html.0.dart':
34 'library web_test_html_0;\nmain() { }',
35 });
36
37 testPhases('single script, with library', phases, {
38 'a|web/test.html':
39 '<!DOCTYPE html><html><head>'
40 '<script type="application/dart">library f;\nmain() { }</script>',
41 }, {
42 'a|web/test.html':
43 '<!DOCTYPE html><html><head>'
44 '<script type="application/dart" src="test.html.0.dart"></script>'
45 '</head><body></body></html>',
46
47 'a|web/test.html.0.dart':
48 'library f;\nmain() { }',
49 });
50
51 testPhases('under lib/ directory also transformed', phases, {
52 'a|lib/test.html':
53 '<!DOCTYPE html><html><head>'
54 '<script type="application/dart">library f;\nmain() { }</script>',
55 }, {
56 'a|lib/test.html':
57 '<!DOCTYPE html><html><head>'
58 '<script type="application/dart" src="test.html.0.dart"></script>'
59 '</head><body></body></html>',
60
61 'a|lib/test.html.0.dart':
62 'library f;\nmain() { }',
63 });
64
65 testPhases('multiple scripts', phases, {
66 'a|web/test.html':
67 '<!DOCTYPE html><html><head>'
68 '<script type="application/dart">library a1;\nmain1() { }</script>'
69 '<script type="application/dart">library a2;\nmain2() { }</script>',
70 }, {
71 'a|web/test.html':
72 '<!DOCTYPE html><html><head>'
73 '<script type="application/dart" src="test.html.0.dart"></script>'
74 '<script type="application/dart" src="test.html.1.dart"></script>'
75 '</head><body></body></html>',
76
77 'a|web/test.html.0.dart':
78 'library a1;\nmain1() { }',
79
80 'a|web/test.html.1.dart':
81 'library a2;\nmain2() { }',
82 });
83
84 testPhases('multiple deeper scripts', phases, {
85 'a|web/test.html':
86 '<!DOCTYPE html><html><head>'
87 '<script type="application/dart">main1() { }</script>'
88 '</head><body><div>'
89 '<script type="application/dart">main2() { }</script>'
90 '</div><div><div>'
91 '<script type="application/dart">main3() { }</script>'
92 '</div></div>'
93 }, {
94 'a|web/test.html':
95 '<!DOCTYPE html><html><head>'
96 '<script type="application/dart" src="test.html.0.dart"></script>'
97 '</head><body><div>'
98 '<script type="application/dart" src="test.html.1.dart"></script>'
99 '</div><div><div>'
100 '<script type="application/dart" src="test.html.2.dart"></script>'
101 '</div></div></body></html>',
102
103 'a|web/test.html.0.dart':
104 'library web_test_html_0;\nmain1() { }',
105
106 'a|web/test.html.1.dart':
107 'library web_test_html_1;\nmain2() { }',
108
109 'a|web/test.html.2.dart':
110 'library web_test_html_2;\nmain3() { }',
111 });
112 }
OLDNEW
« no previous file with comments | « pkg/polymer/test/build/code_extractor.dart ('k') | pkg/polymer/test/build/common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698