example_test.gno
0.85 Kb · 25 lines
1package wiki
2
3import "strings"
4
5// ExampleRender shows what an article looks like once the library has
6// rewritten its wikilinks and hoisted its categories into the footer.
7//
8// It prints only the structural lines: the header carries a timestamp and the
9// footer a byte count, and neither is stable across the package's other tests.
10// The full output is pinned by TestRenderRoutes and by the library's own
11// render tests.
12func ExampleRender() {
13 for _, line := range strings.Split(Render("Tendermint2"), "\n") {
14 switch {
15 case strings.HasPrefix(line, "# "),
16 strings.HasPrefix(line, "**Categories:**"),
17 strings.HasPrefix(line, "Tendermint2 is"):
18 print(line + "\n")
19 }
20 }
21 // Output:
22 // # Tendermint2
23 // Tendermint2 is the consensus engine under [Gno land](/r/moul/x/wiki/v0:Gno_land).
24 // **Categories:** [Chains](/r/moul/x/wiki/v0:Category:Chains)
25}