z_12_d_filetest.gno

0.71 Kb ยท 27 lines
 1package main
 2
 3// SEND: 1000000ugnot
 4
 5import (
 6	"std"
 7	"testing"
 8
 9	"gno.land/r/demo/boards"
10	users "gno.land/r/gnoland/users/v1"
11)
12
13func main() {
14	testing.SetRealm(std.NewUserRealm(std.Address("g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm"))) // so that CurrentRealm.Addr() matches OrigCaller
15	users.Register(cross, "gnouser123")
16	bid1 := boards.CreateBoard(cross, "test_board1")
17	pid := boards.CreateThread(cross, bid1, "First Post (title)", "Body of the first post. (body)")
18	boards.CreateBoard(cross, "test_board2")
19
20	// create a repost to a non-existing destination board
21	rid := boards.CreateRepost(cross, bid1, pid, "", "Check this out", 5)
22	println(rid)
23	println(boards.Render("test_board1"))
24}
25
26// Error:
27// dst board not exist