example_test.gno
1.43 Kb · 30 lines
1package reaper
2
3import "strings"
4
5// ExampleRender pins the page's skeleton: the title, the two sections that are
6// always present, and the footer crediting the two packages that own the parts
7// this realm does not.
8//
9// It deliberately prints only the invariant lines. Everything interesting on
10// the page is priced from the current block height and the notes outstanding,
11// and an Example runs after every Test in the package and sees whatever state
12// they left. The variable half is pinned by TestRenderShowsTheBountyAndTheReapLink
13// instead, which controls the board first.
14func ExampleRender() {
15 for _, line := range strings.Split(Render(""), "\n") {
16 switch {
17 case strings.HasPrefix(line, "# "),
18 strings.HasPrefix(line, "## "),
19 strings.HasPrefix(line, "A noticeboard"),
20 strings.HasPrefix(line, "The arithmetic is"):
21 print(line + "\n")
22 }
23 }
24 // Output:
25 // # Reaper
26 // A noticeboard whose garbage is a standing bounty. Posting a note locks a storage deposit. Once the note expires, anyone can delete it and the chain refunds that deposit **to whoever signs the deleting transaction**.
27 // ## On the table right now
28 // ## Board
29 // The arithmetic is [p/moul/x/storagecost](/p/moul/x/storagecost/v0); the storage is [p/moul/ulist](/p/moul/ulist/v1), whose `Compact` reclaims dead nodes without moving a live index. Byte figures on this page are estimates from payload length: no stdlib call exposes a realm's real locked storage.
30}