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

Unified Diff: test/dart_codegen/expect/convert/html_escape.dart

Issue 963593002: Disable formatting and add new-lines to make tests faster. (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: test/dart_codegen/expect/convert/html_escape.dart
diff --git a/test/dart_codegen/expect/convert/html_escape.dart b/test/dart_codegen/expect/convert/html_escape.dart
index 5c065b8040fc39afe1f8d62d1a9e07ea7d9ec735..6ae348bcd000938aa1fcc6dbc7912aea5ced802f 100644
--- a/test/dart_codegen/expect/convert/html_escape.dart
+++ b/test/dart_codegen/expect/convert/html_escape.dart
@@ -1,87 +1,73 @@
part of dart.convert;
-
-const HtmlEscape HTML_ESCAPE = const HtmlEscape();
-class HtmlEscapeMode {
- final String _name;
- final bool escapeLtGt;
- final bool escapeQuot;
- final bool escapeApos;
- final bool escapeSlash;
- static const HtmlEscapeMode UNKNOWN =
- const HtmlEscapeMode._('unknown', true, true, true, true);
- static const HtmlEscapeMode ATTRIBUTE =
- const HtmlEscapeMode._('attribute', false, true, false, false);
- static const HtmlEscapeMode ELEMENT =
- const HtmlEscapeMode._('element', true, false, false, true);
- const HtmlEscapeMode._(this._name, this.escapeLtGt, this.escapeQuot,
- this.escapeApos, this.escapeSlash);
- String toString() => _name;
+ const HtmlEscape HTML_ESCAPE = const HtmlEscape();
+ class HtmlEscapeMode {final String _name;
+ final bool escapeLtGt;
+ final bool escapeQuot;
+ final bool escapeApos;
+ final bool escapeSlash;
+ static const HtmlEscapeMode UNKNOWN = const HtmlEscapeMode._('unknown', true, true, true, true);
+ static const HtmlEscapeMode ATTRIBUTE = const HtmlEscapeMode._('attribute', false, true, false, false);
+ static const HtmlEscapeMode ELEMENT = const HtmlEscapeMode._('element', true, false, false, true);
+ const HtmlEscapeMode._(this._name, this.escapeLtGt, this.escapeQuot, this.escapeApos, this.escapeSlash);
+ String toString() => _name;
}
-class HtmlEscape extends Converter<String, String> {
- final HtmlEscapeMode mode;
- const HtmlEscape([this.mode = HtmlEscapeMode.UNKNOWN]);
- String convert(String text) {
- var val = _convert(text, 0, text.length);
- return val == null ? text : val;
+ class HtmlEscape extends Converter<String, String> {final HtmlEscapeMode mode;
+ const HtmlEscape([this.mode = HtmlEscapeMode.UNKNOWN]);
+ String convert(String text) {
+var val = _convert(text, 0, text.length);
+ return val == null ? text : val;
+}
+ String _convert(String text, int start, int end) {
+StringBuffer result = null;
+ for (int i = start;
+ i < end;
+ i++) {
+ var ch = text[i];
+ String replace = null;
+ switch (ch) {case '&': replace = '&amp;';
+ break;
+ case '\u00A0': replace = '&nbsp;';
+ break;
+ case '"': if (mode.escapeQuot) replace = '&quot;';
+ break;
+ case "'": if (mode.escapeApos) replace = '&#x27;';
+ break;
+ case '<': if (mode.escapeLtGt) replace = '&lt;';
+ break;
+ case '>': if (mode.escapeLtGt) replace = '&gt;';
+ break;
+ case '/': if (mode.escapeSlash) replace = '&#x2F;';
+ break;
}
- String _convert(String text, int start, int end) {
- StringBuffer result = null;
- for (int i = start; i < end; i++) {
- var ch = text[i];
- String replace = null;
- switch (ch) {
- case '&':
- replace = '&amp;';
- break;
- case '\u00A0':
- replace = '&nbsp;';
- break;
- case '"':
- if (mode.escapeQuot) replace = '&quot;';
- break;
- case "'":
- if (mode.escapeApos) replace = '&#x27;';
- break;
- case '<':
- if (mode.escapeLtGt) replace = '&lt;';
- break;
- case '>':
- if (mode.escapeLtGt) replace = '&gt;';
- break;
- case '/':
- if (mode.escapeSlash) replace = '&#x2F;';
- break;
- }
- if (replace != null) {
- if (result == null) result = new StringBuffer(text.substring(start, i));
- result.write(replace);
- } else if (result != null) {
- result.write(ch);
- }
- }
- return ((__x6) => DDC$RT.cast(__x6, dynamic, String, "CastGeneral",
- """line 72, column 12 of dart:convert/html_escape.dart: """,
- __x6 is String, true))(result != null ? result.toString() : null);
+ if (replace != null) {
+ if (result == null) result = new StringBuffer(text.substring(start, i));
+ result.write(replace);
}
- StringConversionSink startChunkedConversion(Sink<String> sink) {
- if (sink is! StringConversionSink) {
- sink = new StringConversionSink.from(sink);
- }
- return new _HtmlEscapeSink(this, sink);
+ else if (result != null) {
+ result.write(ch);
}
}
-class _HtmlEscapeSink extends StringConversionSinkBase {
- final HtmlEscape _escape;
- final StringConversionSink _sink;
- _HtmlEscapeSink(this._escape, this._sink);
- void addSlice(String chunk, int start, int end, bool isLast) {
- var val = _escape._convert(chunk, start, end);
- if (val == null) {
- _sink.addSlice(chunk, start, end, isLast);
- } else {
- _sink.add(val);
- if (isLast) _sink.close();
- }
- }
- void close() => _sink.close();
+ return ((__x6) => DDC$RT.cast(__x6, dynamic, String, "CastGeneral", """line 72, column 12 of dart:convert/html_escape.dart: """, __x6 is String, true))(result != null ? result.toString() : null);
+}
+ StringConversionSink startChunkedConversion(Sink<String> sink) {
+if (sink is! StringConversionSink) {
+sink = new StringConversionSink.from(sink);
+}
+ return new _HtmlEscapeSink(this, sink);
+}
+}
+ class _HtmlEscapeSink extends StringConversionSinkBase {final HtmlEscape _escape;
+ final StringConversionSink _sink;
+ _HtmlEscapeSink(this._escape, this._sink);
+ void addSlice(String chunk, int start, int end, bool isLast) {
+var val = _escape._convert(chunk, start, end);
+ if (val == null) {
+_sink.addSlice(chunk, start, end, isLast);
+}
+ else {
+_sink.add(val);
+ if (isLast) _sink.close();
+}
+}
+ void close() => _sink.close();
}

Powered by Google App Engine
This is Rietveld 408576698