milvus/internal/parser/planparserv2/pool_test.go
Jiquan Long 98ceb162aa
Support antlr as plan parser (#16696)
Signed-off-by: dragondriver <jiquan.long@zilliz.com>

Co-authored-by: xaxys <tpnnghd@163.com>

Co-authored-by: xaxys <tpnnghd@163.com>
2022-05-06 17:43:51 +08:00

36 lines
793 B
Go

package planparserv2
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/antlr/antlr4/runtime/Go/antlr"
antlrparser "github.com/milvus-io/milvus/internal/parser/planparserv2/generated"
)
func genNaiveInputStream() *antlr.InputStream {
return antlr.NewInputStream("a > 2")
}
func Test_getLexer(t *testing.T) {
var lexer *antlrparser.PlanLexer
lexer = getLexer(genNaiveInputStream(), &errorListener{})
assert.NotNil(t, lexer)
lexer = getLexer(genNaiveInputStream(), &errorListener{})
assert.NotNil(t, lexer)
}
func Test_getParser(t *testing.T) {
var parser *antlrparser.PlanParser
parser = getParser(genNaiveInputStream(), &errorListener{})
assert.NotNil(t, parser)
parser = getParser(genNaiveInputStream(), &errorListener{})
assert.NotNil(t, parser)
}