docs(cooler,diary,festival,fetchguard): compile README Go examples via src= (quick-261118-qsd)

- cooler: ExampleFromApp and the articlesController purge declarations;
  AllowExport run by TestDocsAllowExport on miniredis
- diary: blogLog and ExampleFor; the generated main's run function, run by
  TestDocsRun in a temp directory with diary.Reset on cleanup
- festival: PostPublished/ExampleBus_Fire and PostFormExtended/Collected/
  ExampleBus_Collect, with a TestDocsDeclarations for Collected
- fetchguard: fetch region run by TestDocsFetchImage (loopback refused as
  private_ip), client region run by TestDocsSyncItems on a stub transport
This commit is contained in:
Jakub Zych
2026-11-18 19:48:01 +01:00
parent becb31fbef
commit d04454c57b
8 changed files with 385 additions and 95 deletions

View File

@@ -3,6 +3,7 @@ package festival_test
import (
"context"
"fmt"
"testing"
"git.golem15.com/golem15/summercms/modules/festival"
)
@@ -90,3 +91,12 @@ func ExampleBus_UntilHandled() {
// acme.blog asked for hello-world
// hello-world true post <nil>
}
// TestDocsDeclarations checks the event methods the README shows.
func TestDocsDeclarations(t *testing.T) {
var _ festival.Collectable = &PostFormExtended{}
e := &PostFormExtended{fields: map[string]any{"cover": "fileupload"}}
if got := e.Collected(); len(got) != 1 || got["cover"] != "fileupload" {
t.Fatalf("Collected() = %v", got)
}
}