-
Notifications
You must be signed in to change notification settings - Fork 399
/
Copy pathz_11_filetest.gno
49 lines (41 loc) · 1.72 KB
/
z_11_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
44
45
46
47
48
49
// 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")
pid = boards.CreateThread(bid, "First Post in (title)", "Body of the first post. (body)")
}
func main() {
println(boards.Render("test_board/" + strconv.Itoa(int(pid))))
caller := testutils.TestAddress("caller")
std.TestSetRealm(std.NewUserRealm(caller))
boards.EditPost(bid, pid, pid, "Edited: First Post in (title)", "Edited: Body of the first post. (body)")
println("----------------------------------------------------")
println(boards.Render("test_board/" + strconv.Itoa(int(pid))))
}
// Output:
// # First Post in (title)
//
// Body of the first post. (body)
// \- [@gnouser](/r/demo/users:gnouser), [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)]
//
// ----------------------------------------------------
// # Edited: First Post in (title)
//
// Edited: Body of the first post. (body)
// \- [@gnouser](/r/demo/users:gnouser), [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)]
//