OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 | 221 |
222 // Check slicing on arguments object. | 222 // Check slicing on arguments object. |
223 (function() { | 223 (function() { |
224 function func(expected, a0, a1, a2) { | 224 function func(expected, a0, a1, a2) { |
225 assertEquals(expected, Array.prototype.slice.call(arguments, 1)); | 225 assertEquals(expected, Array.prototype.slice.call(arguments, 1)); |
226 } | 226 } |
227 | 227 |
228 func([]); | 228 func([]); |
229 func(['a'], 'a'); | 229 func(['a'], 'a'); |
230 func(['a', 1], 'a', 1); | 230 func(['a', 1], 'a', 1); |
| 231 func(['a', 1, 2, 3, 4, 5], 'a', 1, 2, 3, 4, 5); |
231 func(['a', 1, undefined], 'a', 1, undefined); | 232 func(['a', 1, undefined], 'a', 1, undefined); |
232 func(['a', 1, undefined, void(0)], 'a', 1, undefined, void(0)); | 233 func(['a', 1, undefined, void(0)], 'a', 1, undefined, void(0)); |
233 })(); | 234 })(); |
234 | 235 |
235 // Check slicing on arguments object when missing arguments get assigined. | 236 // Check slicing on arguments object when missing arguments get assigined. |
236 (function() { | 237 (function() { |
237 function func(x, y) { | 238 function func(x, y) { |
238 assertEquals(1, arguments.length); | 239 assertEquals(1, arguments.length); |
239 assertEquals(undefined, y); | 240 assertEquals(undefined, y); |
240 y = 239; | 241 y = 239; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 (function() { | 296 (function() { |
296 function f() { | 297 function f() { |
297 delete arguments[1]; | 298 delete arguments[1]; |
298 arguments.__proto__[1] = 5; | 299 arguments.__proto__[1] = 5; |
299 var result = Array.prototype.slice.call(arguments); | 300 var result = Array.prototype.slice.call(arguments); |
300 delete arguments.__proto__[1]; | 301 delete arguments.__proto__[1]; |
301 assertEquals([1,5,3], result); | 302 assertEquals([1,5,3], result); |
302 } | 303 } |
303 f(1,2,3); | 304 f(1,2,3); |
304 })(); | 305 })(); |
OLD | NEW |