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

Unified Diff: runtime/vm/object_test.cc

Issue 2400523003: Fix bad canonicalization for strings whose utf32->utf16 conversion is lossy. (Closed)
Patch Set: . Created 4 years, 2 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
« no previous file with comments | « runtime/vm/object.cc ('k') | tests/language/language.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object_test.cc
diff --git a/runtime/vm/object_test.cc b/runtime/vm/object_test.cc
index 73e2d707c1aa25e111892a218e69362df0da906d..d4594d6004db4a473cc5435eced983c6af9f8bc4 100644
--- a/runtime/vm/object_test.cc
+++ b/runtime/vm/object_test.cc
@@ -4726,4 +4726,19 @@ VM_TEST_CASE(String_ScrubName) {
}
}
+
+VM_TEST_CASE(String_EqualsUTF32) {
+ // Regression test for Issue 27433. Checks that comparisons between Strings
+ // and utf32 arrays happens after conversion to utf16 instead of utf32, as
+ // required for proper canonicalization of string literals with a lossy
+ // utf32->utf16 conversion.
+ int32_t char_codes[] = {
+ 0, 0x0a, 0x0d, 0x7f, 0xff, 0xffff, 0xd800, 0xdc00, 0xdbff, 0xdfff
+ };
+
+ const String& str =
+ String::Handle(String::FromUTF32(char_codes, ARRAY_SIZE(char_codes)));
+ EXPECT(str.Equals(char_codes, ARRAY_SIZE(char_codes)));
+}
+
} // namespace dart
« no previous file with comments | « runtime/vm/object.cc ('k') | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698