mirror of https://github.com/golang/go.git
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 <rfindley@google.com> TryBot-Result: Go Bot <gobot@golang.org> gopls-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Rebecca Stambler <rstambler@golang.org> Trust: Rebecca Stambler <rstambler@golang.org> Trust: Robert Findley <rfindley@google.com>
This commit is contained in:
parent
797bd0f00c
commit
e20053b796
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue