-
Notifications
You must be signed in to change notification settings - Fork 399
/
Copy pathz_5_c_filetest.gno
42 lines (33 loc) · 1.58 KB
/
z_5_c_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
package main
// SEND: 200000000ugnot
import (
"std"
"strconv"
"gno.land/p/demo/testutils"
"gno.land/r/demo/boards"
"gno.land/r/demo/users"
)
const admin = std.Address("g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj")
func main() {
caller := testutils.TestAddress("caller")
std.TestSetRealm(std.NewUserRealm(caller))
users.Register("", "gnouser", "my profile")
// create board via registered user
bid := boards.CreateBoard("test_board")
// create post via anon user
test2 := testutils.TestAddress("test2")
std.TestSetOriginCaller(test2)
std.TestSetOriginSend(std.Coins{{"ugnot", 101000000}}, nil)
pid := boards.CreateThread(bid, "First Post (title)", "Body of the first post. (body)")
boards.CreateReply(bid, pid, pid, "Reply of the first post")
println(boards.Render("test_board/" + strconv.Itoa(int(pid))))
}
// Output:
// # First Post (title)
//
// Body of the first post. (body)
// \- [g1w3jhxapjta047h6lta047h6lta047h6laqcyu4](/r/demo/users:g1w3jhxapjta047h6lta047h6lta047h6laqcyu4), [2009-02-13 11:31pm (UTC)](/r/demo/boards:test_board/1) \[[reply](/r/demo/boards$help&func=CreateReply&bid=1&postid=1&threadid=1)] \[[repost](/r/demo/boards$help&func=CreateRepost&bid=1&postid=1)] \[[x](/r/demo/boards$help&func=DeletePost&bid=1&postid=1&threadid=1)]
//
// > Reply of the first post
// > \- [g1w3jhxapjta047h6lta047h6lta047h6laqcyu4](/r/demo/users:g1w3jhxapjta047h6lta047h6lta047h6laqcyu4), [2009-02-13 11:31pm (UTC)](/r/demo/boards:test_board/1/2) \[[reply](/r/demo/boards$help&func=CreateReply&bid=1&postid=2&threadid=1)] \[[x](/r/demo/boards$help&func=DeletePost&bid=1&postid=2&threadid=1)]
//