-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add out of range date test case
- Loading branch information
Showing
6 changed files
with
26 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
use std::mem::MaybeUninit; | ||
use nodejs_sys as napi; | ||
use raw::{Env, Local}; | ||
use crate::napi::bindings as napi; | ||
use crate::raw::{Env, Local}; | ||
|
||
pub unsafe fn new_date(env: Env, value: f64) -> Local { | ||
let mut local = MaybeUninit::zeroed(); | ||
let status = napi::napi_create_date(env, value, local.as_mut_ptr()); | ||
assert_eq!(status, napi::napi_status::napi_ok); | ||
let status = napi::create_date(env, value, local.as_mut_ptr()); | ||
assert_eq!(status, napi::Status::Ok); | ||
local.assume_init() | ||
} | ||
|
||
pub unsafe fn value(env: Env, p: Local) -> f64 { | ||
let mut value = 0.0; | ||
let status = napi::napi_get_date_value(env, p, &mut value as *mut _); | ||
assert_eq!(status, napi::napi_status::napi_ok); | ||
let status = napi::get_date_value(env, p, &mut value as *mut _); | ||
assert_eq!(status, napi::Status::Ok); | ||
return value; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters