Skip to content

Commit 041525c

Browse files
committed
fix assert-keep mode
1 parent 4640f46 commit 041525c

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

samples/main.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ var (
1313
mode = flag.String(
1414
"mode",
1515
"play",
16-
"runs the wanted playground: db, play, nil, assert",
16+
"runs the wanted playground: db, play, nil, assert,"+
17+
"\nassert-keep (= uses assert.Debug in GLS)",
1718
)
1819
isErr = flag.Bool("err", false, "tells if we want to have an error")
1920
)
@@ -42,15 +43,15 @@ func main() {
4243
case "play":
4344
doPlayMain()
4445
case "assert":
45-
doAssertMain(false)
46+
doAssertMainKeepGLSAsserter(false)
4647
case "assert-keep":
47-
doAssertMain(true)
48+
doAssertMainKeepGLSAsserter(true)
4849
default:
4950
err2.Throwf("unknown (%v) playground given", *mode)
5051
}
5152
}
5253

53-
func doAssertMain(keep bool) {
54+
func doAssertMainKeepGLSAsserter(keep bool) {
5455
asserterPusher(keep)
5556
asserterTester()
5657
}
@@ -62,7 +63,7 @@ func asserterTester() {
6263

6364
func asserterPusher(keep bool) {
6465
pop := assert.PushAsserter(assert.Debug)
65-
if keep {
66+
if !keep { // if not keep we free
6667
pop()
6768
}
6869
}

0 commit comments

Comments
 (0)