summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/std/env+posixy.myr6
-rw-r--r--lib/testr/testr.myr12
-rw-r--r--mbld/test.myr7
3 files changed, 17 insertions, 8 deletions
diff --git a/lib/std/env+posixy.myr b/lib/std/env+posixy.myr
index 7ee9e43..a5c25b4 100644
--- a/lib/std/env+posixy.myr
+++ b/lib/std/env+posixy.myr
@@ -69,11 +69,13 @@ const setenv = {name, val
idx++
;;
;;
- if !found
+ if found
+ std.slfree(cstrconvp(environ[idx]))
+ else
idx = env.len - 1
std.slpush(&environ, Zenvp)
;;
- e = cstrconvp(environ[idx])
+ environ[idx] = (e : byte#)
sys.__cenvp = (environ : byte##)
unlock(envlck)
}
diff --git a/lib/testr/testr.myr b/lib/testr/testr.myr
index bbb99fe..9d8c55f 100644
--- a/lib/testr/testr.myr
+++ b/lib/testr/testr.myr
@@ -149,21 +149,21 @@ const benchspec = {ts, sub
const testspec = {ts, sub
var ctx : ctx
- var dorun, jmpbuf
+ var jmpbuf
ctx.ok = true
ctx.reason = ""
ctx.jmpbuf = &jmpbuf
- dorun = matchtest(ts.name, sub)
+ if !matchtest(ts.name, sub)
+ -> void
+ ;;
std.put("test {} <<{{!\n", ts.name)
- if !std.setjmp(&jmpbuf) && dorun
+ if !std.setjmp(&jmpbuf)
ts.fn(&ctx)
;;
- if !dorun
- std.put("!}}>> skip filtered\n")
- elif ctx.ok
+ if ctx.ok
std.put("!}}>> ok\n")
else
std.put("!}}>> fail {}\n", ctx.reason)
diff --git a/mbld/test.myr b/mbld/test.myr
index e199d20..cc9a304 100644
--- a/mbld/test.myr
+++ b/mbld/test.myr
@@ -78,6 +78,13 @@ const runtest = {b, n, targs, isbench, failed
dir = std.pathcat(b.basedir, n.wdir)
std.chdir(dir)
std.slfree(dir)
+
+ if targs.len > 0
+ match std.strfind(targs[0], ":")
+ | `std.Some i: std.setenv("MTEST_SUBSET", targs[0][i+1:])
+ | `std.None: /* ok */
+ ;;
+ ;;
match std.spork(n.cmd)
| `std.Err m:
std.fatal("\nunable to run test: {}\n", m)