From c80a4241a4651293cdd25fbd4cc1bf1ddb6c5202 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Wed, 2 Feb 2022 00:48:33 -0500 Subject: internal/feed/meta_test.go: test lastModifiedDate and scanner.Err() --- internal/feed/meta_test.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/feed/meta_test.go b/internal/feed/meta_test.go index 640926c..7c61dd1 100644 --- a/internal/feed/meta_test.go +++ b/internal/feed/meta_test.go @@ -88,11 +88,17 @@ sha256:B86258D5D9861507A1894A7B92011764803D7267787B1487539E240EA2405440 }) } + longVal := make([]byte, 65536) + for i := 0; i < cap(longVal); i++ { + longVal[i] = 'a' + } + failTests := []struct { val string exp string } { { "asdf", "bad meta line: \"asdf\"" }, + { "lastModifiedDate:asdf", "parsing time \"asdf\" as \"2006-01-02T15:04:05Z07:00\": cannot parse \"asdf\" as \"2006\"" }, { "size:a", "invalid size: \"a\"" }, { "zipSize:a", "invalid zipSize: \"a\"" }, { "gzSize:a", "invalid gzSize: \"a\"" }, @@ -101,6 +107,7 @@ sha256:B86258D5D9861507A1894A7B92011764803D7267787B1487539E240EA2405440 val: "sha256:0z00000000000000000000000000000000000000000000000000000000000000", exp: "invalid sha256 hash: encoding/hex: invalid byte: U+007A 'z'", }, + { string(longVal), "bufio.Scanner: token too long" }, { "foo:bar", "unknown key: \"foo\"" }, } -- cgit v1.2.3