优化
This commit is contained in:
1 parent
f3d70f440b
commit
ca48b949de
11 files changed
+20
-26
No files matched your search
@@ -1,7 +1,7 @@
|
||||
package io.legado.app
|
||||
|
||||
import com.script.SimpleBindings
|
||||
import com.script.rhino.RhinoScriptEngine
|
||||
import io.legado.app.constant.SCRIPT_ENGINE
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
@@ -19,13 +19,12 @@ class ExampleUnitTest {
|
||||
|
||||
@Test
|
||||
fun jsTest() {
|
||||
val scriptEngine = RhinoScriptEngine()
|
||||
val map = hashMapOf("id" to "3242532321")
|
||||
map["id"] = "12314123"
|
||||
val bindings = SimpleBindings()
|
||||
bindings["result"] = map
|
||||
val js = "$=result;id=$.id;id"
|
||||
val result = scriptEngine.eval(js, bindings)?.toString()
|
||||
val result = SCRIPT_ENGINE.eval(js, bindings)?.toString()
|
||||
assertEquals("12314123", result)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user