aboutsummaryrefslogtreecommitdiff
path: root/dbstore/sqlfs_test.go
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2022-02-26 10:06:10 -0500
committerPaul Duncan <pabs@pablotron.org>2022-02-26 10:06:10 -0500
commit3a0b961b0fcbd48cf7a7bd0be41e2cd5752e4f38 (patch)
tree9dd3824ad7f448a96b548f4d43b7639365a28e3b /dbstore/sqlfs_test.go
parent681c8377558cec1ed75ee2e59e09582e95040690 (diff)
downloadcvez-3a0b961b0fcbd48cf7a7bd0be41e2cd5752e4f38.tar.bz2
cvez-3a0b961b0fcbd48cf7a7bd0be41e2cd5752e4f38.zip
dbstore: add dbstore/sqlfs_test.go
Diffstat (limited to 'dbstore/sqlfs_test.go')
-rw-r--r--dbstore/sqlfs_test.go49
1 files changed, 49 insertions, 0 deletions
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)
+ }
+ })
+ }
+}