Test Identifier node
(t *testing.T)
| 695 | |
| 696 | // Test Identifier node |
| 697 | func TestIdentifier(t *testing.T) { |
| 698 | tests := []struct { |
| 699 | name string |
| 700 | identifier *Identifier |
| 701 | wantLiteral string |
| 702 | }{ |
| 703 | { |
| 704 | name: "simple identifier", |
| 705 | identifier: &Identifier{Name: "id"}, |
| 706 | wantLiteral: "id", |
| 707 | }, |
| 708 | { |
| 709 | name: "qualified identifier", |
| 710 | identifier: &Identifier{Table: "users", Name: "id"}, |
| 711 | wantLiteral: "id", |
| 712 | }, |
| 713 | { |
| 714 | name: "asterisk identifier", |
| 715 | identifier: &Identifier{Name: "*"}, |
| 716 | wantLiteral: "*", |
| 717 | }, |
| 718 | } |
| 719 | |
| 720 | for _, tt := range tests { |
| 721 | tt := tt // G601: Create local copy to avoid memory aliasing |
| 722 | t.Run(tt.name, func(t *testing.T) { |
| 723 | // Test TokenLiteral |
| 724 | if got := tt.identifier.TokenLiteral(); got != tt.wantLiteral { |
| 725 | t.Errorf("Identifier.TokenLiteral() = %v, want %v", got, tt.wantLiteral) |
| 726 | } |
| 727 | |
| 728 | // Test Children |
| 729 | children := tt.identifier.Children() |
| 730 | if children != nil { |
| 731 | t.Errorf("Identifier.Children() = %v, want nil", children) |
| 732 | } |
| 733 | |
| 734 | // Test that it implements Expression interface |
| 735 | var _ Expression = tt.identifier |
| 736 | tt.identifier.expressionNode() |
| 737 | }) |
| 738 | } |
| 739 | } |
| 740 | |
| 741 | // Test BinaryExpression node |
| 742 | func TestBinaryExpression(t *testing.T) { |
nothing calls this directly
no test coverage detected