aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Chase <drchase@google.com>2023-05-09 17:23:39 -0400
committerDavid Chase <drchase@google.com>2023-05-10 20:40:05 +0000
commit623ebad6850578a8a51d4d73f6ceab2d7de75fd1 (patch)
tree194cc954915393d5d50e3ecd06b44ed111b3eeed
parent200a01ff5589e2b8eb8cebeb4dcf6469aceaab27 (diff)
downloadgo-623ebad6850578a8a51d4d73f6ceab2d7de75fd1.tar.xz
internal/godebug: make test godebug calls not vary
I think there may be an issue in bisect search with change set elements not actually being independent, to be explored later. For now, modify the test to remove that property. Change-Id: I4b171bc024795d950cf4663374ad1dfc4e2952fc Reviewed-on: https://go-review.googlesource.com/c/go/+/494036 Run-TryBot: David Chase <drchase@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
-rw-r--r--src/internal/godebug/godebug_test.go18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/internal/godebug/godebug_test.go b/src/internal/godebug/godebug_test.go
index 35b12efe9c..8e46283ada 100644
--- a/src/internal/godebug/godebug_test.go
+++ b/src/internal/godebug/godebug_test.go
@@ -100,23 +100,31 @@ func TestCmdBisect(t *testing.T) {
}
// This test does nothing by itself, but you can run
+//
// bisect 'GODEBUG=buggy=1#PATTERN' go test -run=BisectTestCase
+//
// to see that the GODEBUG bisect support is working.
// TestCmdBisect above does exactly that.
func TestBisectTestCase(t *testing.T) {
s := New("#buggy")
for i := 0; i < 10; i++ {
- if s.Value() == "1" {
+ a := s.Value() == "1"
+ b := s.Value() == "1"
+ c := s.Value() == "1" // BISECT BUG
+ d := s.Value() == "1" // BISECT BUG
+ e := s.Value() == "1" // BISECT BUG
+
+ if a {
t.Log("ok")
}
- if s.Value() == "1" {
+ if b {
t.Log("ok")
}
- if s.Value() == "1" { // BISECT BUG
+ if c {
t.Error("bug")
}
- if s.Value() == "1" && // BISECT BUG
- s.Value() == "1" { // BISECT BUG
+ if d &&
+ e {
t.Error("bug")
}
}