z_0_a_filetest.gno

0.61 Kb ยท 27 lines
 1// PKGPATH: gno.land/r/demo/boards_test
 2package boards_test
 3
 4import (
 5	"std"
 6
 7	"gno.land/p/demo/testutils"
 8	"gno.land/r/demo/boards"
 9)
10
11var bid boards.BoardID
12
13func init() {
14	caller := testutils.TestAddress("caller")
15	std.TestSetRealm(std.NewUserRealm(caller))
16	bid = boards.CreateBoard("test_board")
17	boards.CreateThread(bid, "First Post (title)", "Body of the first post. (body)")
18	pid := boards.CreateThread(bid, "Second Post (title)", "Body of the second post. (body)")
19	boards.CreateReply(bid, pid, pid, "Reply of the second post")
20}
21
22func main() {
23	println(boards.Render("test_board"))
24}
25
26// Error:
27// unauthorized