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 rid boards.PostID
17)
18
19func init() {
20 users.Register("", "gnouser", "my profile")
21
22 bid = boards.CreateBoard("test_board")
23 boards.CreateThread(bid, "First Post (title)", "Body of the first post. (body)")
24 pid = boards.CreateThread(bid, "Second Post (title)", "Body of the second post. (body)")
25 rid = boards.CreateReply(bid, pid, pid, "Reply of the second post")
26}
27
28func main() {
29 boards.CreateReply(bid, pid, pid, "Second reply of the second post\n")
30 boards.CreateReply(bid, pid, rid, "First reply of the first reply\n")
31 println(boards.Render("test_board/" + strconv.Itoa(int(pid))))
32}
33
34// Output:
35// # Second Post (title)
36//
37// Body of the second post. (body)
38// \- [@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)]
39//
40// > Reply of the second post
41// > \- [@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)]
42// >
43// > > First reply of the first reply
44// > >
45// > > \- [@gnouser](/r/demo/users:gnouser), [2009-02-13 11:31pm (UTC)](/r/demo/boards:test_board/2/5) \[[reply](/r/demo/boards$help&func=CreateReply&bid=1&threadid=2&postid=5)] \[[x](/r/demo/boards$help&func=DeletePost&bid=1&threadid=2&postid=5)]
46//
47// > Second reply of the second post
48// >
49// > \- [@gnouser](/r/demo/users:gnouser), [2009-02-13 11:31pm (UTC)](/r/demo/boards:test_board/2/4) \[[reply](/r/demo/boards$help&func=CreateReply&bid=1&threadid=2&postid=4)] \[[x](/r/demo/boards$help&func=DeletePost&bid=1&threadid=2&postid=4)]
50//
z_6_filetest.gno
2.00 Kb ยท 50 lines