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:
Damien George
2025-09-01 15:24:02 +10:00
parent f1b00d67e9
commit 24f395b5db
4 changed files with 26 additions and 16 deletions

View 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)
`);

View File

@@ -0,0 +1,8 @@
<JsProxy 2>
Object equality
True
True
Array equality
True
True
True

View File

@@ -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)
`);

View File

@@ -1,10 +1,3 @@
PyProxy { _ref: 3 } PyProxy { _ref: 3 }
true
callback <JsProxy 5>
Object equality
True
True
Array equality
True
True
True