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

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

Issue 2771453003: Format all tests. (Closed)
Patch Set: Format files Created 3 years, 8 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
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 \xA0 "double" & 'single' values>"""; 11 const _TEST_INPUT = """<A </test> of \xA0 "double" & 'single' values>""";
12 12
13 const _OUTPUT_UNKNOWN = '&lt;A &lt;&#47;test&gt; of \xA0 &quot;double&quot; ' 13 const _OUTPUT_UNKNOWN = '&lt;A &lt;&#47;test&gt; of \xA0 &quot;double&quot; '
14 '&amp; &#39;single&#39; values&gt;'; 14 '&amp; &#39;single&#39; values&gt;';
15 15
16 const _OUTPUT_ATTRIBUTE = 16 const _OUTPUT_ATTRIBUTE =
17 "&lt;A &lt;/test&gt; of \xA0 &quot;double&quot; &amp; 'single' values&gt;"; 17 "&lt;A &lt;/test&gt; of \xA0 &quot;double&quot; &amp; 'single' values&gt;";
18 18
19 const _OUTPUT_SQ_ATTRIBUTE = 19 const _OUTPUT_SQ_ATTRIBUTE =
20 '&lt;A &lt;/test&gt; of \xA0 "double" &amp; &#39;single&#39; values&gt;'; 20 '&lt;A &lt;/test&gt; of \xA0 "double" &amp; &#39;single&#39; values&gt;';
21 21
22 const _OUTPUT_ELEMENT = 22 const _OUTPUT_ELEMENT =
23 """&lt;A &lt;/test&gt; of \xA0 "double" &amp; 'single' values&gt;"""; 23 """&lt;A &lt;/test&gt; of \xA0 "double" &amp; 'single' values&gt;""";
24 24
(...skipping 30 matching lines...) Expand all
55 55
56 void stringData(value) { 56 void stringData(value) {
57 Expect.equals(expected, value); 57 Expect.equals(expected, value);
58 count++; 58 count++;
59 } 59 }
60 60
61 void streamClosed() { 61 void streamClosed() {
62 done = true; 62 done = true;
63 } 63 }
64 64
65 stream.listen( 65 stream.listen(stringData, onDone: streamClosed);
66 stringData,
67 onDone: streamClosed);
68 66
69 67 for (var i = 0; i < _COUNT; i++) {
70 for(var i = 0; i < _COUNT; i++) {
71 controller.add(input); 68 controller.add(input);
72 } 69 }
73 controller.close(); 70 controller.close();
74 Expect.isTrue(done); 71 Expect.isTrue(done);
75 Expect.equals(_COUNT, count); 72 Expect.equals(_COUNT, count);
76 } 73 }
77 74
78 const _COUNT = 3; 75 const _COUNT = 3;
79 76
80 void main() { 77 void main() {
81 _testMode(HTML_ESCAPE, _TEST_INPUT, _OUTPUT_UNKNOWN); 78 _testMode(HTML_ESCAPE, _TEST_INPUT, _OUTPUT_UNKNOWN);
82 _testMode(const HtmlEscape(), _TEST_INPUT, _OUTPUT_UNKNOWN); 79 _testMode(const HtmlEscape(), _TEST_INPUT, _OUTPUT_UNKNOWN);
83 _testMode(const HtmlEscape(HtmlEscapeMode.UNKNOWN), _TEST_INPUT, _OUTPUT_UNKNO WN); 80 _testMode(
84 _testMode(const HtmlEscape(HtmlEscapeMode.ATTRIBUTE), _TEST_INPUT, _OUTPUT_ATT RIBUTE); 81 const HtmlEscape(HtmlEscapeMode.UNKNOWN), _TEST_INPUT, _OUTPUT_UNKNOWN);
85 _testMode(const HtmlEscape(HtmlEscapeMode.SQ_ATTRIBUTE), _TEST_INPUT, _OUTPUT_ SQ_ATTRIBUTE); 82 _testMode(const HtmlEscape(HtmlEscapeMode.ATTRIBUTE), _TEST_INPUT,
86 _testMode(const HtmlEscape(HtmlEscapeMode.ELEMENT), _TEST_INPUT, _OUTPUT_ELEME NT); 83 _OUTPUT_ATTRIBUTE);
84 _testMode(const HtmlEscape(HtmlEscapeMode.SQ_ATTRIBUTE), _TEST_INPUT,
85 _OUTPUT_SQ_ATTRIBUTE);
86 _testMode(
87 const HtmlEscape(HtmlEscapeMode.ELEMENT), _TEST_INPUT, _OUTPUT_ELEMENT);
87 _testMode(HTML_ESCAPE, _NOOP, _NOOP); 88 _testMode(HTML_ESCAPE, _NOOP, _NOOP);
88 } 89 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698