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

Unified Diff: runtime/vm/object_test.cc

Issue 1096433003: Fix List length size check; add test. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 8 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/code_generator.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 45184)
+++ runtime/vm/object_test.cc (working copy)
@@ -1951,6 +1951,27 @@
}
+TEST_CASE(ArrayLength) {
+ const intptr_t kLength = Array::kMaxElements + 1;
Ivan Posva 2015/04/17 04:38:25 Please verify that this test passes with kMaxEleme
+ ASSERT(kLength >= 0);
+ char buffer[1024];
+ OS::SNPrint(buffer, sizeof(buffer),
+ "main() {\n"
+ " new List(%" Pd ");\n"
+ "}\n",
+ kLength);
+ Dart_Handle lib = TestCase::LoadTestScript(buffer, NULL);
+ EXPECT_VALID(lib);
+ Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL);
+ OS::SNPrint(buffer, sizeof(buffer),
+ "Unhandled exception:\n"
+ "Invalid argument(s): Length (%" Pd ") must be an integer "
+ "in the range [0..%" Pd "].",
+ kLength, Array::kMaxElements);
+ EXPECT_ERROR(result, buffer);
+}
+
+
TEST_CASE(StringCodePointIterator) {
const String& str0 = String::Handle(String::New(""));
String::CodePointIterator it0(str0);
« no previous file with comments | « runtime/vm/code_generator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698