use javascript::evaluate_script;
#[ctor::ctor(unsafe)]
fn __init_test_logger() {
let _ = env_logger::Builder::from_env(env_logger::Env::default()).is_test(true).try_init();
}
#[test]
fn bigint_global_and_prototype_to_string_value_of() {
let r1 = evaluate_script("BigInt('123')", false, None::<&std::path::Path>);
match r1 {
Ok(h) => assert_eq!(h, "123"),
other => panic!("expected BigInt result for BigInt('123'), got {:?}", other),
}
let r2 = evaluate_script("BigInt(42)", false, None::<&std::path::Path>);
match r2 {
Ok(h) => assert_eq!(h, "42"),
other => panic!("expected BigInt result for BigInt(42), got {:?}", other),
}
let r3 = evaluate_script("String(123n)", false, None::<&std::path::Path>);
match r3 {
Ok(h) => assert_eq!(h, "\"123\""),
other => panic!("expected string result for String(123n), got {:?}", other),
}
let r4 = evaluate_script("BigInt(7) === 7n", false, None::<&std::path::Path>);
match r4 {
Ok(h) => assert_eq!(h, "true"),
other => panic!("expected boolean result for BigInt(7) === 7n, got {:?}", other),
}
let r5 = evaluate_script("Object(123n).toString()", false, None::<&std::path::Path>);
match r5 {
Ok(h) => assert_eq!(h, "\"123\""),
other => panic!("expected string result for Object(123n).toString(), got {:?}", other),
}
let r6 = evaluate_script("Object(7n).valueOf() === 7n", false, None::<&std::path::Path>);
match r6 {
Ok(h) => assert_eq!(h, "true"),
other => panic!("expected boolean result for Object(7n).valueOf() === 7n, got {:?}", other),
}
}