4b446a0efc
This change required refactoring nearly every package in this project, but it does a lot to simplify mctx and make other code using it easier to think about. Other code, such as mlog and mcfg, had to be slightly modified for this change to work as well.
19 lines
341 B
Go
19 lines
341 B
Go
package mtest
|
|
|
|
import (
|
|
. "testing"
|
|
|
|
"github.com/mediocregopher/mediocre-go-lib/mcfg"
|
|
)
|
|
|
|
func TestRun(t *T) {
|
|
ctx := NewCtx()
|
|
ctx, arg := mcfg.RequiredString(ctx, "arg", "Required by this test")
|
|
ctx = SetEnv(ctx, "ARG", "foo")
|
|
Run(ctx, t, func() {
|
|
if *arg != "foo" {
|
|
t.Fatalf(`arg not set to "foo", is set to %q`, *arg)
|
|
}
|
|
})
|
|
}
|