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

Side by Side Diff: test/mjsunit/call.js

Issue 6087011: Draft of ES5 fix to Function.prototype.call and apply (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 11 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/arguments-apply.js ('k') | test/mjsunit/compiler/regress-arguments.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 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 11 matching lines...) Expand all
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 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. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 function f0() { 28 function f0() {
29 return this; 29 return this;
30 } 30 }
31 31
32 assertTrue(this === f0.call(), "1"); 32 assertTrue(undefined === f0.call(), "1");
33 33
34 assertTrue(this === f0.call(this), "w"); 34 assertTrue(this === f0.call(this), "w");
35 assertTrue(this === f0.call(this, 1), "w"); 35 assertTrue(this === f0.call(this, 1), "w");
36 assertTrue(this === f0.call(this, 1, 2), "w"); 36 assertTrue(this === f0.call(this, 1, 2), "w");
37 37
38 assertTrue(this === f0.call(null), "3a"); 38 assertTrue(null === f0.call(null), "3a");
39 assertTrue(this === f0.call(null, 1), "3b"); 39 assertTrue(null === f0.call(null, 1), "3b");
40 assertTrue(this === f0.call(null, 1, 2), "3c"); 40 assertTrue(null === f0.call(null, 1, 2), "3c");
41 41
42 assertTrue(this === f0.call(void 0), "4a"); 42 assertTrue(undefined === f0.call(void 0), "4a");
43 assertTrue(this === f0.call(void 0, 1), "4b"); 43 assertTrue(undefined === f0.call(void 0, 1), "4b");
44 assertTrue(this === f0.call(void 0, 1, 2), "4c"); 44 assertTrue(undefined === f0.call(void 0, 1, 2), "4c");
45 45
46 var x = {}; 46 var x = {};
47 assertTrue(x === f0.call(x)); 47 assertTrue(x === f0.call(x));
48 assertTrue(x === f0.call(x, 1)); 48 assertTrue(x === f0.call(x, 1));
49 assertTrue(x === f0.call(x, 1, 2)); 49 assertTrue(x === f0.call(x, 1, 2));
50 50
51 51
52 function f1(a) { 52 function f1(a) {
53 a = a || 'i'; 53 a = a || 'i';
54 return this[a]; 54 return this[a];
(...skipping 23 matching lines...) Expand all
78 return arguments.length; 78 return arguments.length;
79 } 79 }
80 80
81 assertEquals(0, fn.call()); 81 assertEquals(0, fn.call());
82 assertEquals(0, fn.call(this)); 82 assertEquals(0, fn.call(this));
83 assertEquals(0, fn.call(null)); 83 assertEquals(0, fn.call(null));
84 assertEquals(0, fn.call(void 0)); 84 assertEquals(0, fn.call(void 0));
85 assertEquals(1, fn.call(this, 1)); 85 assertEquals(1, fn.call(this, 1));
86 assertEquals(2, fn.call(this, 1, 2)); 86 assertEquals(2, fn.call(this, 1, 2));
87 assertEquals(3, fn.call(this, 1, 2, 3)); 87 assertEquals(3, fn.call(this, 1, 2, 3));
OLDNEW
« no previous file with comments | « test/mjsunit/arguments-apply.js ('k') | test/mjsunit/compiler/regress-arguments.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698