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

Function TestAddSetClause_ReplacesExisting

pkg/transform/set_test.go:34–47  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

32}
33
34func TestAddSetClause_ReplacesExisting(t *testing.T) {
35 stmt := mustParse(t, "UPDATE users SET name = 'old', status = 'inactive'")
36
37 err := Apply(stmt, AddSetClause("name", "'new'"))
38 if err != nil {
39 t.Fatalf("AddSetClause: %v", err)
40 }
41
42 out := format(stmt)
43 assertContains(t, out, "new")
44 assertNotContains(t, out, "old")
45 // status should still be present
46 assertContains(t, out, "status")
47}
48
49func TestSetClause_ReplaceExisting(t *testing.T) {
50 stmt := mustParse(t, "UPDATE users SET name = 'old', status = 'active'")

Callers

nothing calls this directly

Calls 7

mustParseFunction · 0.85
ApplyFunction · 0.85
AddSetClauseFunction · 0.85
assertContainsFunction · 0.85
assertNotContainsFunction · 0.85
formatFunction · 0.70
FatalfMethod · 0.65

Tested by

no test coverage detected