One component per file; GAME OVER offers CONTINUE
PRD G1 asks for one component per file. Eight files held two or three; their eleven extra components move to files of their own, helpers stay where both sides use them, and an archtest now fails any file that holds two. PRD 4.4 and the request say an error always offers CONTINUE. ErrorState's button read RETRY; it now reads CONTINUE, under the CONTINUE? countdown, on the crash screen and the lost page alike.
This commit is contained in:
25 files changed
+439
-359
No files matched your search
@@ -274,19 +274,24 @@ func TestWebScripts(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestComponentsTakeTheirOptions holds PRD 5.1's shape: Name takes NameOptions.
|
||||
// TestComponentsTakeTheirOptions holds PRD 5.1's shape, one per file.
|
||||
func TestComponentsTakeTheirOptions(t *testing.T) {
|
||||
for _, f := range files(t) {
|
||||
tier, ok := tiers[f.pkg]
|
||||
if !ok || tier < 2 || tier > 6 || strings.HasSuffix(f.path, "_test.go") {
|
||||
continue
|
||||
}
|
||||
var found []string
|
||||
for _, d := range f.ast.Decls {
|
||||
fn, ok := d.(*ast.FuncDecl)
|
||||
// Undrawn bases, as MyGo's own, are parts, not components.
|
||||
if !ok || fn.Recv != nil || !fn.Name.IsExported() || strings.HasSuffix(fn.Name.Name, "Base") || len(fn.Type.Params.List) == 0 || !isContext(fn.Type.Params.List[0].Type) {
|
||||
continue
|
||||
}
|
||||
// PRD G1: one component per file.
|
||||
if found = append(found, fn.Name.Name); len(found) > 1 {
|
||||
t.Errorf("%s holds %v; one component per file", f.path, found)
|
||||
}
|
||||
want := fn.Name.Name + "Options"
|
||||
if !slices.ContainsFunc(fn.Type.Params.List, func(p *ast.Field) bool { return typeName(p.Type) == want }) {
|
||||
t.Errorf("%s: %s takes no %s", f.path, fn.Name.Name, want)
|
||||
|
||||
Reference in new issue
Block a user