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

Function TestAlterColumnOperation

pkg/sql/ast/types_test.go:20–66  ·  view source on GitHub ↗

Test AlterColumnOperation

(t *testing.T)

Source from the content-addressed store, hash-verified

18
19// Test AlterColumnOperation
20func TestAlterColumnOperation(t *testing.T) {
21 tests := []struct {
22 name string
23 op AlterColumnOperation
24 wantString string
25 }{
26 {
27 name: "SET DEFAULT",
28 op: AlterColumnSetDefault,
29 wantString: "SET DEFAULT",
30 },
31 {
32 name: "DROP DEFAULT",
33 op: AlterColumnDropDefault,
34 wantString: "DROP DEFAULT",
35 },
36 {
37 name: "SET NOT NULL",
38 op: AlterColumnSetNotNull,
39 wantString: "SET NOT NULL",
40 },
41 {
42 name: "DROP NOT NULL",
43 op: AlterColumnDropNotNull,
44 wantString: "DROP NOT NULL",
45 },
46 {
47 name: "Unknown operation",
48 op: AlterColumnOperation(999),
49 wantString: "UNKNOWN",
50 },
51 }
52
53 for _, tt := range tests {
54 t.Run(tt.name, func(t *testing.T) {
55 // Test TokenLiteral
56 if got := tt.op.TokenLiteral(); got != tt.wantString {
57 t.Errorf("AlterColumnOperation.TokenLiteral() = %v, want %v", got, tt.wantString)
58 }
59
60 // Test Children (should be nil)
61 if children := tt.op.Children(); children != nil {
62 t.Errorf("AlterColumnOperation.Children() = %v, want nil", children)
63 }
64 })
65 }
66}
67
68// Test Query
69func TestQuery(t *testing.T) {

Callers

nothing calls this directly

Calls 5

AlterColumnOperationTypeAlias · 0.85
RunMethod · 0.80
TokenLiteralMethod · 0.65
ErrorfMethod · 0.65
ChildrenMethod · 0.65

Tested by

no test coverage detected