Record generation outcomes and summaries for history while keeping article content transient. Refs #7 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
34 lines
777 B
Go
34 lines
777 B
Go
package scheduler
|
|
|
|
import (
|
|
"go/ast"
|
|
"go/parser"
|
|
"go/token"
|
|
"testing"
|
|
)
|
|
|
|
func TestScheduledCycleDoesNotPersistArticlesThroughRegistryRunAll(t *testing.T) {
|
|
fset := token.NewFileSet()
|
|
file, err := parser.ParseFile(fset, "scheduler.go", nil, 0)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
for _, declaration := range file.Decls {
|
|
function, ok := declaration.(*ast.FuncDecl)
|
|
if !ok || function.Name.Name != "run" {
|
|
continue
|
|
}
|
|
ast.Inspect(function.Body, func(node ast.Node) bool {
|
|
call, ok := node.(*ast.CallExpr)
|
|
if !ok {
|
|
return true
|
|
}
|
|
selector, ok := call.Fun.(*ast.SelectorExpr)
|
|
if ok && selector.Sel.Name == "RunAll" {
|
|
t.Errorf("scheduled generation still invokes Registry.RunAll at %s", fset.Position(call.Pos()))
|
|
}
|
|
return true
|
|
})
|
|
}
|
|
}
|