From 3a0b961b0fcbd48cf7a7bd0be41e2cd5752e4f38 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Sat, 26 Feb 2022 10:06:10 -0500 Subject: dbstore: add dbstore/sqlfs_test.go --- dbstore/dbstore_test.go | 44 -------------------------------------------- dbstore/sqlfs_test.go | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 44 deletions(-) create mode 100644 dbstore/sqlfs_test.go (limited to 'dbstore') diff --git a/dbstore/dbstore_test.go b/dbstore/dbstore_test.go index 6394035..09093c7 100644 --- a/dbstore/dbstore_test.go +++ b/dbstore/dbstore_test.go @@ -261,50 +261,6 @@ func TestInitFail(t *testing.T) { } } -func TestGetQuery(t *testing.T) { - tests := []struct { - name string - val string - exp bool - } { - { "pass", "init", true }, - { "fail", "invalid", false }, - } - - for _, test := range(tests) { - t.Run(test.name, func(t *testing.T) { - got, err := getQuery(test.val) - if err != nil && test.exp { - t.Error(err) - } else if err == nil && !test.exp { - t.Errorf("got %v, exp error", got) - } - }) - } -} - -func TestGetQueries(t *testing.T) { - tests := []struct { - name string - vals []string - exp bool - } { - { "pass", []string { "init" }, true }, - { "fail", []string { "invalid" }, false }, - } - - for _, test := range(tests) { - t.Run(test.name, func(t *testing.T) { - got, err := getQueries(test.vals) - if err != nil && test.exp { - t.Error(err) - } else if err == nil && !test.exp { - t.Errorf("got %v, exp error", got) - } - }) - } -} - func TestAddCpeDictionaryPass(t *testing.T) { if testing.Short() { t.Skip("skipping TestAddCveFeeds() in short mode") diff --git a/dbstore/sqlfs_test.go b/dbstore/sqlfs_test.go new file mode 100644 index 0000000..c8cb345 --- /dev/null +++ b/dbstore/sqlfs_test.go @@ -0,0 +1,49 @@ +package dbstore + +import ( + "testing" +) + +func TestGetQuery(t *testing.T) { + tests := []struct { + name string + val string + exp bool + } { + { "pass", "init", true }, + { "fail", "invalid", false }, + } + + for _, test := range(tests) { + t.Run(test.name, func(t *testing.T) { + got, err := getQuery(test.val) + if err != nil && test.exp { + t.Error(err) + } else if err == nil && !test.exp { + t.Errorf("got %v, exp error", got) + } + }) + } +} + +func TestGetQueries(t *testing.T) { + tests := []struct { + name string + vals []string + exp bool + } { + { "pass", []string { "init" }, true }, + { "fail", []string { "invalid" }, false }, + } + + for _, test := range(tests) { + t.Run(test.name, func(t *testing.T) { + got, err := getQueries(test.vals) + if err != nil && test.exp { + t.Error(err) + } else if err == nil && !test.exp { + t.Errorf("got %v, exp error", got) + } + }) + } +} -- cgit v1.2.3