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

Function TestRowAccessPolicy

pkg/sql/ast/types_test.go:297–339  ·  view source on GitHub ↗

Test RowAccessPolicy

(t *testing.T)

Source from the content-addressed store, hash-verified

295
296// Test RowAccessPolicy
297func TestRowAccessPolicy(t *testing.T) {
298 tests := []struct {
299 name string
300 policy *RowAccessPolicy
301 wantLiteral string
302 wantChildren int
303 }{
304 {
305 name: "policy without filter",
306 policy: &RowAccessPolicy{
307 Name: "admin_policy",
308 Enabled: true,
309 },
310 wantLiteral: "ROW ACCESS POLICY",
311 wantChildren: 0,
312 },
313 {
314 name: "policy with filter",
315 policy: &RowAccessPolicy{
316 Name: "user_policy",
317 Filter: &mockExpr{},
318 Enabled: true,
319 },
320 wantLiteral: "ROW ACCESS POLICY",
321 wantChildren: 1,
322 },
323 }
324
325 for _, tt := range tests {
326 t.Run(tt.name, func(t *testing.T) {
327 // Test TokenLiteral
328 if got := tt.policy.TokenLiteral(); got != tt.wantLiteral {
329 t.Errorf("RowAccessPolicy.TokenLiteral() = %v, want %v", got, tt.wantLiteral)
330 }
331
332 // Test Children
333 children := tt.policy.Children()
334 if len(children) != tt.wantChildren {
335 t.Errorf("RowAccessPolicy.Children() count = %d, want %d", len(children), tt.wantChildren)
336 }
337 })
338 }
339}
340
341// Test StatementImpl
342func TestStatementImpl(t *testing.T) {

Callers

nothing calls this directly

Calls 4

RunMethod · 0.80
TokenLiteralMethod · 0.65
ErrorfMethod · 0.65
ChildrenMethod · 0.65

Tested by

no test coverage detected