diff options
Diffstat (limited to 'internal/feed/feed_test.go')
-rw-r--r-- | internal/feed/feed_test.go | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/internal/feed/feed_test.go b/internal/feed/feed_test.go deleted file mode 100644 index f31a3ae..0000000 --- a/internal/feed/feed_test.go +++ /dev/null @@ -1,56 +0,0 @@ -package feed - -import ( - "compress/gzip" - "encoding/json" - "io" - // "fmt" - "os" - "testing" -) - -func openTest(path string) (io.Reader, error) { - // open file for reading - file, err := os.Open(path) - if err != nil { - return nil, err - } - - // wrap in reader, return success - return gzip.NewReader(file) -} - -// Test feed parser -func TestFeedParser(t *testing.T) { - t.Run("TestUnmarshalJSON", func(t *testing.T) { - var f Feed - - // read test data, check for error - src, err := openTest("testdata/nvdcve-1.1-2021.json.gz") - if err != nil { - t.Error(err) - } - - // decode cve feed, check for error - d := json.NewDecoder(src) - if err := d.Decode(&f); err != nil { - t.Error(err) - } - }) -// var f Feed -// -// // decode cve feed -// d := json.NewDecoder(os.Stdin) -// if err := d.Decode(&f); err != nil { -// t.Error(err) -// } -// -// var dst bytes.Buffer -// -// // create json encoder -// e := json.NewEncoder(&dst) -// if err := e.Encode(f); err != nil { -// t.Error(err) -// } -} - |