aboutsummaryrefslogtreecommitdiff
path: root/internal/feed/dataformat_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/feed/dataformat_test.go')
-rw-r--r--internal/feed/dataformat_test.go65
1 files changed, 0 insertions, 65 deletions
diff --git a/internal/feed/dataformat_test.go b/internal/feed/dataformat_test.go
deleted file mode 100644
index efb4986..0000000
--- a/internal/feed/dataformat_test.go
+++ /dev/null
@@ -1,65 +0,0 @@
-package feed
-
-import (
- "encoding/json"
- "testing"
-)
-
-func TestDataFormatUnmarshalInvalidData(t *testing.T) {
- test := []byte(`{}`)
- var val DataFormat
-
- if err := json.Unmarshal(test, &val); err == nil {
- t.Errorf("got \"%s\", exp error", val)
- }
-}
-
-func TestDataFormatUnmarshalUnknown(t *testing.T) {
- test := []byte(`"foo"`)
- exp := "unknown data format: foo"
- var val DataFormat
-
- err := json.Unmarshal(test, &val)
- if err == nil {
- t.Errorf("got \"%s\", exp error", val)
- return
- }
-
- if err.Error() != exp {
- t.Errorf("got \"%s\", exp \"%s\"", err.Error(), exp)
- }
-}
-
-func TestDataFormatUnmarshalValid(t *testing.T) {
- test := []byte(`"MITRE"`)
- exp := MitreFormat
- var got DataFormat
-
- if err := json.Unmarshal(test, &got); err != nil {
- t.Error(err)
- return
- }
-
- if got != exp {
- t.Errorf("got \"%s\", exp \"%s\"", got, exp)
- }
-}
-
-func TestDataFormatString(t *testing.T) {
- tests := []struct {
- val DataFormat
- exp string
- } {
- { MitreFormat, "MITRE" },
- { DataFormat(255), "DataFormat(255)" },
- }
-
- for _, test := range(tests) {
- t.Run(test.val.String(), func(t *testing.T) {
- got := test.val.String()
- if got != test.exp {
- t.Errorf("got \"%s\", exp \"%s\"", got, test.exp)
- }
- })
- }
-}