1// PKGPATH: gno.land/r/demo/boards_test
2package boards_test
3
4// SEND: 20000000ugnot
5
6import (
7 "std"
8
9 "gno.land/p/demo/testutils"
10 "gno.land/r/demo/boards"
11 "gno.land/r/demo/users"
12)
13
14var bid boards.BoardID
15
16func init() {
17 caller := testutils.TestAddress("caller")
18 std.TestSetRealm(std.NewUserRealm(caller))
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"))
29}
30
31// Output:
32// \[[post](/r/demo/boards$help&func=CreateThread&bid=1)]
33//
34// ----------------------------------------
35// ## [First Post (title)](/r/demo/boards:test_board/1)
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) \[[x](/r/demo/boards$help&func=DeletePost&bid=1&postid=1&threadid=1)] (0 replies) (0 reposts)
39//
40// ----------------------------------------
41// ## [Second Post (title)](/r/demo/boards:test_board/2)
42//
43// Body of the second post. (body)
44// \- [@gnouser](/r/demo/users:gnouser), [2009-02-13 11:31pm UTC](/r/demo/boards:test_board/2) \[[x](/r/demo/boards$help&func=DeletePost&bid=1&postid=2&threadid=2)] (1 replies) (0 reposts)
45//
46//
z_0_filetest.gno
1.39 Kb ยท 46 lines