Search Apps Documentation Source Content File Folder Download Copy

z_10_c_filetest.gno

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