feat: test script

This commit is contained in:
2022-07-17 10:48:23 +08:00
parent 6890520435
commit 2d6b1e3a1b

View File

@@ -47,13 +47,16 @@ fn main() -> Result<()> {
|store, module, linker| Exports::instantiate(store, module, linker, |cx| &mut cx.exports), |store, module, linker| Exports::instantiate(store, module, linker, |cx| &mut cx.exports),
)?; )?;
let a = exports.eval_javascript(&mut store, r##" let a = exports.eval_javascript(&mut store, r##"
function hi(name) { return "hi: " + name; }
let a = []; let a = [];
a.push(fetch('https://www.google.com/')); a.push(fetch('https://www.google.com/'));
for (let i = 0; i < 3; i++) { a.push(i); } for (let i = 0; i < 3; i++) { a.push(i); }
a.push({ a.push({
id: 1, name: 'hatter' id: 1, name: 'hatter'
}); });
//JSON.stringify(a) a.push(hi('001'));
a.push(hi('002'));
// JSON.stringify(a)
a a
"##); "##);