-
Notifications
You must be signed in to change notification settings - Fork 399
/
Copy pathz_2_filetest.gno
43 lines (35 loc) · 1.38 KB
/
z_2_filetest.gno
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// PKGPATH: gno.land/r/demo/boards_test
package boards_test
// SEND: 200000000ugnot
import (
"std"
"strconv"
"gno.land/p/demo/testutils"
"gno.land/r/demo/boards"
"gno.land/r/demo/users"
)
var (
bid boards.BoardID
pid boards.PostID
)
func init() {
caller := testutils.TestAddress("caller")
std.TestSetRealm(std.NewUserRealm(caller))
users.Register("", "gnouser", "my profile")
bid = boards.CreateBoard("test_board")
boards.CreateThread(bid, "First Post (title)", "Body of the first post. (body)")
pid = boards.CreateThread(bid, "Second Post (title)", "Body of the second post. (body)")
boards.CreateReply(bid, pid, pid, "Reply of the second post")
}
func main() {
println(boards.Render("test_board/" + strconv.Itoa(int(pid))))
}
// Output:
// # Second Post (title)
//
// Body of the second post. (body)
// \- [@gnouser](/r/demo/users:gnouser), [2009-02-13 11:31pm (UTC)](/r/demo/boards:test_board/2) \[[reply](/r/demo/boards$help&func=CreateReply&bid=1&postid=2&threadid=2)] \[[repost](/r/demo/boards$help&func=CreateRepost&bid=1&postid=2)] \[[x](/r/demo/boards$help&func=DeletePost&bid=1&postid=2&threadid=2)]
//
// > Reply of the second post
// > \- [@gnouser](/r/demo/users:gnouser), [2009-02-13 11:31pm (UTC)](/r/demo/boards:test_board/2/3) \[[reply](/r/demo/boards$help&func=CreateReply&bid=1&postid=3&threadid=2)] \[[x](/r/demo/boards$help&func=DeletePost&bid=1&postid=3&threadid=2)]
//