z_12_c_filetest.gno

0.68 Kb ยท 29 lines
 1// PKGPATH: gno.land/r/demo/boards_test
 2package boards_test
 3
 4// SEND: 200000000ugnot
 5
 6import (
 7	"std"
 8
 9	"gno.land/p/demo/testutils"
10	"gno.land/r/demo/boards"
11	"gno.land/r/demo/users"
12)
13
14func main() {
15	caller := testutils.TestAddress("caller")
16	std.TestSetRealm(std.NewUserRealm(caller))
17	users.Register("", "gnouser", "my profile")
18	bid1 := boards.CreateBoard("test_board1")
19	boards.CreateThread(bid1, "First Post (title)", "Body of the first post. (body)")
20	bid2 := boards.CreateBoard("test_board2")
21
22	// create a repost to a non-existing thread
23	rid := boards.CreateRepost(bid1, 5, "", "Check this out", bid2)
24	println(rid)
25	println(boards.Render("test_board1"))
26}
27
28// Error:
29// thread not exist