Search Apps Documentation Source Content File Folder Download Copy

z_9_filetest.gno

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