line-terminators.js (1246B)
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 Since LineTerminator between "break" and Identifier is not allowed, 7 "break" is evaluated without label 8 es5id: 12.8_A2 9 description: > 10 Checking by using eval, inserting LineTerminator between break and 11 Identifier 12 ---*/ 13 14 FOR1 : for(var i=1;i<2;i++){ 15 LABEL1 : do { 16 break 17 FOR1; 18 } while(0); 19 } 20 21 assert.sameValue(i, 2, '#1: Since LineTerminator(U-000A) between break and Identifier not allowed break evaluates without label'); 22 23 FOR2 : for(var i=1;i<2;i++){ 24 LABEL2 : do { 25 breakFOR2; 26 } while(0); 27 } 28 29 assert.sameValue(i, 2, '#2: Since LineTerminator(U-000D) between break and Identifier not allowed break evaluates without label'); 30 31 FOR3 : for(var i=1;i<2;i++){ 32 LABEL3 : do { 33 break FOR3; 34 } while(0); 35 } 36 37 assert.sameValue(i, 2, '#3: Since LineTerminator(U-2028) between break and Identifier not allowed break evaluates without label'); 38 39 FOR4 : for(var i=1;i<2;i++){ 40 LABEL4 : do { 41 break FOR4; 42 } while(0); 43 } 44 45 assert.sameValue(i, 2, '#4: Since LineTerminator(U-2029) between break and Identifier not allowed break evaluates without label'); 46 47 reportCompare(0, 0);