kunfei 3 лет назад
Родитель
Сommit
82cd8014be
1 измененных файлов с 5 добавлено и 1 удалено
  1. 5 1
      app/src/test/java/io/legado/app/JsTest.kt

+ 5 - 1
app/src/test/java/io/legado/app/JsTest.kt

@@ -41,7 +41,11 @@ class JsTest {
     fun testFor() {
         val context = SCRIPT_ENGINE.getScriptContext(SimpleBindings())
         val scope = SCRIPT_ENGINE.getRuntimeScope(context)
-        Context.enter().evaluateString(scope, printJs, "print", 1, null)
+        try {
+            Context.enter().evaluateString(scope, printJs, "print", 1, null)
+        } finally {
+            Context.exit()
+        }
         @Language("js")
         val jsFor = """
             let result = 0