mirror of
https://github.com/napi-rs/napi-rs.git
synced 2025-12-08 19:56:07 +00:00
20 lines
418 B
JavaScript
20 lines
418 B
JavaScript
const testModule = require('./target/debug/test_module')
|
|
|
|
function testSpawn() {
|
|
console.log('=== Test spawning a future on libuv event loop')
|
|
return testModule.testSpawn()
|
|
}
|
|
|
|
function testThrow() {
|
|
console.log('=== Test throwing from Rust')
|
|
try {
|
|
testModule.testThrow()
|
|
} catch (e) {
|
|
return
|
|
}
|
|
console.error('Expected function to throw an error')
|
|
process.exit(1)
|
|
}
|
|
|
|
testSpawn().then(testThrow)
|