✓
Passing This code compiles and runs correctly.
Code
import app/test_lib/selfread
import std/build
import std/io
std/build:app { name: "Regtest App", id: "org.koru.regtest", version: "0.1" }
app/test_lib/selfread:id()
| id s |> std/io:print.ln("embedded: {{ s:s }}")
| none |> std/io:print.ln("missing")
Supporting Files
// PIN: std/build:app { name:, id:, version: } embeds an Info.plist into
// the Mach-O binary — __TEXT,__info_plist is what NSBundle.mainBundle
// reads, so an unbundled binary answers a real CFBundleIdentifier (the
// gate notifications, process identity, and AppKit's app checks key on).
// This module is the oracle: getsectiondata reads the running binary's
// own section; the test passes only if the declared id is present.
const std = @import("std");
extern fn getsectiondata(mhp: *const anyopaque, segname: [*:0]const u8, sectname: [*:0]const u8, size: *c_ulong) ?[*]const u8;
extern var _mh_execute_header: anyopaque;
~pub tor id {}
| id string
| none
~proc id|zig {
var size: c_ulong = 0;
const data = getsectiondata(&_mh_execute_header, "__TEXT", "__info_plist", &size) orelse {
return .{ .none = .{} };
};
if (std.mem.indexOf(u8, data[0..size], "org.koru.regtest") != null) {
return .{ .id = "org.koru.regtest" };
}
return .{ .none = .{} };
}
Actual
embedded: org.koru.regtest
Expected output
embedded: org.koru.regtest
Flows
flow ~app click a branch to expand · @labels scroll to their anchor
app (source: name: "Regtest App", id: "org.koru.regtest", version: "0.1")
flow ~id click a branch to expand · @labels scroll to their anchor
id
Test Configuration
MUST_RUN