Test that a calc over digits(0) or a repeat of 0 is refused, that an option of the wrong kind names its JSON kind, and that the root scope is the category

This commit is contained in:
2026-10-07 23:58:22 +02:00
committed by Lillem4n
parent 924ba07c1c
commit ba2ae41ffe
6 changed files with 41 additions and 6 deletions
+3
View File
@@ -309,6 +309,9 @@ func TestFakeStructErrors(t *testing.T) {
{&struct {
A int `fake:"person.first"`
}{}, `"Ada" is not an integer`},
{&struct {
A int `fake:"{\"format\":\"{calc(d + 1)}\",\"d\":\"{digits(0)}\"}"`
}{}, "{digits(0)} prints nothing, which is no number"},
{&struct {
A int8 `fake:"{int(0,300)}"`
}{}, `"{int(0,300)}" is not proven within int8; narrow it to that range, or make the field int64`},