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