z_12_b_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 cross(users.Register)("gnouser123")
16 bid1 := cross(boards.CreateBoard)("test_board1")
17 pid := cross(boards.CreateThread)(bid1, "First Post (title)", "Body of the first post. (body)")
18 bid2 := cross(boards.CreateBoard)("test_board2")
19
20 // create a repost to a non-existing board
21 rid := cross(boards.CreateRepost)(5, pid, "", "Check this out", bid2)
22 println(rid)
23 println(boards.Render("test_board1"))
24}
25
26// Error:
27// src board not exist