Rename the project to fejkdata and record the fork source
Tests / vet + fmt + tests (pull_request) Failing after 6s

This commit is contained in:
2026-09-01 20:24:03 +02:00
parent 64a0d29496
commit 05dc042e49
23 changed files with 136 additions and 134 deletions
+9 -9
View File
@@ -1,4 +1,4 @@
package fakes
package fejkdata
import (
"encoding/json"
@@ -240,7 +240,7 @@ func TestPathThroughChoice(t *testing.T) {
"notall": `[{"format":"{f}","f":["1"]},["plain"]]`,
"some": `[{"format":"{f}","f":["1"]},{"format":"{f}","f":["2"],"extra":["x"]}]`,
})
f := newFakes(t, dir, WithSeed(1))
f := newFejkdata(t, dir, WithSeed(1))
for i := 0; i < 200; i++ {
if got := fake(t, f, "every.f"); got != "1" && got != "2" {
t.Fatalf("every.f = %q, want 1 or 2", got)
@@ -277,7 +277,7 @@ func TestPathKeyIsUnambiguous(t *testing.T) {
t.Fatalf("New = %v, want the dotted field name rejected", err)
}
// The same data without the dotted key is fine, and the path resolves.
f := newFakes(t, writeData(t, map[string]string{
f := newFejkdata(t, writeData(t, map[string]string{
"cat": `{"format":"{a.b}","a":{"format":"{b}","b":["2"]}}`,
}), WithSeed(1))
if !slices.Contains(f.List(), "cat.a.b") {
@@ -292,7 +292,7 @@ func TestPathKeyIsUnambiguous(t *testing.T) {
// single-variant choice always picks the same item, so it needs no every-variant
// guard and the error can name the field that is missing.
func TestMissingFieldNamesItself(t *testing.T) {
f := newFakes(t, "data/sv_SE", WithSeed(1))
f := newFejkdata(t, "data/sv_SE", WithSeed(1))
_, err := f.Fake("person.typo")
if err == nil || !strings.Contains(err.Error(), `no field "typo"`) {
t.Errorf("Fake(person.typo) = %v, want it to name the missing field", err)
@@ -306,7 +306,7 @@ func TestCategoryRootShapes(t *testing.T) {
"obj": `{"format":"00"}`, // object root
"lit": `"hello"`, // bare-string root
})
f := newFakes(t, dir, WithSeed(1))
f := newFejkdata(t, dir, WithSeed(1))
if got := fake(t, f, "obj"); !regexp.MustCompile(`^\d\d$`).MatchString(got) {
t.Errorf("object-root category = %q, want two digits", got)
}
@@ -327,7 +327,7 @@ func TestLongStringList(t *testing.T) {
if err != nil {
t.Fatal(err)
}
f := newFakes(t, writeData(t, map[string]string{"name": string(list)}), WithSeed(1))
f := newFejkdata(t, writeData(t, map[string]string{"name": string(list)}), WithSeed(1))
valid := map[string]bool{}
for _, v := range names {
@@ -355,7 +355,7 @@ var swedishName = regexp.MustCompile(`^\p{L}+([ -]\p{L}+)*$`)
func TestShippedStreetComposition(t *testing.T) {
// street is a choice of composed {first}{last} templates and literal names.
f := newFakes(t, "data/sv_SE", WithSeed(5))
f := newFejkdata(t, "data/sv_SE", WithSeed(5))
for i := 0; i < 300; i++ {
if s := fake(t, f, "address.street"); !swedishName.MatchString(s) {
t.Fatalf("street %q is not a Swedish street name", s)
@@ -366,7 +366,7 @@ func TestShippedStreetComposition(t *testing.T) {
func TestShippedLastNameComposition(t *testing.T) {
// last is a choice of patronymic {first}sson templates, compound
// {first}{last} templates and literal surnames.
f := newFakes(t, "data/sv_SE", WithSeed(6))
f := newFejkdata(t, "data/sv_SE", WithSeed(6))
for i := 0; i < 300; i++ {
if s := fake(t, f, "person.last"); !swedishName.MatchString(s) {
t.Fatalf("last name %q is not a Swedish surname", s)
@@ -376,7 +376,7 @@ func TestShippedLastNameComposition(t *testing.T) {
func TestShippedStreetNumberFormats(t *testing.T) {
// Reachable via a hyphenated path; covers all five weighted number variants.
f := newFakes(t, "data/sv_SE", WithSeed(8))
f := newFejkdata(t, "data/sv_SE", WithSeed(8))
re := regexp.MustCompile(`^[1-9]\d{0,2}[A-Z]?$`)
for i := 0; i < 300; i++ {
if n := fake(t, f, "address.street-number"); !re.MatchString(n) {