Test Ident
(t *testing.T)
| 98 | |
| 99 | // Test Ident |
| 100 | func TestIdent(t *testing.T) { |
| 101 | tests := []struct { |
| 102 | name string |
| 103 | ident *Ident |
| 104 | wantString string |
| 105 | }{ |
| 106 | { |
| 107 | name: "simple identifier", |
| 108 | ident: &Ident{Name: "user_id"}, |
| 109 | wantString: "user_id", |
| 110 | }, |
| 111 | { |
| 112 | name: "qualified identifier", |
| 113 | ident: &Ident{Name: "users.id"}, |
| 114 | wantString: "users.id", |
| 115 | }, |
| 116 | } |
| 117 | |
| 118 | for _, tt := range tests { |
| 119 | t.Run(tt.name, func(t *testing.T) { |
| 120 | // Test String |
| 121 | if got := tt.ident.String(); got != tt.wantString { |
| 122 | t.Errorf("Ident.String() = %v, want %v", got, tt.wantString) |
| 123 | } |
| 124 | |
| 125 | // Test TokenLiteral |
| 126 | if got := tt.ident.TokenLiteral(); got != tt.wantString { |
| 127 | t.Errorf("Ident.TokenLiteral() = %v, want %v", got, tt.wantString) |
| 128 | } |
| 129 | |
| 130 | // Test Children (should be nil) |
| 131 | if children := tt.ident.Children(); children != nil { |
| 132 | t.Errorf("Ident.Children() = %v, want nil", children) |
| 133 | } |
| 134 | |
| 135 | // Test expressionNode |
| 136 | tt.ident.expressionNode() |
| 137 | |
| 138 | // Test interface implementation |
| 139 | var _ Expression = tt.ident |
| 140 | }) |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | // Test CommentDef |
| 145 | func TestCommentDef(t *testing.T) { |
nothing calls this directly
no test coverage detected