mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
tests from #15139
This commit is contained in:
parent
83c9714fb2
commit
dfdd032da1
2 changed files with 16 additions and 3 deletions
|
@ -30,6 +30,7 @@ fn basic() {
|
|||
.arg("--allow-read")
|
||||
.arg("--unstable")
|
||||
.arg("--quiet")
|
||||
.arg(r#"--v8-flags=--allow-natives-syntax"#)
|
||||
.arg("tests/test.js")
|
||||
.env("NO_COLOR", "1")
|
||||
.output()
|
||||
|
@ -62,6 +63,7 @@ fn basic() {
|
|||
true\n\
|
||||
579\n\
|
||||
579\n\
|
||||
579\n\
|
||||
8589934590n\n\
|
||||
-8589934590n\n\
|
||||
8589934590n\n\
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Run using cargo test or `--v8-options=--allow-natives-syntax`
|
||||
|
||||
import { assertThrows } from "../../test_util/std/testing/asserts.ts";
|
||||
|
||||
const targetDir = Deno.execPath().replace(/[^\/\\]+$/, "");
|
||||
|
@ -182,8 +184,9 @@ const dylib = Deno.dlopen(libPath, {
|
|||
type: "pointer",
|
||||
},
|
||||
});
|
||||
const { symbols } = dylib;
|
||||
|
||||
dylib.symbols.printSomething();
|
||||
symbols.printSomething();
|
||||
const buffer = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]);
|
||||
const buffer2 = new Uint8Array([9, 10]);
|
||||
dylib.symbols.print_buffer(buffer, buffer.length);
|
||||
|
@ -238,7 +241,15 @@ const before = performance.now();
|
|||
await sleepNonBlocking.call(100);
|
||||
console.log(performance.now() - before >= 100);
|
||||
|
||||
console.log(dylib.symbols.add_u32(123, 456));
|
||||
const { add_u32 } = symbols;
|
||||
function addU32Fast(a, b) {
|
||||
return add_u32(a, b);
|
||||
};
|
||||
|
||||
%PrepareFunctionForOptimization(addU32Fast);
|
||||
console.log(addU32Fast(123, 456));
|
||||
%OptimizeFunctionOnNextCall(addU32Fast);
|
||||
console.log(addU32Fast(123, 456));
|
||||
|
||||
console.log(dylib.symbols.add_i32(123, 456));
|
||||
console.log(dylib.symbols.add_u64(0xffffffffn, 0xffffffffn));
|
||||
|
@ -448,4 +459,4 @@ After: ${postStr}`,
|
|||
}
|
||||
|
||||
console.log("Correct number of resources");
|
||||
})();
|
||||
})();
|
Loading…
Reference in a new issue