File tree 2 files changed +19
-3
lines changed
gopls/internal/regtest/diagnostics
2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -1618,7 +1618,6 @@ import _ "mod.com/triple/a"
1618
1618
// Tests golang/go#46667: deleting a problematic import path should resolve
1619
1619
// import cycle errors.
1620
1620
func TestResolveImportCycle (t * testing.T ) {
1621
- t .Skip ("flaky test: see golang/go#46773" )
1622
1621
const mod = `
1623
1622
-- go.mod --
1624
1623
module mod.test
@@ -1646,8 +1645,8 @@ const B = a.B
1646
1645
env .RegexpReplace ("b/b.go" , `const B = a\.B` , "" )
1647
1646
env .SaveBuffer ("b/b.go" )
1648
1647
env .Await (
1649
- EmptyDiagnostics ("a/a.go" ),
1650
- EmptyDiagnostics ("b/b.go" ),
1648
+ EmptyOrNoDiagnostics ("a/a.go" ),
1649
+ EmptyOrNoDiagnostics ("b/b.go" ),
1651
1650
)
1652
1651
})
1653
1652
}
Original file line number Diff line number Diff line change @@ -533,6 +533,23 @@ func EmptyDiagnostics(name string) Expectation {
533
533
}
534
534
}
535
535
536
+ // EmptyOrNoDiagnostics asserts that either no diagnostics are sent for the
537
+ // workspace-relative path name, or empty diagnostics are sent.
538
+ // TODO(rFindley): this subtlety shouldn't be necessary. Gopls should always
539
+ // send at least one diagnostic set for open files.
540
+ func EmptyOrNoDiagnostics (name string ) Expectation {
541
+ check := func (s State ) Verdict {
542
+ if diags := s .diagnostics [name ]; len (diags .Diagnostics ) == 0 {
543
+ return Met
544
+ }
545
+ return Unmet
546
+ }
547
+ return SimpleExpectation {
548
+ check : check ,
549
+ description : fmt .Sprintf ("empty or no diagnostics for %q" , name ),
550
+ }
551
+ }
552
+
536
553
// NoDiagnostics asserts that no diagnostics are sent for the
537
554
// workspace-relative path name. It should be used primarily in conjunction
538
555
// with a OnceMet, as it has to check that all outstanding diagnostics have
You can’t perform that action at this time.
0 commit comments