Skip to content Search Apps Documentation Source Content File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

render_example_test.gno

1.51 Kb · 54 lines
 1package triedemo
 2
 3// ExampleRender pins the realm's root Render output as a testable example.
 4func ExampleRender() {
 5	print(Render(""))
 6	// Output:
 7	// # Trie Autocomplete
 8	//
 9	// A prefix tree over a 55-word dictionary, demoing the [`p/moul/x/daily/trie`](/p/nym-moultest123/x/daily/trie/v0) library.
10	//
11	// Append a prefix to the path to complete it.
12	//
13	// ## Try one
14	//
15	// - [`/co`](/r/nym-moultest123/x/daily/triedemo/v0:co) — 10 words
16	// - [`/gno`](/r/nym-moultest123/x/daily/triedemo/v0:gno) — 5 words
17	// - [`/re`](/r/nym-moultest123/x/daily/triedemo/v0:re) — 6 words
18	// - [`/tr`](/r/nym-moultest123/x/daily/triedemo/v0:tr) — 5 words
19}
20
21// ExampleRender_prefix pins a prefix walk: the completions come out in
22// lexicographic order, and `trie` is flagged as a word in its own right.
23func ExampleRender_prefix() {
24	print(Render("/tr"))
25	// Output:
26	// # Trie Autocomplete
27	//
28	// A prefix tree over a 55-word dictionary, demoing the [`p/moul/x/daily/trie`](/p/nym-moultest123/x/daily/trie/v0) library.
29	//
30	// ## Completions for `tr`
31	//
32	// **5** matches
33	//
34	// - `transaction`
35	// - `transfer`
36	// - `traverse`
37	// - `tree`
38	// - `trie`
39}
40
41// ExampleRender_unknown pins the miss path.
42func ExampleRender_unknown() {
43	print(Render("/zzz"))
44	// Output:
45	// # Trie Autocomplete
46	//
47	// A prefix tree over a 55-word dictionary, demoing the [`p/moul/x/daily/trie`](/p/nym-moultest123/x/daily/trie/v0) library.
48	//
49	// ## Completions for `zzz`
50	//
51	// _No word starts with `zzz`._
52	//
53	// > Try `/co`, `/gno`, `/tr` or `/re`.
54}