MCPcopy
hub / github.com/cube2222/octosql / TestColumns_FindColumn

Function TestColumns_FindColumn

parser/sqlparser/ast_test.go:684–712  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

682}
683
684func TestColumns_FindColumn(t *testing.T) {
685 cols := Columns{NewColIdent("a"), NewColIdent("c"), NewColIdent("b"), NewColIdent("0")}
686
687 testcases := []struct {
688 in string
689 out int
690 }{{
691 in: "a",
692 out: 0,
693 }, {
694 in: "b",
695 out: 2,
696 },
697 {
698 in: "0",
699 out: 3,
700 },
701 {
702 in: "f",
703 out: -1,
704 }}
705
706 for _, tc := range testcases {
707 val := cols.FindColumn(NewColIdent(tc.in))
708 if val != tc.out {
709 t.Errorf("FindColumn(%s): %d, want %d", tc.in, val, tc.out)
710 }
711 }
712}
713
714func TestSplitStatementToPieces(t *testing.T) {
715 testcases := []struct {

Callers

nothing calls this directly

Calls 2

FindColumnMethod · 0.95
NewColIdentFunction · 0.85

Tested by

no test coverage detected