lib/dirs: rows skip loudly when WW_TEST_TMPDIR is absent
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
// dirstest — exercises lib/dirs against an env state pre-arranged by
|
||||
// the C driver (test/wcc/975_dirs_run.c).
|
||||
// dirstest — exercises lib/dirs against an arranged env cohort. The
|
||||
// XDG rows need env control ww cannot self-arrange (no setenv,
|
||||
// deliberately), so every row skips loudly when WW_TEST_TMPDIR is
|
||||
// absent and the suite passes bare; the arranged leg (env cohort
|
||||
// below constructed per row over a scratch HOME, rows asserted `ok`,
|
||||
// not SKIP) is test/libenv/libenv_test.ww.
|
||||
//
|
||||
// Pre-arranged env (set via setenv/unsetenv before exec'ing
|
||||
// `ww run lib/dirs/dirstest.ww`; see 975_dirs_run.c):
|
||||
// Arranged env cohort:
|
||||
//
|
||||
// HOME = <tmpl> (mkdtemp'd /tmp/wwdirs-XXXXXX)
|
||||
// HOME = <tmpl> (fresh scratch dir)
|
||||
// XDG_CONFIG_HOME = <tmpl>/cfg (absolute → XDG branch)
|
||||
// XDG_CACHE_HOME = "relative/path" (non-abs → fallback to HOME)
|
||||
// XDG_DATA_HOME unset (fallback to HOME)
|
||||
@@ -36,6 +39,7 @@ package dirs_test;
|
||||
|
||||
import dirs;
|
||||
import os;
|
||||
import test;
|
||||
|
||||
|
||||
|
||||
@@ -83,11 +87,8 @@ fn expected(tmpl: str, sub: str, prog: str) str = {
|
||||
fn gettmpdir() str = {
|
||||
match (os.getenv("WW_TEST_TMPDIR")) {
|
||||
case let s: str => return s;
|
||||
case void => {
|
||||
abort();
|
||||
let empty: str;
|
||||
return empty;
|
||||
};
|
||||
case void =>
|
||||
test.skip("WW_TEST_TMPDIR unset (arranged leg: test/libenv)");
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user