add insert statement

This commit is contained in:
2026-07-07 21:20:58 +01:00
parent 275c4a8cdd
commit 87517d247a
7 changed files with 258 additions and 22 deletions
+34
View File
@@ -6,6 +6,40 @@ import (
"github.com/alecthomas/assert/v2"
)
func TestInsertTable(t *testing.T) {
type TestCase struct {
In string
IsValid bool
Table string
As string
}
testCases := []TestCase{
{
In: "into customer",
IsValid: true,
Table: "customer",
},
{
In: "into customer as c",
IsValid: true,
Table: "customer",
As: "c",
},
}
for _, testCase := range testCases {
t.Run(testCase.In, func(t *testing.T) {
it := InsertTable(testCase.In)
table, as, ok := it.Parse()
assert.Equal(t, testCase.IsValid, ok, "incorrect test case")
assert.Equal(t, testCase.Table, table, "parsed table incorrectly")
assert.Equal(t, testCase.As, as, "parsed as incorrectly")
})
}
}
func TestSelectTable(t *testing.T) {
type TestCase struct {
In string