]> Cypherpunks.ru repositories - gostls13.git/commitdiff
testing: correct comments on runCleanup
authorEvan Jones <ej@evanjones.ca>
Tue, 31 Oct 2023 13:04:15 +0000 (09:04 -0400)
committerGopher Robot <gobot@golang.org>
Mon, 6 Nov 2023 18:01:18 +0000 (18:01 +0000)
The comment on runCleanup states "If catchPanic is true ...", but
there is no catchPanic argument or variable. This was introduced
in CL 214822, which introduced the panicHandling type. The code was
updated during code review, but the comment was missed.

Change-Id: Id14c5397e7a026bfdf98ea10ecb1e4c61ce2f924
Reviewed-on: https://go-review.googlesource.com/c/go/+/538695
Auto-Submit: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
src/testing/testing.go

index 6e277a40f93caebd936145385ea1b63d57bcac3f..a137fae890fac5519a32c51bf8d3497b56a84dee 100644 (file)
@@ -1306,7 +1306,7 @@ func (c *common) Setenv(key, value string) {
        }
 }
 
-// panicHanding is an argument to runCleanup.
+// panicHanding controls the panic handling used by runCleanup.
 type panicHandling int
 
 const (
@@ -1315,8 +1315,8 @@ const (
 )
 
 // runCleanup is called at the end of the test.
-// If catchPanic is true, this will catch panics, and return the recovered
-// value if any.
+// If ph is recoverAndReturnPanic, it will catch panics, and return the
+// recovered value if any.
 func (c *common) runCleanup(ph panicHandling) (panicVal any) {
        c.cleanupStarted.Store(true)
        defer c.cleanupStarted.Store(false)