From e20053b796f9601bbae36096f4a0c511418d4d3c Mon Sep 17 00:00:00 2001 From: Rob Findley Date: Tue, 15 Sep 2020 22:08:45 -0400 Subject: [PATCH] gopls/internal/regtest: remove ExpectNow ExpectNow was surpassed by OnceMet, which serves the same purpose but is atomic. Since it's no longer used, remove it. Change-Id: I8ae6c54c2e558e57ba17d2ff7917994c9a80b234 Reviewed-on: https://go-review.googlesource.com/c/tools/+/255125 Run-TryBot: Robert Findley TryBot-Result: Go Bot gopls-CI: kokoro Reviewed-by: Rebecca Stambler Trust: Rebecca Stambler Trust: Robert Findley --- gopls/internal/regtest/env.go | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/gopls/internal/regtest/env.go b/gopls/internal/regtest/env.go index 069a95df08..d53abc0893 100644 --- a/gopls/internal/regtest/env.go +++ b/gopls/internal/regtest/env.go @@ -240,28 +240,6 @@ func (e *Env) checkConditionsLocked() { } } -// ExpectNow asserts that the current state of the editor matches the given -// expectations. -// -// It can be used together with Env.Await to allow waiting on -// simple expectations, followed by more detailed expectations tested by -// ExpectNow. For example: -// -// env.RegexpReplace("foo.go", "a", "x") -// env.Await(env.AnyDiagnosticAtCurrentVersion("foo.go")) -// env.ExpectNow(env.DiagnosticAtRegexp("foo.go", "x")) -// -// This has the advantage of not timing out if the diagnostic received for -// "foo.go" does not match the expectation: instead it fails early. -func (e *Env) ExpectNow(expectations ...Expectation) { - e.T.Helper() - e.mu.Lock() - defer e.mu.Unlock() - if verdict, summary, _ := checkExpectations(e.state, expectations); verdict != Met { - e.T.Fatalf("expectations unmet:\n%s\ncurrent state:\n%v", summary, e.state) - } -} - // checkExpectations reports whether s meets all expectations. func checkExpectations(s State, expectations []Expectation) (Verdict, string, []interface{}) { finalVerdict := Met