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

Unified Diff: runtime/vm/object_test.cc

Issue 11447009: - Do not read past the end of the utf32_array. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years 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') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object_test.cc
===================================================================
--- runtime/vm/object_test.cc (revision 15726)
+++ runtime/vm/object_test.cc (working copy)
@@ -1448,6 +1448,23 @@
}
+TEST_CASE(StringEqualsUTF32) {
+ const String& empty = String::Handle(String::New(""));
+ const String& t_str = String::Handle(String::New("t"));
+ const String& th_str = String::Handle(String::New("th"));
+ const int32_t chars[] = {'t', 'h', 'i', 's'};
+ EXPECT(!empty.Equals(chars, -1));
+ EXPECT(empty.Equals(chars, 0));
+ EXPECT(!empty.Equals(chars, 1));
+ EXPECT(!t_str.Equals(chars, 0));
+ EXPECT(t_str.Equals(chars, 1));
+ EXPECT(!t_str.Equals(chars, 2));
+ EXPECT(!th_str.Equals(chars, 1));
+ EXPECT(th_str.Equals(chars, 2));
+ EXPECT(!th_str.Equals(chars, 3));
+}
+
+
TEST_CASE(ExternalOneByteString) {
uint8_t characters[] = { 0xF6, 0xF1, 0xE9 };
intptr_t len = ARRAY_SIZE(characters);
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698