Lines
100 %
Functions
Branches
//! Tests for `emit_box_cell` (moved out of `boxing.rs` per CLAUDE.md's
//! file-size guideline).
use super::*;
use crate::compiler::context::CompileContext;
/// ADR-0033: a `Bool` car boxes identically whether its cell is typed
/// `PairElement::Bool` or the widened `PairElement::AnyRef` — both go
/// through `box_bool` (`ref.null` / the `$t` singleton), never an i31.
/// Pins the "no rebuild needed on widening" invariant at the byte level.
#[test]
fn pair_bool_and_pair_anyref_cells_box_a_bool_identically() {
let ctx = CompileContext::new_with_host_fns(&[]).expect("ctx");
let mut in_bool_cell = FunctionEmitter::new();
emit_box_cell(
&ctx,
&mut in_bool_cell,
PairElement::Bool,
);
let mut in_anyref_cell = FunctionEmitter::new();
&mut in_anyref_cell,
PairElement::AnyRef,
assert_eq!(in_bool_cell.bytes_ref(), in_anyref_cell.bytes_ref());
}