1
0
Fork 0
mirror of https://github.com/gocsaf/csaf.git synced 2025-12-22 11:55:40 +01:00

Advisories: Time filter download by 'updated' field in ROLIE entries. (#519)

* Use 'updated' field of ROLIE field entries to time filter downloads.

* More suited variable naming
This commit is contained in:
Sascha L. Teichmann 2023-12-04 11:31:14 +01:00 committed by GitHub
parent 9073a8a282
commit 03e418182d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 2 additions and 40 deletions

View file

@ -173,27 +173,3 @@ func TestTimeRangeIntersects(t *testing.T) {
}
}
}
// TestTimeRangeYear checks if the Year construction works.
func TestTimeRangeYear(t *testing.T) {
var (
year = Year(1984)
first = time.Date(1984, time.January, 1, 0, 0, 0, 0, time.UTC)
before = first.Add(-time.Nanosecond)
after = time.Date(1984+1, time.January, 1, 0, 0, 0, 0, time.UTC)
last = after.Add(-time.Nanosecond)
)
for _, x := range []struct {
t time.Time
expected bool
}{
{t: first, expected: true},
{t: before, expected: false},
{t: last, expected: true},
{t: after, expected: false},
} {
if got := year.Contains(x.t); got != x.expected {
t.Fatalf("%v: got %t expected %t", x.t, got, x.expected)
}
}
}