mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-02 20:09:57 +08:00
e756fdccd4
Signed-off-by: longjiquan <jiquan.long@zilliz.com>
40 lines
880 B
Go
40 lines
880 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 lexer *antlrparser.PlanLexer
|
|
var parser *antlrparser.PlanParser
|
|
|
|
lexer = getLexer(genNaiveInputStream(), &errorListener{})
|
|
assert.NotNil(t, lexer)
|
|
|
|
parser = getParser(lexer, &errorListener{})
|
|
assert.NotNil(t, parser)
|
|
|
|
parser = getParser(lexer, &errorListener{})
|
|
assert.NotNil(t, parser)
|
|
}
|