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

Side by Side Diff: test/mjsunit/global-const-var-conflicts.js

Issue 379893002: Clean up and update const / var (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comment Created 6 years, 5 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/const-redecl.js ('k') | test/mjsunit/regress/regress-1170.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 23 matching lines...) Expand all
34 try { eval("var a"); } catch (e) { caught++; assertTrue(e instanceof TypeError); } 34 try { eval("var a"); } catch (e) { caught++; assertTrue(e instanceof TypeError); }
35 assertTrue(typeof a == 'undefined'); 35 assertTrue(typeof a == 'undefined');
36 try { eval("var a = 1"); } catch (e) { caught++; assertTrue(e instanceof TypeErr or); } 36 try { eval("var a = 1"); } catch (e) { caught++; assertTrue(e instanceof TypeErr or); }
37 assertTrue(typeof a == 'undefined'); 37 assertTrue(typeof a == 'undefined');
38 38
39 eval("const b = 0"); 39 eval("const b = 0");
40 try { eval("var b"); } catch (e) { caught++; assertTrue(e instanceof TypeError); } 40 try { eval("var b"); } catch (e) { caught++; assertTrue(e instanceof TypeError); }
41 assertEquals(0, b); 41 assertEquals(0, b);
42 try { eval("var b = 1"); } catch (e) { caught++; assertTrue(e instanceof TypeErr or); } 42 try { eval("var b = 1"); } catch (e) { caught++; assertTrue(e instanceof TypeErr or); }
43 assertEquals(0, b); 43 assertEquals(0, b);
44 assertEquals(0, caught);
44 45
45 eval("var c"); 46 eval("var c");
46 try { eval("const c"); } catch (e) { caught++; assertTrue(e instanceof TypeError ); } 47 try { eval("const c"); } catch (e) { caught++; assertTrue(e instanceof TypeError ); }
47 assertTrue(typeof c == 'undefined'); 48 assertTrue(typeof c == 'undefined');
49 assertEquals(1, caught);
48 try { eval("const c = 1"); } catch (e) { caught++; assertTrue(e instanceof TypeE rror); } 50 try { eval("const c = 1"); } catch (e) { caught++; assertTrue(e instanceof TypeE rror); }
49 assertEquals(1, c); 51 assertEquals(undefined, c);
52 assertEquals(2, caught);
50 53
51 eval("var d = 0"); 54 eval("var d = 0");
52 try { eval("const d"); } catch (e) { caught++; assertTrue(e instanceof TypeError ); } 55 try { eval("const d"); } catch (e) { caught++; assertTrue(e instanceof TypeError ); }
53 assertEquals(undefined, d); 56 assertEquals(0, d);
57 assertEquals(3, caught);
54 try { eval("const d = 1"); } catch (e) { caught++; assertTrue(e instanceof TypeE rror); } 58 try { eval("const d = 1"); } catch (e) { caught++; assertTrue(e instanceof TypeE rror); }
55 assertEquals(1, d); 59 assertEquals(0, d);
56 60 assertEquals(4, caught);
57 assertEquals(0, caught);
OLDNEW
« no previous file with comments | « test/mjsunit/const-redecl.js ('k') | test/mjsunit/regress/regress-1170.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698