Advertise only spellable paths, and name what a choice's variants share
This commit is contained in:
committed by
lilleman-tw
parent
595809bf38
commit
362c484825
@@ -97,6 +97,7 @@ func TestPathThroughChoice(t *testing.T) {
|
||||
dir := writeData(t, map[string]string{
|
||||
"every": `[{"format":"{f}","f":["1"]},{"format":"{f}","f":["2"]}]`,
|
||||
"notall": `[{"format":"{f}","f":["1"]},["plain"]]`,
|
||||
"some": `[{"format":"{f}","f":["1"]},{"format":"{f}","f":["2"],"extra":["x"]}]`,
|
||||
})
|
||||
f := newFakes(t, dir, WithSeed(1))
|
||||
for i := 0; i < 200; i++ {
|
||||
@@ -104,6 +105,10 @@ func TestPathThroughChoice(t *testing.T) {
|
||||
t.Fatalf("every.f = %q, want 1 or 2", got)
|
||||
}
|
||||
}
|
||||
// A path only some variants carry is reported against what all of them carry.
|
||||
if _, err := f.Fake("some.extra"); err == nil || !strings.Contains(err.Error(), "all carry [f]") {
|
||||
t.Errorf("Fake(some.extra) = %v, want it to name what every variant carries", err)
|
||||
}
|
||||
var first string
|
||||
for i := 0; i < 200; i++ {
|
||||
_, err := f.Fake("notall.f")
|
||||
|
||||
Reference in New Issue
Block a user