Search Apps Documentation Source Content File Folder Download Copy

z_0_filetest.gno

1.27 Kb ยท 41 lines
 1// PKGPATH: gno.land/r/demo/boards_test
 2package boards_test
 3
 4// SEND: 20000000ugnot
 5
 6import (
 7	"gno.land/r/demo/boards"
 8	"gno.land/r/demo/users"
 9)
10
11var bid boards.BoardID
12
13func init() {
14	users.Register("", "gnouser", "my profile")
15
16	bid = boards.CreateBoard("test_board")
17	boards.CreateThread(bid, "First Post (title)", "Body of the first post. (body)")
18	pid := boards.CreateThread(bid, "Second Post (title)", "Body of the second post. (body)")
19	boards.CreateReply(bid, pid, pid, "Reply of the second post")
20}
21
22func main() {
23	println(boards.Render("test_board"))
24}
25
26// Output:
27// \[[post](/r/demo/boards$help&func=CreateThread&bid=1)]
28//
29// ----------------------------------------
30// ## [First Post (title)](/r/demo/boards:test_board/1)
31//
32// Body of the first post. (body)
33// \- [@gnouser](/r/demo/users:gnouser), [2009-02-13 11:31pm UTC](/r/demo/boards:test_board/1) \[[x](/r/demo/boards$help&func=DeletePost&bid=1&threadid=1&postid=1)] (0 replies) (0 reposts)
34//
35// ----------------------------------------
36// ## [Second Post (title)](/r/demo/boards:test_board/2)
37//
38// Body of the second post. (body)
39// \- [@gnouser](/r/demo/users:gnouser), [2009-02-13 11:31pm UTC](/r/demo/boards:test_board/2) \[[x](/r/demo/boards$help&func=DeletePost&bid=1&threadid=2&postid=2)] (1 replies) (0 reposts)
40//
41//