Test Query
(t *testing.T)
| 67 | |
| 68 | // Test Query |
| 69 | func TestQuery(t *testing.T) { |
| 70 | tests := []struct { |
| 71 | name string |
| 72 | query *Query |
| 73 | wantLiteral string |
| 74 | }{ |
| 75 | { |
| 76 | name: "simple query", |
| 77 | query: &Query{ |
| 78 | Text: "SELECT * FROM users", |
| 79 | }, |
| 80 | wantLiteral: "QUERY", |
| 81 | }, |
| 82 | } |
| 83 | |
| 84 | for _, tt := range tests { |
| 85 | t.Run(tt.name, func(t *testing.T) { |
| 86 | // Test TokenLiteral |
| 87 | if got := tt.query.TokenLiteral(); got != tt.wantLiteral { |
| 88 | t.Errorf("Query.TokenLiteral() = %v, want %v", got, tt.wantLiteral) |
| 89 | } |
| 90 | |
| 91 | // Test Children (should be nil) |
| 92 | if children := tt.query.Children(); children != nil { |
| 93 | t.Errorf("Query.Children() = %v, want nil", children) |
| 94 | } |
| 95 | }) |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | // Test Ident |
| 100 | func TestIdent(t *testing.T) { |
nothing calls this directly
no test coverage detected