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

Side by Side Diff: tests/lib/convert/html_escape_test.dart

Issue 24339002: Escape slash since it helps to end an HTML entity. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 | « sdk/lib/convert/html_escape.dart ('k') | no next file » | 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 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 import 'dart:async'; 6 import 'dart:async';
7 import 'dart:convert'; 7 import 'dart:convert';
8 8
9 const _NOOP = 'Nothing_to_escape'; 9 const _NOOP = 'Nothing_to_escape';
10 10
11 const _TEST_INPUT = '<A <test> of \u00A0 "double" & \'single\' values>'; 11 const _TEST_INPUT = '<A </test> of \u00A0 "double" & \'single\' values>';
12 12
13 const _OUTPUT_UNKNOWN = '&lt;A &lt;test&gt; of &nbsp; &quot;double&quot; &amp; ' 13 const _OUTPUT_UNKNOWN = '&lt;A &lt;&#x2F;test&gt; of &nbsp; &quot;double&quot; & amp; '
14 '&apos;single&apos; values&gt;'; 14 '&#x27;single&#x27; values&gt;';
15 15
16 const _OUTPUT_ATTRIBUTE = "<A <test> of &nbsp; &quot;double&quot; &amp; " 16 const _OUTPUT_ATTRIBUTE = "<A </test> of &nbsp; &quot;double&quot; &amp; "
17 "\'single\' values>"; 17 "\'single\' values>";
18 18
19 const _OUTPUT_ELEMENT = '&lt;A &lt;test&gt; of &nbsp; "double" &amp; ' 19 const _OUTPUT_ELEMENT = '&lt;A &lt;&#x2F;test&gt; of &nbsp; "double" &amp; '
20 '\'single\' values&gt;'; 20 '\'single\' values&gt;';
21 21
22 void _testMode(HtmlEscape escape, String input, String expected) { 22 void _testMode(HtmlEscape escape, String input, String expected) {
23 _testConvert(escape, input, expected); 23 _testConvert(escape, input, expected);
24 _testTransform(escape, input, expected); 24 _testTransform(escape, input, expected);
25 _testChunked(escape, input, expected); 25 _testChunked(escape, input, expected);
26 } 26 }
27 27
28 void _testChunked(HtmlEscape escape, String input, String expected) { 28 void _testChunked(HtmlEscape escape, String input, String expected) {
29 var buffer = new StringBuffer(); 29 var buffer = new StringBuffer();
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 const _COUNT = 3; 76 const _COUNT = 3;
77 77
78 void main() { 78 void main() {
79 _testMode(HTML_ESCAPE, _TEST_INPUT, _OUTPUT_UNKNOWN); 79 _testMode(HTML_ESCAPE, _TEST_INPUT, _OUTPUT_UNKNOWN);
80 _testMode(const HtmlEscape(), _TEST_INPUT, _OUTPUT_UNKNOWN); 80 _testMode(const HtmlEscape(), _TEST_INPUT, _OUTPUT_UNKNOWN);
81 _testMode(const HtmlEscape(HtmlEscapeMode.UNKNOWN), _TEST_INPUT, _OUTPUT_UNKNO WN); 81 _testMode(const HtmlEscape(HtmlEscapeMode.UNKNOWN), _TEST_INPUT, _OUTPUT_UNKNO WN);
82 _testMode(const HtmlEscape(HtmlEscapeMode.ATTRIBUTE), _TEST_INPUT, _OUTPUT_ATT RIBUTE); 82 _testMode(const HtmlEscape(HtmlEscapeMode.ATTRIBUTE), _TEST_INPUT, _OUTPUT_ATT RIBUTE);
83 _testMode(const HtmlEscape(HtmlEscapeMode.ELEMENT), _TEST_INPUT, _OUTPUT_ELEME NT); 83 _testMode(const HtmlEscape(HtmlEscapeMode.ELEMENT), _TEST_INPUT, _OUTPUT_ELEME NT);
84 _testMode(HTML_ESCAPE, _NOOP, _NOOP); 84 _testMode(HTML_ESCAPE, _NOOP, _NOOP);
85 } 85 }
OLDNEW
« no previous file with comments | « sdk/lib/convert/html_escape.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698