mirror of
https://github.com/chaisql/chai.git
synced 2025-10-28 17:51:48 +08:00
We now have a literal representation for BLOBs. Any string literal starting with '\x' is parsed as an hex encoded blob. This mimics PostgreSQL's behavior. ```sql SELECT '\xAAFF'; ```
33 lines
667 B
Go
33 lines
667 B
Go
package expr_test
|
|
|
|
import (
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"github.com/genjidb/genji/internal/testutil"
|
|
"github.com/genjidb/genji/types"
|
|
)
|
|
|
|
func TestConcatExpr(t *testing.T) {
|
|
tests := []struct {
|
|
expr string
|
|
res types.Value
|
|
fails bool
|
|
}{
|
|
{"'a' || 'b'", types.NewTextValue("ab"), false},
|
|
{"'a' || NULL", nullLiteral, false},
|
|
{"'a' || notFound", nullLiteral, false},
|
|
{"'a' || 1", nullLiteral, false},
|
|
}
|
|
|
|
for _, test := range tests {
|
|
t.Run(test.expr, func(t *testing.T) {
|
|
testutil.TestExpr(t, test.expr, envWithDoc, test.res, test.fails)
|
|
})
|
|
}
|
|
}
|
|
|
|
func TestCast(t *testing.T) {
|
|
testutil.ExprRunner(t, filepath.Join("testdata", "cast.sql"))
|
|
}
|