S12.6.1_A1.js (1424B)
1 // Copyright 2009 the Sputnik authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 info: | 6 When the production "do Statement while ( Expression )" is evaluated, 7 Statement is evaluated first 8 es5id: 12.6.1_A1 9 description: Evaluating various Expressions 10 ---*/ 11 12 var __in__do; 13 14 do __in__do=1; while ( false ); 15 16 ////////////////////////////////////////////////////////////////////////////// 17 //CHECK#1 18 if (__in__do!==1) { 19 throw new Test262Error('#1: the inner statement of a do-loop should be evaluated before the expression: false evaluates to false'); 20 } 21 // 22 ////////////////////////////////////////////////////////////////////////////// 23 24 do __in__do=2; while ( 0 ); 25 26 ////////////////////////////////////////////////////////////////////////////// 27 //CHECK#2 28 if (__in__do!==2) { 29 throw new Test262Error('#2: the inner statement of a do-loop should be evaluated before the expression: 0 evaluates to false'); 30 } 31 // 32 ////////////////////////////////////////////////////////////////////////////// 33 34 do __in__do=3; while ( "" ); 35 36 ////////////////////////////////////////////////////////////////////////////// 37 //CHECK#3 38 if (__in__do!==3) { 39 throw new Test262Error('#3: the inner statement of a do-loop should be evaluated before the expression: "" evaluates to false'); 40 } 41 // 42 ////////////////////////////////////////////////////////////////////////////// 43 44 reportCompare(0, 0);