chore(napi-derive): make_ref tweaks ()

This commit is contained in:
LongYinan 2022-11-22 23:17:44 +08:00 committed by GitHub
parent 618d0f8046
commit 573f67b90f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 8 additions and 34 deletions

View file

@ -195,7 +195,6 @@ Generated by [AVA](https://avajs.dev).
export function threadsafeFunctionFatalMode(cb: (...args: any[]) => any): void␊
export function threadsafeFunctionFatalModeError(cb: (...args: any[]) => any): void␊
export function threadsafeFunctionClosureCapture(func: (...args: any[]) => any): void␊
export function useTokioWithoutAsync(): void␊
export function getBuffer(): Buffer␊
export function appendBuffer(buf: Buffer): Buffer␊
export function getEmptyBuffer(): Buffer␊

View file

@ -106,7 +106,6 @@ import {
receiveObjectWithClassField,
AnotherClassForEither,
receiveDifferentClass,
useTokioWithoutAsync,
getNumArr,
getNestedNumArr,
CustomFinalize,
@ -754,12 +753,6 @@ Napi4Test('await Promise in rust', async (t) => {
t.is(result, fx + 100)
})
Napi4Test('Run function which uses tokio internally but is not async', (t) => {
useTokioWithoutAsync()
// The prior didn't throw an exception, so it worked.
t.assert(true)
})
Napi4Test('Promise should reject raw error in rust', async (t) => {
const fxError = new Error('What is Happy Planet')
const err = await t.throwsAsync(() => asyncPlus100(Promise.reject(fxError)))

View file

@ -185,7 +185,6 @@ export function threadsafeFunctionThrowError(cb: (...args: any[]) => any): void
export function threadsafeFunctionFatalMode(cb: (...args: any[]) => any): void
export function threadsafeFunctionFatalModeError(cb: (...args: any[]) => any): void
export function threadsafeFunctionClosureCapture(func: (...args: any[]) => any): void
export function useTokioWithoutAsync(): void
export function getBuffer(): Buffer
export function appendBuffer(buf: Buffer): Buffer
export function getEmptyBuffer(): Buffer

View file

@ -40,5 +40,4 @@ mod string;
mod symbol;
mod task;
mod threadsafe_function;
mod tokio_outside_async;
mod typed_array;

View file

@ -1,18 +0,0 @@
use std::time::Duration;
use tokio::{sync::oneshot, time::Instant};
#[napi]
pub fn use_tokio_without_async() {
let (sender, receiver) = oneshot::channel();
let handle = tokio::task::spawn(async {
// If this panics, the test failed.
sender.send(true).unwrap();
});
let start = Instant::now();
while !handle.is_finished() {
if start.elapsed() > Duration::from_secs(5) {
panic!("The future never resolved.");
}
}
assert_eq!(receiver.blocking_recv(), Ok(true));
}