z_9_b_filetest.gno

0.68 Kb ยท 31 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
13var (
14	srcBoard boards.BoardID
15	pid      boards.PostID
16)
17
18func init() {
19	testing.SetRealm(std.NewUserRealm(std.Address("g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm"))) // so that CurrentRealm.Addr() matches OrigCaller
20	cross(users.Register)("gnouser123")
21
22	srcBoard = cross(boards.CreateBoard)("first_board")
23	pid = cross(boards.CreateThread)(srcBoard, "First Post in (title)", "Body of the first post. (body)")
24}
25
26func main() {
27	cross(boards.CreateRepost)(srcBoard, pid, "First Post in (title)", "Body of the first post. (body)", 0)
28}
29
30// Error:
31// invalid non-user call