From 03eeaa9656027514113e7cd3dc2906255ee23963 Mon Sep 17 00:00:00 2001 From: Roger Peppe Date: Fri, 17 Jan 2020 09:06:13 +0000 Subject: [PATCH] testing: clarify that Cleanup is run after subtests complete. It's good to be explicit, as it's not necessarily obvious (and indeed the behavior has changed recently with https://go-review.googlesource.com/c/go/+/214822) without an associated doc comment change). Change-Id: I99d6398bf15b404b1b1b196e712e926e363251e9 Reviewed-on: https://go-review.googlesource.com/c/go/+/215217 Reviewed-by: Paul Jolly Reviewed-by: Ian Lance Taylor --- src/testing/testing.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/testing/testing.go b/src/testing/testing.go index a875fe145f..030feb7112 100644 --- a/src/testing/testing.go +++ b/src/testing/testing.go @@ -776,9 +776,9 @@ func (c *common) Helper() { c.helpers[callerName(1)] = struct{}{} } -// Cleanup registers a function to be called when the test finishes. -// Cleanup functions will be called in last added, first called -// order. +// Cleanup registers a function to be called when the test and all its +// subtests complete. Cleanup functions will be called in last added, +// first called order. func (c *common) Cleanup(f func()) { c.mu.Lock() defer c.mu.Unlock() -- 2.50.0