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 'package:polymer/src/build/common.dart'; | 7 import 'package:polymer/src/build/common.dart'; |
| 8 import 'package:polymer/src/build/linter.dart'; | 8 import 'package:polymer/src/build/linter.dart'; |
| 9 import 'package:source_maps/span.dart'; | 9 import 'package:source_maps/span.dart'; |
| 10 import 'package:unittest/compact_vm_config.dart'; | 10 import 'package:unittest/compact_vm_config.dart'; |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 494 <polymer-element name="x-a" attributes="foo-bar"> | 494 <polymer-element name="x-a" attributes="foo-bar"> |
| 495 </polymer-element> | 495 </polymer-element> |
| 496 '''.replaceAll(' ', ''), | 496 '''.replaceAll(' ', ''), |
| 497 }, { | 497 }, { |
| 498 'a|lib/test.html.messages': | 498 'a|lib/test.html.messages': |
| 499 'warning: PolymerElement no longer recognizes attribute names with ' | 499 'warning: PolymerElement no longer recognizes attribute names with ' |
| 500 'dashes such as "foo-bar". Use "fooBar" or "foobar" instead (both ' | 500 'dashes such as "foo-bar". Use "fooBar" or "foobar" instead (both ' |
| 501 'forms are equivalent in HTML). (lib/test.html 1 28)' | 501 'forms are equivalent in HTML). (lib/test.html 1 28)' |
| 502 }); | 502 }); |
| 503 }); | 503 }); |
| 504 | |
| 505 _testLinter("namespaced attributes don't cause an internal error", { | |
| 506 'a|lib/test.html': '''<html><body> | |
| 507 <svg xmlns="http://www.w3.org/2000/svg" width="520" height="350"> | |
| 508 '''.replaceAll(' ', ''), | |
| 509 }, {}); | |
|
Siggi Cherem (dart-lang)
2013/12/12 20:23:19
This nuance will go away in my cl (will submit sho
Jennifer Messerly
2013/12/12 20:42:02
right. the test was definitely failing before I fi
| |
| 504 } | 510 } |
| 505 | 511 |
| 506 _testLinter(String name, Map inputFiles, Map outputMessages) { | 512 _testLinter(String name, Map inputFiles, Map outputMessages) { |
| 507 var linter = new Linter(new TransformOptions(), _testFormatter); | 513 var linter = new Linter(new TransformOptions(), _testFormatter); |
| 508 var outputFiles = {}; | 514 var outputFiles = {}; |
| 509 inputFiles.forEach((k, v) => outputFiles[k] = v); | 515 inputFiles.forEach((k, v) => outputFiles[k] = v); |
| 510 outputMessages.forEach((k, v) => outputFiles[k] = v); | 516 outputMessages.forEach((k, v) => outputFiles[k] = v); |
| 511 var keys = inputFiles.keys.toSet(); | 517 var keys = inputFiles.keys.toSet(); |
| 512 keys.retainAll(outputMessages.keys); | 518 keys.retainAll(outputMessages.keys); |
| 513 expect(keys, isEmpty); | 519 expect(keys, isEmpty); |
| 514 testPhases(name, [[linter]], inputFiles, outputFiles); | 520 testPhases(name, [[linter]], inputFiles, outputFiles); |
| 515 } | 521 } |
| 516 | 522 |
| 517 | 523 |
| 518 _testFormatter(String kind, String message, Span span) { | 524 _testFormatter(String kind, String message, Span span) { |
| 519 var formattedMessage = '$kind: $message'; | 525 var formattedMessage = '$kind: $message'; |
| 520 if (span != null) { | 526 if (span != null) { |
| 521 formattedMessage = '$formattedMessage ' | 527 formattedMessage = '$formattedMessage ' |
| 522 '(${span.sourceUrl} ${span.start.line} ${span.start.column})'; | 528 '(${span.sourceUrl} ${span.start.line} ${span.start.column})'; |
| 523 } | 529 } |
| 524 return formattedMessage; | 530 return formattedMessage; |
| 525 } | 531 } |
| OLD | NEW |