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

Function TestRemoveHints

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

Source from the content-addressed store, hash-verified

115}
116
117func TestRemoveHints(t *testing.T) {
118 for _, query := range []string{
119 "select * from t use index (i)",
120 "select * from t force index (i)",
121 } {
122 tree, err := Parse(query)
123 if err != nil {
124 t.Fatal(err)
125 }
126 sel := tree.(*Select)
127 sel.From = TableExprs{
128 sel.From[0].(*AliasedTableExpr).RemoveHints(),
129 }
130 buf := NewTrackedBuffer(nil)
131 sel.Format(buf)
132 if got, want := buf.String(), "select * from t"; got != want {
133 t.Errorf("stripped query: %s, want %s", got, want)
134 }
135 }
136}
137
138func TestDDL(t *testing.T) {
139 testcases := []struct {

Callers

nothing calls this directly

Calls 5

ParseFunction · 0.85
NewTrackedBufferFunction · 0.85
RemoveHintsMethod · 0.80
FormatMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected