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
+11
View File
@@ -2,9 +2,20 @@ package fejkdata
import (
"regexp"
"strings"
"testing"
)
func TestAnOptionOfTheWrongKindIsNamedByItsJSONKind(t *testing.T) {
if _, err := resolved(t, `{"format":"x","repeat":2,"separator":5}`); err == nil || !strings.Contains(err.Error(), "separator must be a string, not a number") {
t.Errorf("separator 5 = %v, want the kind named", err)
}
_, err := New(WithoutShippedData(), WithDataPath(writeFiles(t, map[string]string{"t.json": `{"format":"{a}","rows":"t.tsv","key":5}`, "t.tsv": "a\nx\n"})))
if err == nil || !strings.Contains(err.Error(), "key must be a string, not a number") {
t.Errorf("key 5 = %v, want the kind named", err)
}
}
func TestWeightSkewsDistribution(t *testing.T) {
f := engine(9)
heavy := 0