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

Side by Side Diff: test/mjsunit/harmony/typedarrays.js

Issue 670623003: Handle property name "-0" correctly for typed arrays. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: And another test for sloppy mode Created 6 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/lookup.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 a[s] = 10; 493 a[s] = 10;
494 assertEquals(10, a[s]); 494 assertEquals(10, a[s]);
495 var s1 = " -10 "; 495 var s1 = " -10 ";
496 a[s] = 10; 496 a[s] = 10;
497 assertEquals(10, a[s]); 497 assertEquals(10, a[s]);
498 498
499 a["-1e2"] = 10; 499 a["-1e2"] = 10;
500 assertEquals(10, a["-1e2"]); 500 assertEquals(10, a["-1e2"]);
501 assertEquals(undefined, a[-1e2]); 501 assertEquals(undefined, a[-1e2]);
502 502
503 a["-0"] = 256;
504 var s2 = " -0";
505 a[s2] = 255;
506 assertEquals(undefined, a["-0"]);
507 assertEquals(255, a[s2]);
508 assertEquals(0, a[-0]);
509
503 /* Chromium bug: 424619 510 /* Chromium bug: 424619
504 * a[-Infinity] = 50; 511 * a[-Infinity] = 50;
505 * assertEquals(undefined, a[-Infinity]); 512 * assertEquals(undefined, a[-Infinity]);
506 */ 513 */
507 a[1.5] = 10; 514 a[1.5] = 10;
508 assertEquals(undefined, a[1.5]); 515 assertEquals(undefined, a[1.5]);
509 var nan = Math.sqrt(-1); 516 var nan = Math.sqrt(-1);
510 a[nan] = 5; 517 a[nan] = 5;
511 assertEquals(5, a[nan]); 518 assertEquals(5, a[nan]);
512 519
(...skipping 22 matching lines...) Expand all
535 a[s] = 10; 542 a[s] = 10;
536 assertEquals(10, a[s]); 543 assertEquals(10, a[s]);
537 var s1 = " -10 "; 544 var s1 = " -10 ";
538 a[s] = 10; 545 a[s] = 10;
539 assertEquals(10, a[s]); 546 assertEquals(10, a[s]);
540 547
541 a["-1e2"] = 10; 548 a["-1e2"] = 10;
542 assertEquals(10, a["-1e2"]); 549 assertEquals(10, a["-1e2"]);
543 assertEquals(undefined, a[-1e2]); 550 assertEquals(undefined, a[-1e2]);
544 551
552 a["-0"] = 256;
553 var s2 = " -0";
554 a[s2] = 255;
555 assertEquals(undefined, a["-0"]);
556 assertEquals(255, a[s2]);
557 assertEquals(0, a[-0]);
558
545 /* Chromium bug: 424619 559 /* Chromium bug: 424619
546 * a[-Infinity] = 50; 560 * a[-Infinity] = 50;
547 * assertEquals(undefined, a[-Infinity]); 561 * assertEquals(undefined, a[-Infinity]);
548 */ 562 */
549 a[1.5] = 10; 563 a[1.5] = 10;
550 assertEquals(undefined, a[1.5]); 564 assertEquals(undefined, a[1.5]);
551 var nan = Math.sqrt(-1); 565 var nan = Math.sqrt(-1);
552 a[nan] = 5; 566 a[nan] = 5;
553 assertEquals(5, a[nan]); 567 assertEquals(5, a[nan]);
554 568
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 TestArbitrary(new ArrayBuffer(256)); 681 TestArbitrary(new ArrayBuffer(256));
668 for(i = 0; i < typedArrayConstructors.length; i++) { 682 for(i = 0; i < typedArrayConstructors.length; i++) {
669 TestArbitrary(new typedArrayConstructors[i](10)); 683 TestArbitrary(new typedArrayConstructors[i](10));
670 } 684 }
671 TestArbitrary(new DataView(new ArrayBuffer(256))); 685 TestArbitrary(new DataView(new ArrayBuffer(256)));
672 686
673 687
674 // Test direct constructor call 688 // Test direct constructor call
675 assertThrows(function() { ArrayBuffer(); }, TypeError); 689 assertThrows(function() { ArrayBuffer(); }, TypeError);
676 assertThrows(function() { DataView(new ArrayBuffer()); }, TypeError); 690 assertThrows(function() { DataView(new ArrayBuffer()); }, TypeError);
OLDNEW
« no previous file with comments | « src/lookup.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698