MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / TestParseMergeExtended

Function TestParseMergeExtended

pkg/sql/parser/coverage_improvement_test.go:933–948  ·  view source on GitHub ↗

TestParseMergeExtended targets parseMergeStatement (85.1%) and parseMergeWhenClause (84.4%)

(t *testing.T)

Source from the content-addressed store, hash-verified

931
932// TestParseMergeExtended targets parseMergeStatement (85.1%) and parseMergeWhenClause (84.4%)
933func TestParseMergeExtended(t *testing.T) {
934 sqls := []struct {
935 name string
936 sql string
937 }{
938 {"MERGE with DELETE", `MERGE INTO target t USING source s ON t.id = s.id WHEN MATCHED AND s.deleted = true THEN DELETE WHEN MATCHED THEN UPDATE SET t.name = s.name WHEN NOT MATCHED THEN INSERT (id, name) VALUES (s.id, s.name)`},
939 {"MERGE multiple MATCHED", `MERGE INTO inventory t USING updates s ON t.product_id = s.product_id WHEN MATCHED AND s.qty = 0 THEN DELETE WHEN MATCHED THEN UPDATE SET t.qty = s.qty WHEN NOT MATCHED THEN INSERT (product_id, qty) VALUES (s.product_id, s.qty)`},
940 }
941
942 for _, tt := range sqls {
943 t.Run(tt.name, func(t *testing.T) {
944 tree := parseSQLHelper(t, tt.sql)
945 defer ast.ReleaseAST(tree)
946 })
947 }
948}
949
950// TestParseComparisonExpressionEdgeCases targets parseComparisonExpression (76.4%)
951func TestParseComparisonExpressionEdgeCases(t *testing.T) {

Callers

nothing calls this directly

Calls 3

ReleaseASTFunction · 0.92
parseSQLHelperFunction · 0.85
RunMethod · 0.80

Tested by

no test coverage detected