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

Unified Diff: tests/standalone/io/string_stream_test.dart

Issue 11364115: Don't crash when decoding astral plane UTF-8. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Respond to review. Created 8 years, 1 month 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
« no previous file with comments | « sdk/lib/io/string_stream.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/string_stream_test.dart
diff --git a/tests/standalone/io/string_stream_test.dart b/tests/standalone/io/string_stream_test.dart
index e9bb7af5f48a97938eac7eb40d03fc1dde8dd335..f335291d662b7b078ae172d50e2afa266bcbb7c5 100644
--- a/tests/standalone/io/string_stream_test.dart
+++ b/tests/standalone/io/string_stream_test.dart
@@ -11,20 +11,26 @@ void testUtf8() {
0xc2, 0x80,
0xdf, 0xbf,
0xe0, 0xa0, 0x80,
- 0xef, 0xbf, 0xbf];
+ 0xef, 0xbf, 0xbf,
+ 0xf0, 0x9d, 0x84, 0x9e];
ListInputStream s = new ListInputStream();
s.write(data);
s.markEndOfStream();
StringInputStream stream = new StringInputStream(s);
void stringData() {
String s = stream.read();
- Expect.equals(6, s.length);
+ Expect.equals(8, s.length);
Expect.equals(new String.fromCharCodes([0x01]), s[0]);
Expect.equals(new String.fromCharCodes([0x7f]), s[1]);
Expect.equals(new String.fromCharCodes([0x80]), s[2]);
Expect.equals(new String.fromCharCodes([0x7ff]), s[3]);
Expect.equals(new String.fromCharCodes([0x800]), s[4]);
Expect.equals(new String.fromCharCodes([0xffff]), s[5]);
+ Expect.equals(new String.fromCharCodes([0xffff]), s[5]);
+
+ // Surrogate pair for U+1D11E.
+ Expect.equals(new String.fromCharCodes([0xd834]), s[6]);
+ Expect.equals(new String.fromCharCodes([0xdd1e]), s[7]);
}
stream.onData = stringData;
}
@@ -300,7 +306,7 @@ testErrorHandler() {
}
testEncodingErrorWithHandler() {
- var port = new ReceivePort();
+ var port = new ReceivePort();
var errors = 0;
var expected = [206, 187, 120, 46, 32, 120, 10];
ListInputStream input = new ListInputStream();
« no previous file with comments | « sdk/lib/io/string_stream.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698