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

Side by Side Diff: runtime/observatory/tests/service/string_escaping_test.dart

Issue 2767533002: Revert "Fix observatory tests broken by running dartfmt." (Closed)
Patch Set: Created 3 years, 9 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 // VMOptions=--error_on_bad_type --error_on_bad_override 4 // VMOptions=--error_on_bad_type --error_on_bad_override
5 5
6 library string_escaping_test; 6 library string_escaping_test;
7 7
8 import 'package:observatory/service_io.dart'; 8 import 'package:observatory/service_io.dart';
9 import 'package:unittest/unittest.dart'; 9 import 'package:unittest/unittest.dart';
10 import 'test_helper.dart'; 10 import 'test_helper.dart';
(...skipping 11 matching lines...) Expand all
22 var escapedUnicodeEscape; 22 var escapedUnicodeEscape;
23 var longStringEven; 23 var longStringEven;
24 var longStringOdd; 24 var longStringOdd;
25 var malformedWithLeadSurrogate; 25 var malformedWithLeadSurrogate;
26 var malformedWithTrailSurrogate; 26 var malformedWithTrailSurrogate;
27 27
28 void script() { 28 void script() {
29 ascii = "Hello, World!"; 29 ascii = "Hello, World!";
30 latin1 = "blåbærgrød"; 30 latin1 = "blåbærgrød";
31 unicode = "Îñţérñåţîöñåļîžåţîờñ"; 31 unicode = "Îñţérñåţîöñåļîžåţîờñ";
32 hebrew = "שלום רב שובך צפורה נחמדת"; // Right-to-left text. 32 hebrew = "שלום רב שובך צפורה נחמדת"; // Right-to-left text.
33 singleQuotes = "'One,' he said."; 33 singleQuotes = "'One,' he said.";
34 doubleQuotes = '"Two," he said.'; 34 doubleQuotes = '"Two," he said.';
35 newLines = "Windows\r\nSmalltalk\rUnix\n"; 35 newLines = "Windows\r\nSmalltalk\rUnix\n";
36 tabs = "One\tTwo\tThree"; 36 tabs = "One\tTwo\tThree";
37 suggrogatePairs = "1𝄞2𝄞𝄞3𝄞𝄞𝄞"; 37 suggrogatePairs = "1𝄞2𝄞𝄞3𝄞𝄞𝄞";
38 nullInTheMiddle = "There are four\u0000 words."; 38 nullInTheMiddle = "There are four\u0000 words.";
39 escapedUnicodeEscape = "Should not be A: \\u0041"; 39 escapedUnicodeEscape = "Should not be A: \\u0041";
40 40
41 // A surrogate pair will cross the preferred truncation boundry. 41 // A surrogate pair will cross the preferred truncation boundry.
42 longStringEven = ".."; 42 longStringEven = "..";
(...skipping 20 matching lines...) Expand all
63 } 63 }
64 64
65 expectTruncatedString(String varName, String varValueAsString) { 65 expectTruncatedString(String varName, String varValueAsString) {
66 Field field = lib.variables.singleWhere((v) => v.name == varName); 66 Field field = lib.variables.singleWhere((v) => v.name == varName);
67 Instance value = field.staticValue; 67 Instance value = field.staticValue;
68 print(value.valueAsString); 68 print(value.valueAsString);
69 expect(varValueAsString, startsWith(value.valueAsString)); 69 expect(varValueAsString, startsWith(value.valueAsString));
70 expect(value.valueAsStringIsTruncated, isTrue); 70 expect(value.valueAsStringIsTruncated, isTrue);
71 } 71 }
72 72
73 script(); // Need to initialize variables in the testing isolate. 73 script(); // Need to initialize variables in the testing isolate.
74 expectFullString('ascii', ascii); 74 expectFullString('ascii', ascii);
75 expectFullString('latin1', latin1); 75 expectFullString('latin1', latin1);
76 expectFullString('unicode', unicode); 76 expectFullString('unicode', unicode);
77 expectFullString('hebrew', hebrew); 77 expectFullString('hebrew', hebrew);
78 expectFullString('singleQuotes', singleQuotes); 78 expectFullString('singleQuotes', singleQuotes);
79 expectFullString('doubleQuotes', doubleQuotes); 79 expectFullString('doubleQuotes', doubleQuotes);
80 expectFullString('newLines', newLines); 80 expectFullString('newLines', newLines);
81 expectFullString('tabs', tabs); 81 expectFullString('tabs', tabs);
82 expectFullString('suggrogatePairs', suggrogatePairs); 82 expectFullString('suggrogatePairs', suggrogatePairs);
83 expectFullString('nullInTheMiddle', nullInTheMiddle); 83 expectFullString('nullInTheMiddle', nullInTheMiddle);
84 expectTruncatedString('longStringEven', longStringEven); 84 expectTruncatedString('longStringEven', longStringEven);
85 expectTruncatedString('longStringOdd', longStringOdd); 85 expectTruncatedString('longStringOdd', longStringOdd);
86 expectFullString('malformedWithLeadSurrogate', malformedWithLeadSurrogate); 86 expectFullString('malformedWithLeadSurrogate', malformedWithLeadSurrogate);
87 expectFullString('malformedWithTrailSurrogate', malformedWithTrailSurrogate); 87 expectFullString('malformedWithTrailSurrogate', malformedWithTrailSurrogate);
88 } 88 }
89 89
90 var tests = [ 90 var tests = [
91 testStrings, 91 testStrings,
92 ]; 92 ];
93 93
94 main(args) => runIsolateTests(args, tests, testeeBefore: script); 94 main(args) => runIsolateTests(args, tests, testeeBefore: script);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698