thread (regex.ha:55-64) and newmatch (ha:66) land verbatim ahead of their engine consumers; result_free (ha:1113-1116) and strerror (ha:1126-1127) complete the exported error/result surface. delete_thread/add_thread deferred behind #15 (append-through-ptr) and #17 (deref-spine element reads); is_consuming_inst deferred behind #19 (>48B tagged by-value call boundary unwired + divergent callee receive) — noted at the Hare-order site. Tests are row-table driven: thread_shape reads back both appended threads against a [2]texp want table (root_capture rows deferred — every read route is compiler-blocked, #6/#7, probed at HEAD); newmatch_discriminates drives one row per (void|newmatch|nomem) member, incl. a nomem-vs-newmatch row; result_free also covers the zero-header empty result (find()'s ha:915-916 no-match shape). Byte-id re-verified on the regenerated combined: the pre-existing FC0 regex.finish hunk is the only divergence.
54 lines
1.5 KiB
C
54 lines
1.5 KiB
C
/*
|
|
* 989_regex_run — execute the lib/regex @test fixture (fold-1 data
|
|
* model + fold-2a compile() + fold-2b tranche-A scaffolding) under
|
|
* the C-side `ww run` driver and assert exit 0.
|
|
*
|
|
* Sibling to 984_base64_run / 989_sha256_run (9xx is full so this
|
|
* shares the 989 prefix — the `short` name keys the binary, cf the
|
|
* 949_* / 989_sha256 precedent). regex_test.ww carries its own
|
|
* `export fn main()` that drives the data-model @test fns and signals
|
|
* which case failed via the exit code, so this file is a thin wrapper
|
|
* — no @test scanning, no synthetic main generation.
|
|
*/
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
#include <sys/wait.h>
|
|
|
|
static int
|
|
runwait(const char *cmd)
|
|
{
|
|
int rc = system(cmd);
|
|
if (rc == -1) return -1;
|
|
if (WIFEXITED(rc)) return WEXITSTATUS(rc);
|
|
return 1;
|
|
}
|
|
|
|
int
|
|
main(void)
|
|
{
|
|
const char *bin = getenv("BIN");
|
|
if (!bin) bin = "out/bin";
|
|
char absbin[1024];
|
|
if (bin[0] != '/') {
|
|
char cwd[1024];
|
|
if (getcwd(cwd, sizeof cwd) == NULL) return 1;
|
|
snprintf(absbin, sizeof absbin, "%s/%s", cwd, bin);
|
|
bin = absbin;
|
|
}
|
|
char cwd[1024];
|
|
if (getcwd(cwd, sizeof cwd) == NULL) return 1;
|
|
|
|
const char *src = "lib/regex/regex_test.ww";
|
|
char path[1024], cmd[2048];
|
|
snprintf(path, sizeof path, "%s/%s", cwd, src);
|
|
snprintf(cmd, sizeof cmd, "%s/ww run %s", bin, path);
|
|
int rc = runwait(cmd);
|
|
if (rc != 0) {
|
|
fprintf(stderr, "regex_run FAIL: %s exited %d\n", src, rc);
|
|
return 1;
|
|
}
|
|
printf("regex_run: %s ok\n", src);
|
|
return 0;
|
|
}
|