OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 static void CheckNonArrayIndex(bool expected, const char* chars) { | 367 static void CheckNonArrayIndex(bool expected, const char* chars) { |
368 auto isolate = CcTest::i_isolate(); | 368 auto isolate = CcTest::i_isolate(); |
369 auto string = isolate->factory()->NewStringFromAsciiChecked(chars); | 369 auto string = isolate->factory()->NewStringFromAsciiChecked(chars); |
370 CHECK_EQ(expected, IsNonArrayIndexInteger(*string)); | 370 CHECK_EQ(expected, IsNonArrayIndexInteger(*string)); |
371 } | 371 } |
372 | 372 |
373 | 373 |
374 TEST(NonArrayIndexParsing) { | 374 TEST(NonArrayIndexParsing) { |
375 auto isolate = CcTest::i_isolate(); | 375 auto isolate = CcTest::i_isolate(); |
376 HandleScope scope(isolate); | 376 HandleScope scope(isolate); |
| 377 CheckNonArrayIndex(false, ""); |
377 CheckNonArrayIndex(false, "-"); | 378 CheckNonArrayIndex(false, "-"); |
378 CheckNonArrayIndex(false, "0"); | 379 CheckNonArrayIndex(false, "0"); |
379 CheckNonArrayIndex(false, "01"); | 380 CheckNonArrayIndex(false, "01"); |
380 CheckNonArrayIndex(false, "-01"); | 381 CheckNonArrayIndex(false, "-01"); |
381 CheckNonArrayIndex(false, "4294967295"); | 382 CheckNonArrayIndex(false, "4294967295"); |
382 CheckNonArrayIndex(false, "429496.7295"); | 383 CheckNonArrayIndex(false, "429496.7295"); |
383 CheckNonArrayIndex(false, "43s3"); | 384 CheckNonArrayIndex(false, "43s3"); |
384 CheckNonArrayIndex(true, "-0"); | 385 CheckNonArrayIndex(true, "-0"); |
385 CheckNonArrayIndex(true, "-1"); | 386 CheckNonArrayIndex(true, "-1"); |
386 CheckNonArrayIndex(true, "4294967296"); | 387 CheckNonArrayIndex(true, "4294967296"); |
(...skipping 22 matching lines...) Expand all Loading... |
409 "429496729642949672964294967296429496729642949672964294967296" | 410 "429496729642949672964294967296429496729642949672964294967296" |
410 "429496729642949672964294967296429496729642949672964294967296" | 411 "429496729642949672964294967296429496729642949672964294967296" |
411 "429496729642949672964294967296429496729642949672964294967296" | 412 "429496729642949672964294967296429496729642949672964294967296" |
412 "429496729642949672964294967296429496729642949672964294967296" | 413 "429496729642949672964294967296429496729642949672964294967296" |
413 "429496729642949672964294967296429496729642949672964294967296" | 414 "429496729642949672964294967296429496729642949672964294967296" |
414 "429496729642949672964294967296429496729642949672964294967296" | 415 "429496729642949672964294967296429496729642949672964294967296" |
415 "429496729642949672964294967296429496729642949672964294967296" | 416 "429496729642949672964294967296429496729642949672964294967296" |
416 "429496729642949672964294967296429496729642949672964294967296" | 417 "429496729642949672964294967296429496729642949672964294967296" |
417 "429496729642949672964294967296429496729642949672964294967296"); | 418 "429496729642949672964294967296429496729642949672964294967296"); |
418 } | 419 } |
OLD | NEW |