1// Copyright JS Foundation and other contributors, http://js.foundation 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15// 1. 16var i = 0; 17for (; i < 100; i++) { 18} 19assert(i == 100); 20 21// 2. 22for (var j = 0; j < 100; j++) { 23} 24assert(j == 100); 25 26// 3. 27for (i = 0; ; ) { 28 if (i == 100) { 29 break; 30 assert(false); 31 } 32 i++; 33} 34assert(i == 100); 35 36// 4. 37for (i = 0; i < 10; i++) { 38 for (j = 0; j < 10; j++) { 39 } 40} 41assert(i != 100); 42assert(j != 100); 43assert(i == 10); 44assert(j == 10); 45 46// 5. 47s = ''; 48for ( 49var i = {x: 0}; 50 51 i.x < 2 52; 53 i.x++ 54 55) 56 { 57 s += i.x; 58} 59 60assert (s === '01'); 61 62// 6. 63s = ''; 64for ( 65var i = {x: 0}; 66 67 i.x < 2 68; 69 70 i.x++ 71 72) 73 { 74 s += i.x; 75} 76 77assert (s === '01'); 78 79// 7. 80a = []; 81for (; a[0]; ) { 82 assert (false); 83} 84