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

Unified Diff: test/cctest/test-conversions.cc

Issue 992913002: handle the special snowflakes that are Integer Indexed Exotic objects (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime/runtime-debug.cc ('k') | test/mjsunit/es6/indexed-integer-exotics.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-conversions.cc
diff --git a/test/cctest/test-conversions.cc b/test/cctest/test-conversions.cc
index b7881edcf6d3d81d5febb646989511f3b6ed10d1..c8b87d8989a56e0e3382880164a412c8d6f9285d 100644
--- a/test/cctest/test-conversions.cc
+++ b/test/cctest/test-conversions.cc
@@ -362,3 +362,57 @@ TEST(BitField64) {
CHECK(x == MiddleBits::encode(3));
CHECK_EQ(3, MiddleBits::decode(x));
}
+
+
+static void CheckNonArrayIndex(bool expected, const char* chars) {
+ auto isolate = CcTest::i_isolate();
+ auto string = isolate->factory()->NewStringFromAsciiChecked(chars);
+ CHECK_EQ(expected, IsNonArrayIndexInteger(*string));
+}
+
+
+TEST(NonArrayIndexParsing) {
+ auto isolate = CcTest::i_isolate();
+ HandleScope scope(isolate);
+ CheckNonArrayIndex(false, "-");
+ CheckNonArrayIndex(false, "0");
+ CheckNonArrayIndex(false, "01");
+ CheckNonArrayIndex(false, "-01");
+ CheckNonArrayIndex(false, "4294967295");
+ CheckNonArrayIndex(false, "429496.7295");
+ CheckNonArrayIndex(false, "43s3");
+ CheckNonArrayIndex(true, "-0");
+ CheckNonArrayIndex(true, "-1");
+ CheckNonArrayIndex(true, "4294967296");
+ CheckNonArrayIndex(true, "-4294967296");
+ CheckNonArrayIndex(
+ true,
+ "429496729642949672964294967296429496729642949672964294967296"
+ "429496729642949672964294967296429496729642949672964294967296"
+ "429496729642949672964294967296429496729642949672964294967296"
+ "429496729642949672964294967296429496729642949672964294967296"
+ "429496729642949672964294967296429496729642949672964294967296"
+ "429496729642949672964294967296429496729642949672964294967296"
+ "429496729642949672964294967296429496729642949672964294967296"
+ "429496729642949672964294967296429496729642949672964294967296"
+ "429496729642949672964294967296429496729642949672964294967296"
+ "429496729642949672964294967296429496729642949672964294967296"
+ "429496729642949672964294967296429496729642949672964294967296"
+ "429496729642949672964294967296429496729642949672964294967296"
+ "429496729642949672964294967296429496729642949672964294967296");
+ CheckNonArrayIndex(
+ true,
+ "-429496729642949672964294967296429496729642949672964294967296"
+ "429496729642949672964294967296429496729642949672964294967296"
+ "429496729642949672964294967296429496729642949672964294967296"
+ "429496729642949672964294967296429496729642949672964294967296"
+ "429496729642949672964294967296429496729642949672964294967296"
+ "429496729642949672964294967296429496729642949672964294967296"
+ "429496729642949672964294967296429496729642949672964294967296"
+ "429496729642949672964294967296429496729642949672964294967296"
+ "429496729642949672964294967296429496729642949672964294967296"
+ "429496729642949672964294967296429496729642949672964294967296"
+ "429496729642949672964294967296429496729642949672964294967296"
+ "429496729642949672964294967296429496729642949672964294967296"
+ "429496729642949672964294967296429496729642949672964294967296");
+}
« no previous file with comments | « src/runtime/runtime-debug.cc ('k') | test/mjsunit/es6/indexed-integer-exotics.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698