Search Apps Documentation Source Content File Folder Download Copy

z_12_filetest.gno

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