internal/history: catch empty non-nil fix summaries in TestReleases
When there are no security fixes (or no bug fixes) in a given release, it's represented with a nil *FixSummary. Since it also may reasonably be represented with an empty FixSummary, add a test to enforce one of the two possible styles is consistently chosen. The template handles an empty non-nil *FixSummary as a very generic "there were some fixes" text, which is never what we want. Change-Id: I96ac7cdf37ec7a8406f31500024150df422730bb Reviewed-on: https://go-review.googlesource.com/c/website/+/603495 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Родитель
a87187696e
Коммит
6dc5e9bfb6
|
@ -38,11 +38,17 @@ func TestReleases(t *testing.T) {
|
|||
}
|
||||
lastMinor[major] = r.Version.Z
|
||||
if r.Security != nil {
|
||||
if s := r.Security; s.Quantifier == "" && len(s.Components) == 0 && len(s.Packages) == 0 {
|
||||
t.Errorf("version %v security fix summary is included (non-nil) but summarizes zero security fixes", r.Version)
|
||||
}
|
||||
if p := r.Security.Packages; !sort.StringsAreSorted(p) {
|
||||
t.Errorf("version %v security fix packages out of order: %v vs %v", r.Version, p, sorted(p))
|
||||
}
|
||||
}
|
||||
if r.Bug != nil {
|
||||
if b := r.Bug; b.Quantifier == "" && len(b.Components) == 0 && len(b.Packages) == 0 {
|
||||
t.Errorf("version %v bug fix summary is included (non-nil) but summarizes zero bug fixes", r.Version)
|
||||
}
|
||||
if p := r.Bug.Packages; !sort.StringsAreSorted(p) {
|
||||
t.Errorf("version %v bug fix packages out of order: %v vs %v", r.Version, p, sorted(p))
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче