fix misuse of break, clean up tests
This commit is contained in:
@@ -31,6 +31,7 @@ func TestReadParams(t *testing.T) {
|
|||||||
t.Errorf("Expected empty slice, got nil")
|
t.Errorf("Expected empty slice, got nil")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(params) != len(tc.Output) {
|
if len(params) != len(tc.Output) {
|
||||||
t.Errorf("Expected %d parameters", len(tc.Output))
|
t.Errorf("Expected %d parameters", len(tc.Output))
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-1
@@ -12,6 +12,17 @@ func TestQueryAppend(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
testCases := []TestCase{
|
testCases := []TestCase{
|
||||||
|
// Append without parameters
|
||||||
|
{
|
||||||
|
Input: NewQuery().
|
||||||
|
Append("FOR doc IN @@collection").
|
||||||
|
Append("FILTER doc.title == @title").
|
||||||
|
Append("RETURN doc"),
|
||||||
|
ExpectedStr: `FOR doc IN @@collection
|
||||||
|
FILTER doc.title == @title
|
||||||
|
RETURN doc`,
|
||||||
|
ExpectedParams: map[string]any{},
|
||||||
|
},
|
||||||
// Append with parameters
|
// Append with parameters
|
||||||
{
|
{
|
||||||
Input: NewQuery().
|
Input: NewQuery().
|
||||||
@@ -40,7 +51,7 @@ RETURN doc`,
|
|||||||
"title": "Spaghetti",
|
"title": "Spaghetti",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// Append and bind
|
// Append without parameters and bind after
|
||||||
{
|
{
|
||||||
Input: NewQuery().
|
Input: NewQuery().
|
||||||
Append("FOR doc IN @@collection").
|
Append("FOR doc IN @@collection").
|
||||||
|
|||||||
Reference in New Issue
Block a user