Test a generator with no data, a repeat or count of 0 rendering nothing, and a name a choice's item binds and reads

This commit is contained in:
2026-10-07 23:46:11 +02:00
committed by Lillem4n
parent 07a0498c5e
commit 1e159fdf3a
9 changed files with 48 additions and 22 deletions
+1 -4
View File
@@ -203,7 +203,7 @@ func mustPanic(t *testing.T, name string, call func()) {
}
func TestClassBuiltinArgs(t *testing.T) {
for _, bad := range []string{`"{digits(0)}"`, `"{digits(2000000000)}"`, `"{upper(-1)}"`, `"{lower(x)}"`, `"{digits()}"`, `"{upper(1,2)}"`} {
for _, bad := range []string{`"{digits(2000000000)}"`, `"{upper(-1)}"`, `"{lower(x)}"`, `"{digits()}"`, `"{upper(1,2)}"`} {
if _, err := resolved(t, bad); err == nil {
t.Errorf("compile(%s) = nil error, want the arg rejected", bad)
}
@@ -379,13 +379,10 @@ func TestFunctionTokenLuhn(t *testing.T) {
func TestBuiltinCompileErrors(t *testing.T) {
for _, bad := range []string{
`"{digits(0)}"`, // count must be positive
`"{upper(x)}"`, // count must be an integer
`"{int(a,b)}"`, // non-integer args
`"{int(5,1)}"`, // min > max
`"{hex(0)}"`, // count must be positive
`"{nanoid(-1)}"`, // negative count
`"{base64(0)}"`, // count must be positive
`"{float(1,2,-1)}"`, // negative decimals
`"{float(NaN,NaN,2)}"`, // bounds must be finite
`"{float(Inf,Inf,2)}"`, // same-sign infinities