Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(205)

Delta Between Two Patch Sets: tests/com/google/caja/plugin/es53-test-language-guest.html

Issue 6827077: Mitigate top-level vars and typeof differences between ES5 and ES5/3 with rewriting (Closed) Base URL: http://google-caja.googlecode.com/svn/trunk/
Left Patch Set: Mitigate top-level vars and typeof differences between ES5 and ES5/3 with rewriting Created 11 years, 4 months ago
Right Patch Set: Mitigate top-level vars and typeof differences between ES5 and ES5/3 with rewriting Created 11 years, 2 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
LEFTRIGHT
(no file at all)
1 <!-- 1 <!--
2 - Copyright (C) 2010 Google Inc. 2 - Copyright (C) 2010 Google Inc.
3 - 3 -
4 - Licensed under the Apache License, Version 2.0 (the "License"); 4 - Licensed under the Apache License, Version 2.0 (the "License");
5 - you may not use this file except in compliance with the License. 5 - you may not use this file except in compliance with the License.
6 - You may obtain a copy of the License at 6 - You may obtain a copy of the License at
7 - 7 -
8 - http://www.apache.org/licenses/LICENSE-2.0 8 - http://www.apache.org/licenses/LICENSE-2.0
9 - 9 -
10 - Unless required by applicable law or agreed to in writing, software 10 - Unless required by applicable law or agreed to in writing, software
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 window.c = c; // SES scope workaround. TODO(kpreid): Defeating the test? 217 window.c = c; // SES scope workaround. TODO(kpreid): Defeating the test?
218 </script> 218 </script>
219 <p id="testGlobalReference" class="clickme testcontainer"> 219 <p id="testGlobalReference" class="clickme testcontainer">
220 <span onclick="assertEquals(1, ++c); pass('testGlobalReference');">Test 220 <span onclick="assertEquals(1, ++c); pass('testGlobalReference');">Test
221 global reference (clickme)</span> 221 global reference (clickme)</span>
222 </p> 222 </p>
223 <script type="text/javascript"> 223 <script type="text/javascript">
224 jsunitRegister('testGlobalReference', 224 jsunitRegister('testGlobalReference',
225 function testGlobalReference() { }); 225 function testGlobalReference() { });
226 </script> 226 </script>
227
228 <div class="testcontainer" id="testTopLevel"
229 ><script
230 >var topVar1 = '1', topVar2 = '2';
231 var topVar3;
232 topVar3 = '3';
233 function foo() {
234 var notTopVar1 = 'fail', notTopVar2 = 'fail';
235 var notTopVar3;
236 notTopVar3 = 'fail';
237 }
238 foo();
239 </script>
240 </div>
241 <script type="text/javascript">
242 jsunitRegister('testTopLevel',
243 function testTopLevel () {
244 assertEquals("Top level var", "1", topVar1);
245 assertEquals("Top level var", "2", topVar2);
246 assertEquals("Top level var", "3", topVar3);
247
248 assertEquals("Top level var", "1", window.topVar1);
249 assertEquals("Top level var", "2", window.topVar2);
250 assertEquals("Top level var", "3", window.topVar3);
251
252 assertEquals("Non-top level var", "undefined", typeof window.notTopVar1);
253 assertEquals("Non-top level var", "undefined", typeof window.notTopVar2);
254 // check that we didn't accidentally rewrite inside foo()
255 assertNotEquals("Non-top level var", "fail", window.notTopVar3);
256
257 pass('testTopLevel');
258 });
259 </script>
260 <div class="testcontainer" id="testTypeOf"></div>
261 <script>
262 jsunitRegister('testTypeOf',
263 function testTypeOf () {
264 try {
265 assertEquals("undefined", typeof anDeclaredVariable);
266 } catch (e) {
267 fail();
268 }
269
270 pass('testTypeOf');
271 });
272
273 // jsunit complains if there are zero tests
274 jsunitRegister('testNop', function testNop() { pass('testNop'); });
275 </script>
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b