Load whatever is well-formed and means one thing: ignore a part with no effect, print a constant sample, render any JSON value, draw no weight-0 item, and let a name, a rows file, a struct or a CLI flag go unused

This commit is contained in:
2026-10-07 23:39:59 +02:00
committed by Lillem4n
parent 052a52fc7a
commit ee236d7955
14 changed files with 165 additions and 213 deletions
+3 -3
View File
@@ -1,13 +1,13 @@
package fejkdata
import (
"encoding/json"
"errors"
"io/fs"
"strings"
"testing"
"testing/fstest"
"github.com/larvit/fejkdata/internal/datafiles"
"github.com/larvit/fejkdata/internal/drawstate"
)
@@ -104,8 +104,8 @@ func engine(seed uint64) *Generator {
// parse unmarshals a JSON template fragment into its dynamic form.
func parse(t *testing.T, s string) any {
t.Helper()
var v any
if err := json.Unmarshal([]byte(s), &v); err != nil {
v, err := datafiles.DecodeJSON([]byte(s))
if err != nil {
t.Fatalf("parse %q: %v", s, err)
}
return v