Search Apps Documentation Source Content File Folder Download Copy

z_2_filetest.gno

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