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

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

Issue 23898009: Switch polymer's build.dart to use the new linter. This CL does the following (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: addressing john comments (part 2) - renamed files Created 7 years, 3 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/lib/src/utils_observe.dart ('k') | pkg/polymer/test/build/css_test.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) 2012, 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 /** End-to-end tests for the [Compiler] API. */
6 library compiler_test;
7
8 import 'package:logging/logging.dart' show Level;
9 import 'package:path/path.dart' as path;
10 import 'package:polymer/src/messages.dart';
11 import 'package:unittest/compact_vm_config.dart';
12 import 'package:unittest/unittest.dart';
13
14 import 'testing.dart';
15
16 main() {
17 useCompactVMConfiguration();
18
19 test('recursive dependencies', () {
20 var messages = new Messages.silent();
21 var compiler = createCompiler({
22 'index.html': '<head>'
23 '<link rel="import" href="foo.html">'
24 '<link rel="import" href="bar.html">'
25 '<body><x-foo></x-foo><x-bar></x-bar>'
26 '<script type="application/dart">main() {}</script>',
27 'foo.html': '<head><link rel="import" href="bar.html">'
28 '<body><polymer-element name="x-foo" constructor="Foo">'
29 '<template><x-bar>',
30 'bar.html': '<head><link rel="import" href="foo.html">'
31 '<body><polymer-element name="x-bar" constructor="Boo">'
32 '<template><x-foo>',
33 }, messages);
34
35 compiler.run().then(expectAsync1((e) {
36 MockFileSystem fs = compiler.fileSystem;
37 expect(fs.readCount, equals({
38 'index.html': 1,
39 'foo.html': 1,
40 'bar.html': 1
41 }), reason: 'Actual:\n ${fs.readCount}');
42 }));
43 });
44
45 group('missing files', () {
46 test('main script', () {
47 var messages = new Messages.silent();
48 var compiler = createCompiler({
49 'index.html': '<head></head><body>'
50 '<script type="application/dart" src="notfound.dart"></script>'
51 '</body>',
52 }, messages);
53
54 compiler.run().then(expectAsync1((e) {
55 var msgs = messages.messages.where((m) =>
56 m.message.contains('unable')).toList();
57 expect(msgs.length, 0);
58 MockFileSystem fs = compiler.fileSystem;
59 expect(fs.readCount, { 'index.html': 1 });
60 }));
61 });
62
63 test('component html', () {
64 var messages = new Messages.silent();
65 var compiler = createCompiler({
66 'index.html': '<head>'
67 '<link rel="import" href="notfound.html">'
68 '<body><x-foo>'
69 '<script type="application/dart">main() {}</script>',
70 }, messages);
71
72 compiler.run().then(expectAsync1((e) {
73 var msgs = messages.messages.where((m) =>
74 m.message.contains('unable')).toList();
75
76 expect(msgs.length, 1);
77 expect(msgs[0].level, Level.SEVERE);
78 expect(msgs[0].message, contains('unable to open file'));
79 expect(msgs[0].span, isNotNull);
80 expect(msgs[0].span.sourceUrl, 'index.html');
81
82 MockFileSystem fs = compiler.fileSystem;
83 expect(fs.readCount, { 'index.html': 1, 'notfound.html': 1 });
84 }));
85 });
86
87 test('component script', () {
88 var messages = new Messages.silent();
89 var compiler = createCompiler({
90 'index.html': '<head>'
91 '<link rel="import" href="foo.html">'
92 '<body><x-foo></x-foo>'
93 '<script type="application/dart">main() {}</script>'
94 '</body>',
95 'foo.html': '<body><polymer-element name="x-foo" constructor="Foo">'
96 '<template></template>'
97 '<script type="application/dart" src="notfound.dart"></script>',
98 }, messages);
99
100 compiler.run().then(expectAsync1((e) {
101 var msgs = messages.messages.where((m) =>
102 m.message.contains('unable')).toList();
103 expect(msgs.length, 0);
104 MockFileSystem fs = compiler.fileSystem;
105 expect(fs.readCount,
106 { 'index.html': 1, 'foo.html': 1 });
107 }));
108 });
109 });
110 }
OLDNEW
« no previous file with comments | « pkg/polymer/lib/src/utils_observe.dart ('k') | pkg/polymer/test/build/css_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698