* WIP: sync before merging origin/main * fix: unify using/module + build CLI; add missing helper in runner; build passes; core smokes green; jit any.len string now returns 3 * Apply local changes after merging main; keep docs/phase-15 removed per main; add phase-15.1 docs and tests * Remove legacy docs/phase-15/README.md to align with main * integration: add Core-13 pure CI, tests, and minimal LLVM execute bridge (no docs) (#125) Co-authored-by: Tomoaki <tomoaki@example.com> --------- Co-authored-by: Selfhosting Dev <selfhost@example.invalid> Co-authored-by: Tomoaki <tomoaki@example.com>
24 lines
895 B
Rust
24 lines
895 B
Rust
mod tests {
|
|
use crate::ast::{ASTNode, LiteralValue, Span};
|
|
use crate::mir::{MirCompiler, MirPrinter};
|
|
|
|
#[test]
|
|
fn pure_mode_new_emits_env_box_new() {
|
|
// Enable pure mode
|
|
std::env::set_var("NYASH_MIR_CORE13_PURE", "1");
|
|
// new StringBox("Hello")
|
|
let ast = ASTNode::New {
|
|
class: "StringBox".to_string(),
|
|
arguments: vec![ASTNode::Literal { value: LiteralValue::String("Hello".into()), span: Span::unknown() }],
|
|
type_arguments: vec![],
|
|
span: Span::unknown(),
|
|
};
|
|
let mut c = MirCompiler::new();
|
|
let result = c.compile(ast).expect("compile");
|
|
let dump = MirPrinter::new().print_module(&result.module);
|
|
assert!(dump.contains("extern_call env.box.new"), "expected env.box.new in MIR. dump=\n{}", dump);
|
|
std::env::remove_var("NYASH_MIR_CORE13_PURE");
|
|
}
|
|
}
|
|
|