mirror of https://github.com/boa-dev/boa.git
croraf
5 years ago
committed by
GitHub
6 changed files with 28 additions and 20 deletions
@ -0,0 +1,11 @@ |
|||||||
|
#[cfg(test)] |
||||||
|
mod tests; |
||||||
|
|
||||||
|
use crate::{builtins::value::Value, BoaProfiler}; |
||||||
|
|
||||||
|
/// Initialize the `NaN` property on the global object.
|
||||||
|
#[inline] |
||||||
|
pub fn init(global: &Value) { |
||||||
|
let _timer = BoaProfiler::global().start_event("NaN", "init"); |
||||||
|
global.set_field("NaN", Value::from(f64::NAN)); |
||||||
|
} |
@ -0,0 +1,10 @@ |
|||||||
|
use crate::exec; |
||||||
|
|
||||||
|
#[test] |
||||||
|
fn nan_exists_on_global_object_and_evaluates_to_nan_value() { |
||||||
|
let scenario = r#" |
||||||
|
NaN; |
||||||
|
"#; |
||||||
|
|
||||||
|
assert_eq!(&exec(scenario), "NaN"); |
||||||
|
} |
Loading…
Reference in new issue