OLD | NEW |
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 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 assertSame(0, d3c.byteLength); | 667 assertSame(0, d3c.byteLength); |
668 | 668 |
669 var d4 = new DataView(ab, 1, 3.1415926); | 669 var d4 = new DataView(ab, 1, 3.1415926); |
670 assertSame(ab, d4.buffer); | 670 assertSame(ab, d4.buffer); |
671 assertSame(1, d4.byteOffset); | 671 assertSame(1, d4.byteOffset); |
672 assertSame(3, d4.byteLength); | 672 assertSame(3, d4.byteLength); |
673 | 673 |
674 | 674 |
675 // error cases | 675 // error cases |
676 assertThrows(function() { new DataView(ab, -1); }, RangeError); | 676 assertThrows(function() { new DataView(ab, -1); }, RangeError); |
677 assertThrows(function() { new DataView(ab, 1, -1); }, RangeError); | |
678 assertThrows(function() { new DataView(); }, TypeError); | 677 assertThrows(function() { new DataView(); }, TypeError); |
679 assertThrows(function() { new DataView([]); }, TypeError); | 678 assertThrows(function() { new DataView([]); }, TypeError); |
680 assertThrows(function() { new DataView(ab, 257); }, RangeError); | 679 assertThrows(function() { new DataView(ab, 257); }, RangeError); |
681 assertThrows(function() { new DataView(ab, 1, 1024); }, RangeError); | 680 assertThrows(function() { new DataView(ab, 1, 1024); }, RangeError); |
682 } | 681 } |
683 | 682 |
684 TestDataViewConstructor(); | 683 TestDataViewConstructor(); |
685 | 684 |
686 function TestDataViewPropertyTypeChecks() { | 685 function TestDataViewPropertyTypeChecks() { |
687 var a = new DataView(new ArrayBuffer(10)); | 686 var a = new DataView(new ArrayBuffer(10)); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 | 769 |
771 function TestNonConfigurableProperties(constructor) { | 770 function TestNonConfigurableProperties(constructor) { |
772 var arr = new constructor([100]) | 771 var arr = new constructor([100]) |
773 assertFalse(Object.getOwnPropertyDescriptor(arr,"0").configurable) | 772 assertFalse(Object.getOwnPropertyDescriptor(arr,"0").configurable) |
774 assertFalse(delete arr[0]) | 773 assertFalse(delete arr[0]) |
775 } | 774 } |
776 | 775 |
777 for(i = 0; i < typedArrayConstructors.length; i++) { | 776 for(i = 0; i < typedArrayConstructors.length; i++) { |
778 TestNonConfigurableProperties(typedArrayConstructors[i]); | 777 TestNonConfigurableProperties(typedArrayConstructors[i]); |
779 } | 778 } |
OLD | NEW |