Files
oxc-project__oxc/crates/oxc_minifier/tests/ecmascript/to_boolean.rs
overlookmotel b7cd88dcd6 refactor(minifier): switch to new AstBuilder (#23832)
Part of #23043. Migrate `oxc_minifier` over to new `AstBuilder`.
2026-06-26 18:17:30 +00:00

23 lines
724 B
Rust

use oxc_allocator::Allocator;
use oxc_ast::{ast::Expression, builder::AstBuilder};
use oxc_ecmascript::ToBoolean;
use oxc_span::SPAN;
use super::GlobalReferenceInformation;
#[test]
fn test() {
let allocator = Allocator::default();
let ast = AstBuilder::new(&allocator);
let ast = *
let undefined = Expression::new_identifier(SPAN, "undefined", ast);
let shadowed_undefined_bool =
undefined.to_boolean(&GlobalReferenceInformation { is_undefined_shadowed: true });
let global_undefined_bool =
undefined.to_boolean(&GlobalReferenceInformation { is_undefined_shadowed: false });
assert_eq!(shadowed_undefined_bool, None);
assert_eq!(global_undefined_bool, Some(false));
}