root.zig had no `test` block, so the test binary discovered zero tests and trivially "passed" — every src test had silently rotted. Add `refAllDecls(@This())` to root.zig so all 185 tests run, then fix the rot it surfaced: - emit_llvm.test: operands were constants, so LLVM folded the very instructions being asserted (fadd/sub/icmp/insertvalue/extractvalue/sext). Rewrite to use function-parameter operands; `main` now returns i32 (entry convention); tagged-union enum_init lowers via memory, not insertvalue. - interp.test: switch the per-test allocator to an arena (the interpreter is arena-style and intentionally frees little) — clears the transient-Value leaks without an ownership-ambiguous source change. - lower.test: pass `is_imported` to lowerFunction; mark two helpers `pub`; the if/else block test now uses a runtime (param) condition since lowering folds `if true`. - print.test: SSA numbering — params occupy %0/%1, so consts start at %2. - jni_java_emit.test: nested-class refs render in Java source form (`SurfaceHolder.Callback`), not the JNI `$` form. Leaks fixed at the source where ownership was clear: Module gains an arena for the operand slices the Builder dupes (struct/call/branch/switch args, block params, lowerFunction params); objcDefinedStateStructType builds its field slice in that arena and frees its temp name string.
32 lines
1.2 KiB
Zig
32 lines
1.2 KiB
Zig
pub const llvm_api = @import("llvm_api.zig");
|
|
pub const token = @import("token.zig");
|
|
pub const lexer = @import("lexer.zig");
|
|
pub const ast = @import("ast.zig");
|
|
pub const parser = @import("parser.zig");
|
|
pub const types = @import("types.zig");
|
|
pub const target = @import("target.zig");
|
|
pub const builtins = @import("builtins.zig");
|
|
pub const errors = @import("errors.zig");
|
|
pub const errors_tests = @import("errors.test.zig");
|
|
pub const sema = @import("sema.zig");
|
|
pub const imports = @import("imports.zig");
|
|
pub const core = @import("core.zig");
|
|
pub const c_import = @import("c_import.zig");
|
|
pub const ir = @import("ir/ir.zig");
|
|
|
|
pub const lsp = struct {
|
|
pub const server = @import("lsp/server.zig");
|
|
pub const transport = @import("lsp/transport.zig");
|
|
pub const types = @import("lsp/types.zig");
|
|
pub const document = @import("lsp/document.zig");
|
|
};
|
|
|
|
test {
|
|
// Discover every test in the module graph so `zig build test` actually
|
|
// runs them. Without this, the test binary finds no `test` blocks at the
|
|
// root and trivially "passes" while exercising nothing. Nested barrels
|
|
// (e.g. ir/ir.zig) carry their own `test { refAllDecls }`, so this chains
|
|
// into them.
|
|
@import("std").testing.refAllDecls(@This());
|
|
}
|