mirror of
https://github.com/micropython/micropython.git
synced 2025-12-16 01:40:14 +01:00
tests/ports/webassembly: Move JsProxy identity test to separate file.
This test is not a PyProxy test, rather it's a JsProxy test. Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
18
tests/ports/webassembly/js_proxy_identity.mjs
Normal file
18
tests/ports/webassembly/js_proxy_identity.mjs
Normal file
@@ -0,0 +1,18 @@
|
||||
// Test identity of JsProxy when they are the same JavaScript object.
|
||||
|
||||
const mp = await (await import(process.argv[2])).loadMicroPython();
|
||||
|
||||
mp.runPython(`
|
||||
import js
|
||||
|
||||
print(js.Object)
|
||||
|
||||
print("Object equality")
|
||||
print(js.Object == js.Object)
|
||||
print(js.Object.assign == js.Object.assign)
|
||||
|
||||
print("Array equality")
|
||||
print(js.Array == js.Array)
|
||||
print(js.Array.prototype == js.Array.prototype)
|
||||
print(js.Array.prototype.push == js.Array.prototype.push)
|
||||
`);
|
||||
8
tests/ports/webassembly/js_proxy_identity.mjs.exp
Normal file
8
tests/ports/webassembly/js_proxy_identity.mjs.exp
Normal file
@@ -0,0 +1,8 @@
|
||||
<JsProxy 2>
|
||||
Object equality
|
||||
True
|
||||
True
|
||||
Array equality
|
||||
True
|
||||
True
|
||||
True
|
||||
@@ -23,13 +23,4 @@ js.eventTarget.addEventListener("event", callback)
|
||||
js.eventTarget.dispatchEvent(js.event)
|
||||
js.eventTarget.removeEventListener("event", callback)
|
||||
js.eventTarget.dispatchEvent(js.event)
|
||||
|
||||
print("Object equality")
|
||||
print(js.Object == js.Object)
|
||||
print(js.Object.assign == js.Object.assign)
|
||||
|
||||
print("Array equality")
|
||||
print(js.Array == js.Array)
|
||||
print(js.Array.prototype == js.Array.prototype)
|
||||
print(js.Array.prototype.push == js.Array.prototype.push)
|
||||
`);
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
PyProxy { _ref: 3 } PyProxy { _ref: 3 }
|
||||
true
|
||||
callback <JsProxy 5>
|
||||
Object equality
|
||||
True
|
||||
True
|
||||
Array equality
|
||||
True
|
||||
True
|
||||
True
|
||||
|
||||
Reference in New Issue
Block a user