diff --git a/tests/src/test/java/org/mozilla/javascript/tests/StackTraceTest.java b/tests/src/test/java/org/mozilla/javascript/tests/StackTraceTest.java index 5abf43c1ae..04afb945fb 100644 --- a/tests/src/test/java/org/mozilla/javascript/tests/StackTraceTest.java +++ b/tests/src/test/java/org/mozilla/javascript/tests/StackTraceTest.java @@ -119,7 +119,7 @@ public void failureStackTraceV8() { private static void runWithExpectedStackTrace( final String _source, final String _expectedStackTrace) { - Utils.runWithOptimizationLevel( + Utils.runWithMode( cx -> { final Scriptable scope = cx.initStandardObjects(); try { @@ -130,6 +130,6 @@ private static void runWithExpectedStackTrace( } throw new RuntimeException("Exception expected!"); }, - -1); + true); } } diff --git a/tests/src/test/java/org/mozilla/javascript/tests/es6/NumericSeparatorTest.java b/tests/src/test/java/org/mozilla/javascript/tests/es6/NumericSeparatorTest.java index 50b9a38fce..0ba3407e5a 100644 --- a/tests/src/test/java/org/mozilla/javascript/tests/es6/NumericSeparatorTest.java +++ b/tests/src/test/java/org/mozilla/javascript/tests/es6/NumericSeparatorTest.java @@ -22,7 +22,7 @@ public void numericAtEndOneDigit() { /** Special Tokenizer test for numeric constant at end. */ @Test public void numericAtEndManyDigits() { - Utils.runWithOptimizationLevel( + Utils.runWithMode( cx -> { cx.setLanguageVersion(Context.VERSION_ES6); ScriptableObject scope = cx.initStandardObjects(); @@ -32,10 +32,10 @@ public void numericAtEndManyDigits() { return null; }, - -1); + true); // the byte code generator adds a cast to integer - Utils.runWithOptimizationLevel( + Utils.runWithMode( cx -> { cx.setLanguageVersion(Context.VERSION_ES6); ScriptableObject scope = cx.initStandardObjects(); @@ -45,19 +45,7 @@ public void numericAtEndManyDigits() { return null; }, - 0); - - Utils.runWithOptimizationLevel( - cx -> { - cx.setLanguageVersion(Context.VERSION_ES6); - ScriptableObject scope = cx.initStandardObjects(); - - Object result = cx.evaluateString(scope, "1234", "test", 1, null); - assertEquals(1234, result); - - return null; - }, - 1); + false); } /** Special Tokenizer test for numeric separator constant at end. */ diff --git a/testutils/src/main/java/org/mozilla/javascript/tests/Utils.java b/testutils/src/main/java/org/mozilla/javascript/tests/Utils.java index a70b8e0c1a..029df4216e 100644 --- a/testutils/src/main/java/org/mozilla/javascript/tests/Utils.java +++ b/testutils/src/main/java/org/mozilla/javascript/tests/Utils.java @@ -52,30 +52,11 @@ public static void runWithAllOptimizationLevels( runWithMode(contextFactory, action, true); } - /** Runs the provided action at the given optimization level */ - public static void runWithOptimizationLevel( - final ContextAction action, final int optimizationLevel) { - runWithOptimizationLevel(new ContextFactory(), action, optimizationLevel); - } - /** Runs the provided action at the given interpretation mode */ public static void runWithMode(final ContextAction action, final boolean interpretedMode) { runWithMode(new ContextFactory(), action, interpretedMode); } - /** Runs the provided action at the given optimization level */ - @SuppressWarnings("deprecation") - public static void runWithOptimizationLevel( - final ContextFactory contextFactory, - final ContextAction action, - final int optimizationLevel) { - - try (final Context cx = contextFactory.enterContext()) { - cx.setOptimizationLevel(optimizationLevel); - action.run(cx); - } - } - /** Runs the provided action at the given interpretation mode */ public static void runWithMode( final ContextFactory contextFactory,