// Tests for the comptime `compiler` library's function bridge. const std = @import("std"); const compiler_lib = @import("compiler_lib.zig"); // Lock: the compiler-function export list resolves the round-trip readers and // rejects unexported names (the boundary `weldedCompilerFn` + the interp's // dispatch consult). test "compiler_lib: findFn resolves exported functions, rejects others" { // Seed readers. try std.testing.expect(compiler_lib.findFn("intern") != null); try std.testing.expect(compiler_lib.findFn("text_of") != null); try std.testing.expectEqualStrings("intern", compiler_lib.findFn("intern").?.sx_name); // Phase 3 read-only reflection readers. for ([_][]const u8{ "find_type", "type_field_count", "type_nominal_name", "type_field_name", "type_field_type", "type_kind", "type_field_value" }) |n| { try std.testing.expect(compiler_lib.findFn(n) != null); } // Phase 3 write side. for ([_][]const u8{ "declare_type", "pointer_to", "register_type" }) |n| { try std.testing.expect(compiler_lib.findFn(n) != null); } try std.testing.expect(compiler_lib.findFn("not_exported") == null); try std.testing.expect(compiler_lib.findFn("") == null); }