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

Side by Side Diff: test/mjsunit/regress/regress-2615.js

Issue 656683003: Revert "Remove SmartMove, bringing Array methods further into spec compliance" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 | « test/mjsunit/bugs/bug-2615.js ('k') | test/mjsunit/regress/regress-crbug-412319.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
4 // met:
5 //
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28 /* These tests should pass now but they take too long to run.
29 var a = [];
30 a[0xfffffffe] = 10;
31 assertThrows("a.unshift(1);", RangeError);
32 assertEquals(0xffffffff, a.length);
33 assertEquals(10, a[0xffffffff]);
34 assertEquals(undefined, a[0xfffffffe]);
35
36 a = [1,2,3];
37 a[0xfffffffe] = 10;
38 assertThrows("a.splice(1,1,7,7,7,7,7);", RangeError);
39 assertEquals([1,7,7,7,7,7,3], a.slice(0, 7));
40 assertEquals(0xffffffff, a.length);
41 assertEquals(10, a[0xfffffffe + 5 - 1]);
42 */
43
44 a = [1];
45 Object.defineProperty(a, "1", {writable:false, configurable:false, value: 100});
46 assertThrows("a.unshift(4);", TypeError);
47 assertEquals([1, 100, 100], a);
48 var desc = Object.getOwnPropertyDescriptor(a, "1");
49 assertEquals(false, desc.writable);
50 assertEquals(false, desc.configurable);
51
52 a = [1];
53 var g = function() { return 100; };
54 Object.defineProperty(a, "1", {get:g});
55 assertThrows("a.unshift(0);", TypeError);
56 assertEquals([1, 100, 100], a);
57 desc = Object.getOwnPropertyDescriptor(a, "1");
58 assertEquals(false, desc.configurable);
59 assertEquals(g, desc.get);
60
61 a = [1];
62 var c = 0;
63 var s = function(v) { c += 1; };
64 Object.defineProperty(a, "1", {set:s});
65 a.unshift(10);
66 assertEquals([10, undefined, undefined], a);
67 assertEquals(1, c);
68 desc = Object.getOwnPropertyDescriptor(a, "1");
69 assertEquals(false, desc.configurable);
70 assertEquals(s, desc.set);
71
72 a = [1];
73 Object.defineProperty(a, "1", {configurable:false, value:10});
74 assertThrows("a.splice(1,1);", TypeError);
75 assertEquals([1, 10], a);
76 desc = Object.getOwnPropertyDescriptor(a, "1");
77 assertEquals(false, desc.configurable);
78
79 a = [0,1,2,3,4,5,6];
80 Object.defineProperty(a, "3", {configurable:false, writable:false, value:3});
81 assertThrows("a.splice(1,4);", TypeError);
82 assertEquals([0,5,6,3,,,,], a);
83 desc = Object.getOwnPropertyDescriptor(a, "3");
84 assertEquals(false, desc.configurable);
85 assertEquals(false, desc.writable);
86
87 a = [0,1,2,3,4,5,6];
88 Object.defineProperty(a, "5", {configurable:false, value:5});
89 assertThrows("a.splice(1,4);", TypeError);
90 assertEquals([0,5,6,3,4,5,,], a);
91 desc = Object.getOwnPropertyDescriptor(a, "5");
92 assertEquals(false, desc.configurable);
93
94 a = [1,2,3,,5];
95 Object.defineProperty(a, "1", {configurable:false, writable:true, value:2});
96 assertEquals(1, a.shift());
97 assertEquals([2,3,,5], a);
98 desc = Object.getOwnPropertyDescriptor(a, "1");
99 assertEquals(false, desc.configurable);
100 assertEquals(true, desc.writable);
101 assertThrows("a.shift();", TypeError);
102 assertEquals([3,3,,5], a);
103 desc = Object.getOwnPropertyDescriptor(a, "1");
104 assertEquals(false, desc.configurable);
105 assertEquals(true, desc.writable);
106
107 a = [1,2,3];
108 Object.defineProperty(a, "2", {configurable:false, value:3});
109 assertThrows("a.pop();", TypeError);
110 assertEquals([1,2,3], a);
111 desc = Object.getOwnPropertyDescriptor(a, "2");
112 assertEquals(false, desc.configurable);
OLDNEW
« no previous file with comments | « test/mjsunit/bugs/bug-2615.js ('k') | test/mjsunit/regress/regress-crbug-412319.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698