Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_12_c_filetest.gno

0.75 Kb · 26 lines
 1package main
 2
 3// SEND: 1000000ugnot
 4
 5import (
 6	"testing"
 7
 8	"gno.land/r/archive/boards"
 9	uinit "gno.land/r/sys/users/init"
10)
11
12func main() {
13	testing.SetRealm(testing.NewUserRealm(address("g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm"))) // so that CurrentRealm.Addr() matches OrigCaller
14	uinit.RegisterUser(cross, "gnouser123", address("g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm"))
15	bid1 := boards.CreateBoard(cross, "test_board1")
16	boards.CreateThread(cross, bid1, "First Post (title)", "Body of the first post. (body)")
17	bid2 := boards.CreateBoard(cross, "test_board2")
18
19	// create a repost to a non-existing thread
20	rid := boards.CreateRepost(cross, bid1, 5, "", "Check this out", bid2)
21	println(rid)
22	println(boards.Render("test_board1"))
23}
24
25// Error:
26// thread not exist