summaryrefslogtreecommitdiff
path: root/deps/v8/test/cctest/test-conversions.cc
diff options
context:
space:
mode:
authorChris Dickinson <christopher.s.dickinson@gmail.com>2015-05-05 13:48:55 -0700
committerRod Vagg <rod@vagg.org>2015-08-04 11:56:09 -0700
commitd58e780504bdba6c5897c48428fd984c5b5f96fe (patch)
tree033f1568ae3f9f077aceb843b42eb1ed1739ce0f /deps/v8/test/cctest/test-conversions.cc
parent21d31c08e7d0b6865e52452750b20b05e6dca443 (diff)
downloadnode-new-d58e780504bdba6c5897c48428fd984c5b5f96fe.tar.gz
deps: update v8 to 4.3.61.21
* @indutny's SealHandleScope patch (484bebc38319fc7c622478037922ad73b2edcbf9) has been cherry picked onto the top of V8 to make it compile. * There's some test breakage in contextify. * This was merged at the request of the TC. PR-URL: https://github.com/iojs/io.js/pull/1632
Diffstat (limited to 'deps/v8/test/cctest/test-conversions.cc')
-rw-r--r--deps/v8/test/cctest/test-conversions.cc55
1 files changed, 55 insertions, 0 deletions
diff --git a/deps/v8/test/cctest/test-conversions.cc b/deps/v8/test/cctest/test-conversions.cc
index b7881edcf6..789425119d 100644
--- a/deps/v8/test/cctest/test-conversions.cc
+++ b/deps/v8/test/cctest/test-conversions.cc
@@ -362,3 +362,58 @@ 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, "-");
+ 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");
+}