* identifiers can now have the '-' character
* skip some integration tests

(cherry picked from commit cca319fbe5)
This commit is contained in:
pokeeffe-molecula 2022-11-21 15:58:00 -06:00 committed by Fletcher Haynes
parent b17ee6a203
commit e2500fcee8
4 changed files with 57 additions and 1 deletions

View file

@ -105,6 +105,8 @@ func TestDAXIntegration(t *testing.T) {
"binoptestdec_d/test-12",
"table-82/test-3",
"table-82/test-8",
"table-83/test-3",
"table-83/test-8",
"cast_int/test-2",
"cast_int/test-7",
"cast_id/test-2",

View file

@ -333,7 +333,7 @@ func isHex(ch rune) bool {
}
func isUnquotedIdent(ch rune) bool {
return isAlpha(ch) || isDigit(ch) || ch == '_'
return isAlpha(ch) || isDigit(ch) || ch == '_' || ch == '-'
}
// IsInteger returns true if s only contains digits.

View file

@ -13,6 +13,8 @@ var TableTests []TableTest = []TableTest{
unkeyed,
keyed,
selectTests,
setLiteralTests,
setFunctionTests,
setParameterTests,

View file

@ -0,0 +1,52 @@
package defs
import "github.com/molecula/featurebase/v3/pql"
var selectTests = TableTest{
name: "table-with-hyphens",
Table: tbl(
"un-keyed",
srcHdrs(
srcHdr("_id", fldTypeID),
srcHdr("an_int", fldTypeInt, "min 0", "max 100"),
srcHdr("an_id_set", fldTypeIDSet),
srcHdr("an_id", fldTypeID),
srcHdr("a_string", fldTypeString),
srcHdr("a_string_set", fldTypeStringSet),
srcHdr("a_decimal", fldTypeDecimal2),
),
srcRows(
srcRow(int64(1), int64(11), []int64{11, 12, 13}, int64(101), "str1", []string{"a1", "b1", "c1"}, float64(123.45)),
srcRow(int64(2), int64(22), []int64{21, 22, 23}, int64(201), "str2", []string{"a2", "b2", "c2"}, float64(234.56)),
srcRow(int64(3), int64(33), []int64{31, 32, 33}, int64(301), "str3", []string{"a3", "b3", "c3"}, float64(345.67)),
srcRow(int64(4), int64(44), []int64{41, 42, 43}, int64(401), "str4", []string{"a4", "b4", "c4"}, float64(456.78)),
),
),
SQLTests: []SQLTest{
{
// Select all.
name: "select-all",
SQLs: sqls(
"select * from un-keyed",
"select _id, an_int, an_id_set, an_id, a_string, a_string_set, a_decimal from un-keyed",
),
ExpHdrs: hdrs(
hdr("_id", fldTypeID),
hdr("an_int", fldTypeInt),
hdr("an_id_set", fldTypeIDSet),
hdr("an_id", fldTypeID),
hdr("a_string", fldTypeString),
hdr("a_string_set", fldTypeStringSet),
hdr("a_decimal", fldTypeDecimal2),
),
ExpRows: rows(
row(int64(1), int64(11), []int64{11, 12, 13}, int64(101), "str1", []string{"a1", "b1", "c1"}, pql.NewDecimal(12345, 2)),
row(int64(2), int64(22), []int64{21, 22, 23}, int64(201), "str2", []string{"a2", "b2", "c2"}, pql.NewDecimal(23456, 2)),
row(int64(3), int64(33), []int64{31, 32, 33}, int64(301), "str3", []string{"a3", "b3", "c3"}, pql.NewDecimal(34567, 2)),
row(int64(4), int64(44), []int64{41, 42, 43}, int64(401), "str4", []string{"a4", "b4", "c4"}, pql.NewDecimal(45678, 2)),
),
Compare: CompareExactUnordered,
SortStringKeys: true,
},
},
}