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

Side by Side Diff: pkg/polymer/test/build/linter_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/test/build/css_test.dart ('k') | pkg/polymer/test/build/testing.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library polymer.test.linter_test; 5 library polymer.test.linter_test;
6 6
7 import 'package:polymer/src/linter.dart';
8 import 'package:polymer/src/transform/common.dart';
7 import 'package:source_maps/span.dart'; 9 import 'package:source_maps/span.dart';
8 import 'package:polymer/src/linter.dart';
9 import 'package:unittest/compact_vm_config.dart'; 10 import 'package:unittest/compact_vm_config.dart';
10 import 'package:unittest/unittest.dart'; 11 import 'package:unittest/unittest.dart';
11 12
12 import '../transform/common.dart'; 13 import '../transform/common.dart';
13 14
14 void main() { 15 void main() {
15 useCompactVMConfiguration(); 16 useCompactVMConfiguration();
16 _testLinter('nothing to report', { 17 _testLinter('nothing to report', {
17 'a|web/test.html': '<!DOCTYPE html><html></html>', 18 'a|web/test.html': '<!DOCTYPE html><html></html>',
18 }, { 19 }, {
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 '''.replaceAll(' ', ''), 394 '''.replaceAll(' ', ''),
394 }, { 395 }, {
395 'a|lib/test.html.messages': '' 396 'a|lib/test.html.messages': ''
396 'warning: custom element "x-a" extends from "li". Did you mean ' 397 'warning: custom element "x-a" extends from "li". Did you mean '
397 'to write <li is="x-a">? (lib/test.html 1 0)' 398 'to write <li is="x-a">? (lib/test.html 1 0)'
398 }); 399 });
399 }); 400 });
400 } 401 }
401 402
402 _testLinter(String name, Map inputFiles, Map outputMessages) { 403 _testLinter(String name, Map inputFiles, Map outputMessages) {
403 var linter = new Linter(_testFormatter); 404 var linter = new Linter(new TransformOptions(), _testFormatter);
404 var outputFiles = {}; 405 var outputFiles = {};
405 inputFiles.forEach((k, v) => outputFiles[k] = v); 406 inputFiles.forEach((k, v) => outputFiles[k] = v);
406 outputMessages.forEach((k, v) => outputFiles[k] = v); 407 outputMessages.forEach((k, v) => outputFiles[k] = v);
407 var keys = inputFiles.keys.toSet(); 408 var keys = inputFiles.keys.toSet();
408 keys.retainAll(outputMessages.keys); 409 keys.retainAll(outputMessages.keys);
409 expect(keys, isEmpty); 410 expect(keys, isEmpty);
410 testPhases(name, [[linter]], inputFiles, outputFiles); 411 testPhases(name, [[linter]], inputFiles, outputFiles);
411 } 412 }
412 413
413 414
414 _testFormatter(String kind, String message, Span span) { 415 _testFormatter(String kind, String message, Span span) {
415 var formattedMessage = '$kind: $message'; 416 var formattedMessage = '$kind: $message';
416 if (span != null) { 417 if (span != null) {
417 formattedMessage = '$formattedMessage ' 418 formattedMessage = '$formattedMessage '
418 '(${span.sourceUrl} ${span.start.line} ${span.start.column})'; 419 '(${span.sourceUrl} ${span.start.line} ${span.start.column})';
419 } 420 }
420 return formattedMessage; 421 return formattedMessage;
421 } 422 }
OLDNEW
« no previous file with comments | « pkg/polymer/test/build/css_test.dart ('k') | pkg/polymer/test/build/testing.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698