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

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

Issue 8888006: Make more JS files beter match the coding standard. Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review comments Created 9 years 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/escape.js ('k') | test/mjsunit/eval-enclosing-function-name.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 10 matching lines...) Expand all
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
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 assertEquals(void 0, eval()); 28 assertEquals(void 0, eval());
29 assertEquals(4, eval(4)); 29 assertEquals(4, eval(4));
30 30
31 function f() { return 'The f function'; }; 31 function f() { return 'The f function'; }
32 assertTrue(f === eval(f)); 32 assertTrue(f === eval(f));
33 33
34 function g(x, y) { return 4; }; 34 function g(x, y) { return 4; }
35 35
36 count = 0; 36 count = 0;
37 assertEquals(4, eval('2 + 2', count++)); 37 assertEquals(4, eval('2 + 2', count++));
38 assertEquals(1, count); 38 assertEquals(1, count);
39 39
40 try { 40 try {
41 eval('hest 7 &*^*&^'); 41 eval('hest 7 &*^*&^');
42 assertUnreachable('Did not throw on syntax error.'); 42 assertUnreachable('Did not throw on syntax error.');
43 } catch (e) { 43 } catch (e) {
44 assertEquals('SyntaxError', e.name); 44 assertEquals('SyntaxError', e.name);
45 } 45 }
46 46
47 47
48 // eval has special evaluation order for consistency with other browsers. 48 // eval has special evaluation order for consistency with other browsers.
49 global_eval = eval; 49 global_eval = eval;
50 assertEquals(void 0, eval(eval("var eval = function f(x) { return 'hest';}"))) 50 assertEquals(void 0, eval(eval("var eval = function f(x) { return 'hest';}")));
51 eval = global_eval; 51 eval = global_eval;
52 52
53 // Test eval with different number of parameters. 53 // Test eval with different number of parameters.
54 global_eval = eval; 54 global_eval = eval;
55 eval = function(x, y) { return x + y; }; 55 eval = function(x, y) { return x + y; };
56 assertEquals(4, eval(2, 2)); 56 assertEquals(4, eval(2, 2));
57 eval = global_eval; 57 eval = global_eval;
58 58
59 // Test that un-aliased eval reads from local context. 59 // Test that un-aliased eval reads from local context.
60 foo = 0; 60 foo = 0;
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 180
181 181
182 // Regression test: calling a function named eval found in a context that is 182 // Regression test: calling a function named eval found in a context that is
183 // not the global context should get the global object as receiver. 183 // not the global context should get the global object as receiver.
184 result = 184 result =
185 (function () { 185 (function () {
186 var eval = function (x) { return this; }; 186 var eval = function (x) { return this; };
187 with ({}) { return eval('ignore'); } 187 with ({}) { return eval('ignore'); }
188 })(); 188 })();
189 assertEquals(this, result); 189 assertEquals(this, result);
OLDNEW
« no previous file with comments | « test/mjsunit/escape.js ('k') | test/mjsunit/eval-enclosing-function-name.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698