1425bb815Sopenharmony_ci// Copyright JS Foundation and other contributors, http://js.foundation 2425bb815Sopenharmony_ci// 3425bb815Sopenharmony_ci// Licensed under the Apache License, Version 2.0 (the "License"); 4425bb815Sopenharmony_ci// you may not use this file except in compliance with the License. 5425bb815Sopenharmony_ci// You may obtain a copy of the License at 6425bb815Sopenharmony_ci// 7425bb815Sopenharmony_ci// http://www.apache.org/licenses/LICENSE-2.0 8425bb815Sopenharmony_ci// 9425bb815Sopenharmony_ci// Unless required by applicable law or agreed to in writing, software 10425bb815Sopenharmony_ci// distributed under the License is distributed on an "AS IS" BASIS 11425bb815Sopenharmony_ci// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12425bb815Sopenharmony_ci// See the License for the specific language governing permissions and 13425bb815Sopenharmony_ci// limitations under the License. 14425bb815Sopenharmony_ci 15425bb815Sopenharmony_ci/* with */ 16425bb815Sopenharmony_ci 17425bb815Sopenharmony_cifor (var i = 0; i < 10; i++) 18425bb815Sopenharmony_ci{ 19425bb815Sopenharmony_ci with ({}) 20425bb815Sopenharmony_ci { 21425bb815Sopenharmony_ci break; 22425bb815Sopenharmony_ci 23425bb815Sopenharmony_ci assert (false); 24425bb815Sopenharmony_ci } 25425bb815Sopenharmony_ci} 26425bb815Sopenharmony_ciassert (i === 0); 27425bb815Sopenharmony_ci 28425bb815Sopenharmony_cifor (var i = 0; i < 10; i++) 29425bb815Sopenharmony_ci{ 30425bb815Sopenharmony_ci with ({}) 31425bb815Sopenharmony_ci { 32425bb815Sopenharmony_ci continue; 33425bb815Sopenharmony_ci 34425bb815Sopenharmony_ci assert (false); 35425bb815Sopenharmony_ci } 36425bb815Sopenharmony_ci} 37425bb815Sopenharmony_ciassert (i === 10); 38425bb815Sopenharmony_ci 39425bb815Sopenharmony_ci/* try */ 40425bb815Sopenharmony_cifor (var i = 0; i < 10; i++) 41425bb815Sopenharmony_ci{ 42425bb815Sopenharmony_ci try 43425bb815Sopenharmony_ci { 44425bb815Sopenharmony_ci break; 45425bb815Sopenharmony_ci 46425bb815Sopenharmony_ci assert (false); 47425bb815Sopenharmony_ci } 48425bb815Sopenharmony_ci catch (e) 49425bb815Sopenharmony_ci { 50425bb815Sopenharmony_ci } 51425bb815Sopenharmony_ci} 52425bb815Sopenharmony_ciassert (i === 0); 53425bb815Sopenharmony_ci 54425bb815Sopenharmony_cifor (var i = 0; i < 10; i++) 55425bb815Sopenharmony_ci{ 56425bb815Sopenharmony_ci try 57425bb815Sopenharmony_ci { 58425bb815Sopenharmony_ci continue; 59425bb815Sopenharmony_ci 60425bb815Sopenharmony_ci assert (false); 61425bb815Sopenharmony_ci } 62425bb815Sopenharmony_ci catch (e) 63425bb815Sopenharmony_ci { 64425bb815Sopenharmony_ci } 65425bb815Sopenharmony_ci} 66425bb815Sopenharmony_ciassert (i === 10); 67425bb815Sopenharmony_ci 68425bb815Sopenharmony_ci/* catch */ 69425bb815Sopenharmony_cifor (var i = 0; i < 10; i++) 70425bb815Sopenharmony_ci{ 71425bb815Sopenharmony_ci try 72425bb815Sopenharmony_ci { 73425bb815Sopenharmony_ci throw new TypeError (); 74425bb815Sopenharmony_ci assert (false); 75425bb815Sopenharmony_ci } 76425bb815Sopenharmony_ci catch (e) 77425bb815Sopenharmony_ci { 78425bb815Sopenharmony_ci break; 79425bb815Sopenharmony_ci assert (false); 80425bb815Sopenharmony_ci } 81425bb815Sopenharmony_ci} 82425bb815Sopenharmony_ciassert (i === 0); 83425bb815Sopenharmony_ci 84425bb815Sopenharmony_cifor (var i = 0; i < 10; i++) 85425bb815Sopenharmony_ci{ 86425bb815Sopenharmony_ci try 87425bb815Sopenharmony_ci { 88425bb815Sopenharmony_ci throw new TypeError (); 89425bb815Sopenharmony_ci assert (false); 90425bb815Sopenharmony_ci } 91425bb815Sopenharmony_ci catch (e) 92425bb815Sopenharmony_ci { 93425bb815Sopenharmony_ci continue; 94425bb815Sopenharmony_ci assert (false); 95425bb815Sopenharmony_ci } 96425bb815Sopenharmony_ci} 97425bb815Sopenharmony_ciassert (i === 10); 98425bb815Sopenharmony_ci 99425bb815Sopenharmony_ci 100425bb815Sopenharmony_ci/* finally */ 101425bb815Sopenharmony_cifor (var i = 0; i < 10; i++) 102425bb815Sopenharmony_ci{ 103425bb815Sopenharmony_ci try 104425bb815Sopenharmony_ci { 105425bb815Sopenharmony_ci throw new TypeError (); 106425bb815Sopenharmony_ci assert (false); 107425bb815Sopenharmony_ci } 108425bb815Sopenharmony_ci catch (e) 109425bb815Sopenharmony_ci { 110425bb815Sopenharmony_ci } 111425bb815Sopenharmony_ci finally 112425bb815Sopenharmony_ci { 113425bb815Sopenharmony_ci break; 114425bb815Sopenharmony_ci assert (false); 115425bb815Sopenharmony_ci } 116425bb815Sopenharmony_ci} 117425bb815Sopenharmony_ciassert (i === 0); 118425bb815Sopenharmony_ci 119425bb815Sopenharmony_cifor (var i = 0; i < 10; i++) 120425bb815Sopenharmony_ci{ 121425bb815Sopenharmony_ci try 122425bb815Sopenharmony_ci { 123425bb815Sopenharmony_ci throw new TypeError (); 124425bb815Sopenharmony_ci assert (false); 125425bb815Sopenharmony_ci } 126425bb815Sopenharmony_ci catch (e) 127425bb815Sopenharmony_ci { 128425bb815Sopenharmony_ci } 129425bb815Sopenharmony_ci finally 130425bb815Sopenharmony_ci { 131425bb815Sopenharmony_ci continue; 132425bb815Sopenharmony_ci assert (false); 133425bb815Sopenharmony_ci } 134425bb815Sopenharmony_ci} 135425bb815Sopenharmony_ciassert (i === 10); 136425bb815Sopenharmony_ci 137425bb815Sopenharmony_ci 138425bb815Sopenharmony_ci/* with - switch */ 139425bb815Sopenharmony_ci 140425bb815Sopenharmony_cistr = ''; 141425bb815Sopenharmony_cifor (var i = 0; i < 10; i++) 142425bb815Sopenharmony_ci{ 143425bb815Sopenharmony_ci with ({}) 144425bb815Sopenharmony_ci { 145425bb815Sopenharmony_ci switch (i) 146425bb815Sopenharmony_ci { 147425bb815Sopenharmony_ci case 0: 148425bb815Sopenharmony_ci str += 'A'; 149425bb815Sopenharmony_ci break; 150425bb815Sopenharmony_ci default: 151425bb815Sopenharmony_ci str += 'B'; 152425bb815Sopenharmony_ci continue; 153425bb815Sopenharmony_ci } 154425bb815Sopenharmony_ci 155425bb815Sopenharmony_ci str += 'C'; 156425bb815Sopenharmony_ci } 157425bb815Sopenharmony_ci} 158425bb815Sopenharmony_ciassert (str === 'ACBBBBBBBBB'); 159