| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
package org.mozilla.javascript.tests; |
| 6 |
|
| 7 |
import org.junit.After; |
| 8 |
import org.junit.Before; |
| 9 |
import org.junit.Test; |
| 10 |
import org.mozilla.javascript.Context; |
| 11 |
import org.mozilla.javascript.ContextFactory; |
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
l |
| 16 |
|
| 17 |
public class Bug637811Test { |
| 18 |
private Context cx; |
| 19 |
|
| 20 |
@Before |
| 21 |
public void setUp() throws Exception { |
| 22 |
cx = new ContextFactory() { |
| 23 |
@Override |
| 24 |
protected boolean hasFeature(Context cx, int featureIndex) { |
| 25 |
switch (featureIndex) { |
| 26 |
case Context.FEATURE_STRICT_MODE: |
| 27 |
case Context.FEATURE_WARNING_AS_ERROR: |
| 28 |
return true; |
| 29 |
} |
| 30 |
return super.hasFeature(cx, featureIndex); |
| 31 |
} |
| 32 |
}.enterContext(); |
| 33 |
} |
| 34 |
|
| 35 |
@After |
| 36 |
public void tearDown() throws Exception { |
| 37 |
Context.exit(); |
| 38 |
} |
| 39 |
|
| 40 |
@Test |
| 41 |
public void test() { |
| 42 |
String source = ""; |
| 43 |
source += "var x = 0;"; |
| 44 |
source += "bar: while (x < 0) { x = x + 1; }"; |
| 45 |
cx.compileString(source, "", 1, null); |
| 46 |
} |
| 47 |
} |