Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 'dart:convert'; | 7 import 'dart:convert'; |
| 8 | 8 |
| 9 import 'package:polymer/src/build/common.dart'; | 9 import 'package:polymer/src/build/common.dart'; |
| 10 import 'package:polymer/src/build/linter.dart'; | 10 import 'package:polymer/src/build/linter.dart'; |
| (...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 657 'a|web/test.html': '<!DOCTYPE html><html>\n' | 657 'a|web/test.html': '<!DOCTYPE html><html>\n' |
| 658 '<polymer-element name="x-a"></polymer-element>' | 658 '<polymer-element name="x-a"></polymer-element>' |
| 659 '<script type="application/dart" src="foo.dart">' | 659 '<script type="application/dart" src="foo.dart">' |
| 660 '</script>' | 660 '</script>' |
| 661 '<script src="packages/browser/dart.js"></script>' | 661 '<script src="packages/browser/dart.js"></script>' |
| 662 '</html>', | 662 '</html>', |
| 663 }, { | 663 }, { |
| 664 'a|web/test.html._buildLogs.1': | 664 'a|web/test.html._buildLogs.1': |
| 665 '[{' | 665 '[{' |
| 666 '"level":"Warning",' | 666 '"level":"Warning",' |
| 667 '"message":${JSON.encode(usePolymerHtmlMessage(0))},' | 667 '"message":${JSON.encode(new HtmlEscape().convert( |
|
kevmoo
2014/08/19 20:53:02
use the const ctor for HtmlEscape so we're not con
jakemac
2014/08/20 14:48:19
Done.
| |
| 668 usePolymerHtmlMessage(0)))},' | |
| 668 '"span":{' | 669 '"span":{' |
| 669 '"location":"web/test.html:2:1",' | 670 '"location":"web/test.html:2:1",' |
| 670 '"text":' | 671 '"text":' |
| 671 '"${new HtmlEscape().convert('<polymer-element name="x-a">')}"' | 672 '"${new HtmlEscape().convert('<polymer-element name="x-a">')}"' |
| 672 '}' | 673 '}' |
| 673 '}]', | 674 '}]', |
| 674 }, [ | 675 }, [ |
| 675 // Logs should still make it to barback too. | 676 // Logs should still make it to barback too. |
| 676 'warning: ${usePolymerHtmlMessage(0)} (web/test.html 1 0)', | 677 'warning: ${usePolymerHtmlMessage(0)} (web/test.html 1 0)', |
| 677 ]); | 678 ]); |
| 678 }); | 679 }); |
| 679 } | 680 } |
| 680 | 681 |
| 681 _testLinter(String name, Map inputFiles, List outputMessages, | 682 _testLinter(String name, Map inputFiles, List outputMessages, |
| 682 [bool solo = false]) { | 683 [bool solo = false]) { |
| 683 var outputFiles = {}; | 684 var outputFiles = {}; |
| 684 if (outputMessages.every((m) => m.startsWith('warning:'))) { | 685 if (outputMessages.every((m) => m.startsWith('warning:'))) { |
| 685 inputFiles.forEach((k, v) => outputFiles[k] = v); | 686 inputFiles.forEach((k, v) => outputFiles[k] = v); |
| 686 } | 687 } |
| 687 if (outputMessages.isEmpty) { | 688 if (outputMessages.isEmpty) { |
| 688 var linter = new Linter(new TransformOptions()); | 689 var linter = new Linter(new TransformOptions()); |
| 689 testPhases(name, [[linter]], inputFiles, outputFiles, outputMessages, solo); | 690 testPhases(name, [[linter]], inputFiles, outputFiles, outputMessages, solo); |
| 690 } else { | 691 } else { |
| 691 testLogOutput( | 692 testLogOutput( |
| 692 (options) => new Linter(options), name, inputFiles, outputFiles, | 693 (options) => new Linter(options), name, inputFiles, outputFiles, |
| 693 outputMessages, solo); | 694 outputMessages, solo); |
| 694 } | 695 } |
| 695 } | 696 } |
| OLD | NEW |