Skip to content

Commit f6df509

Browse files
committed
feature FEATURE_HTMLUNIT_FUNCTION_DECLARED_FORWARD_IN_BLOCK is gone
1 parent e1fc865 commit f6df509

File tree

1 file changed

+3
-39
lines changed

1 file changed

+3
-39
lines changed

src/test/java/org/htmlunit/corejs/ScriptRuntimeTest.java

+3-39
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import org.htmlunit.corejs.javascript.Context;
66
import org.htmlunit.corejs.javascript.ContextAction;
7-
import org.htmlunit.corejs.javascript.ContextFactory;
87
import org.htmlunit.corejs.javascript.Scriptable;
98
import org.junit.jupiter.api.Test;
109

@@ -31,9 +30,7 @@ public void functionDeclaredForwardInBlock() {
3130
+ "var output = '';\n"
3231
+ "test();\n"
3332
+ "output";
34-
final int feature = Context.FEATURE_HTMLUNIT_FUNCTION_DECLARED_FORWARD_IN_BLOCK;
35-
test(script, "exception", feature, false);
36-
test(script, "function foo() {}", feature, true);
33+
test(script, "function foo() {}");
3734
}
3835

3936
@Test
@@ -52,9 +49,7 @@ public void functionDeclaredForwardInBlockAsVar() {
5249
+ "var output = '';\n"
5350
+ "test();\n"
5451
+ "output";
55-
final int feature = Context.FEATURE_HTMLUNIT_FUNCTION_DECLARED_FORWARD_IN_BLOCK;
56-
test(script, "undefined", feature, false);
57-
test(script, "undefined", feature, true);
52+
test(script, "undefined");
5853
}
5954

6055
@Test
@@ -70,38 +65,7 @@ public void functionDeclaredForwardInBlock2() {
7065
+ " function foo() {}\n"
7166
+ "}\n"
7267
+ "output";
73-
final int feature = Context.FEATURE_HTMLUNIT_FUNCTION_DECLARED_FORWARD_IN_BLOCK;
74-
test(script, "exception", feature, false);
75-
test(script, "function foo() {}", feature, true);
76-
}
77-
78-
private static void test(final String script, final Object expected,
79-
final int feature, final boolean featureValue) {
80-
final ContextFactory cf = new ContextFactory() {
81-
@Override
82-
protected boolean hasFeature(Context cx, int featureIndex) {
83-
if (featureIndex == feature) {
84-
return featureValue;
85-
}
86-
return super.hasFeature(cx, featureIndex);
87-
}
88-
};
89-
90-
final ContextAction<Object> action = new ContextAction<Object>() {
91-
@Override
92-
public Object run(final Context cx) {
93-
try {
94-
Scriptable scope = cx.initSafeStandardObjects();
95-
final Object o = cx.evaluateString(scope, script, "test_script", 1, null);
96-
assertEquals(expected, o);
97-
return o;
98-
} catch (final Exception e) {
99-
throw new RuntimeException(e);
100-
}
101-
}
102-
};
103-
104-
Utils.runWithOptimizationLevel(cf, action, -1);
68+
test(script, "function foo() {}");
10569
}
10670

10771
@Test

0 commit comments

Comments
 (0)