Make great documentation goal 1.2, and plan the README's reorganisation and the nested-template gaps #33
+2
-1
@@ -29,7 +29,7 @@ func TestPackageImports(t *testing.T) {
|
|||||||
}
|
}
|
||||||
checked := 0
|
checked := 0
|
||||||
allowed := map[string][]string{
|
allowed := map[string][]string{
|
||||||
".": {"internal/builtinfunc", "internal/datafiles", "internal/datatype", "internal/drawstate", "internal/grammar", "internal/invariant", "internal/proven"},
|
".": {"internal/builtinfunc", "internal/datafiles", "internal/datatype", "internal/drawstate", "internal/grammar", "internal/invariant", "internal/proven", "internal/rows"},
|
||||||
"cmd/fejkdata": {"."},
|
"cmd/fejkdata": {"."},
|
||||||
"internal/builtinfunc": {"internal/datatype", "internal/drawstate", "internal/grammar", "internal/invariant", "internal/proven"},
|
"internal/builtinfunc": {"internal/datatype", "internal/drawstate", "internal/grammar", "internal/invariant", "internal/proven"},
|
||||||
"internal/datafiles": {"internal/grammar"},
|
"internal/datafiles": {"internal/grammar"},
|
||||||
@@ -38,6 +38,7 @@ func TestPackageImports(t *testing.T) {
|
|||||||
"internal/grammar": nil,
|
"internal/grammar": nil,
|
||||||
"internal/invariant": nil,
|
"internal/invariant": nil,
|
||||||
"internal/proven": {"internal/datatype", "internal/grammar", "internal/invariant"},
|
"internal/proven": {"internal/datatype", "internal/grammar", "internal/invariant"},
|
||||||
|
"internal/rows": {"internal/drawstate", "internal/grammar", "internal/invariant"},
|
||||||
}
|
}
|
||||||
seen := map[string]bool{}
|
seen := map[string]bool{}
|
||||||
eachPackage(t, func(dir string, pkg *build.Package) {
|
eachPackage(t, func(dir string, pkg *build.Package) {
|
||||||
|
|||||||
@@ -62,6 +62,24 @@ func TestDescendIntoStringErrors(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TestPathRefusesALevelCarryingARepeat holds a caller's path to the rule a reference obeys.
|
||||||
|
func TestPathRefusesALevelCarryingARepeat(t *testing.T) {
|
||||||
|
dir := writeData(t, map[string]string{
|
||||||
|
"outer": `{"format":"{inner}","inner":{"format":"{a}","a":"v","repeat":3,"separator":","}}`,
|
||||||
|
"x": `{"format":"{a}","a":"v","repeat":3,"separator":","}`,
|
||||||
|
})
|
||||||
|
f := newGenerator(t, dir, WithSeed(1))
|
||||||
|
for path, level := range map[string]string{"x.a": "x", "outer.inner.a": "outer.inner"} {
|
||||||
|
want := fmt.Sprintf("the level %q carries a repeat", level)
|
||||||
|
if got, err := f.Fake(path); err == nil || !strings.Contains(err.Error(), want) {
|
||||||
|
t.Errorf("Fake(%s) = %q, %v, want %s", path, got, err, want)
|
||||||
|
}
|
||||||
|
if _, err := f.NewTemplate("{/" + path + "}"); err == nil || !strings.Contains(err.Error(), fmt.Sprintf("the level %q carries a repeat", "/"+level)) {
|
||||||
|
t.Errorf("NewTemplate({/%s}) = %v, want the level /%s named", path, err, level)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TestPathThroughChoice pins the rule that keeps a dotted path from rendering on
|
// TestPathThroughChoice pins the rule that keeps a dotted path from rendering on
|
||||||
// one call and failing on the next: every variant must carry the rest of the path.
|
// one call and failing on the next: every variant must carry the rest of the path.
|
||||||
func TestPathThroughChoice(t *testing.T) {
|
func TestPathThroughChoice(t *testing.T) {
|
||||||
|
|||||||
Reference in New Issue
Block a user