z_10_a_filetest.gno
0.87 Kb · 34 lines
1package main
2
3// SEND: 1000000ugnot
4import (
5 "strconv"
6 "testing"
7
8 "gno.land/r/archive/boards"
9 uinit "gno.land/r/sys/users/init"
10)
11
12var (
13 bid boards.BoardID
14 pid boards.PostID
15)
16
17func init() {
18 testing.SetRealm(testing.NewUserRealm(address("g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm"))) // so that CurrentRealm.Addr() matches OrigCaller
19 uinit.RegisterUser(cross, "gnouser123", address("g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm"))
20
21 bid = boards.CreateBoard(cross, "test_board")
22 pid = boards.CreateThread(cross, bid, "First Post in (title)", "Body of the first post. (body)")
23}
24
25func main() {
26 println(boards.Render("test_board/" + strconv.Itoa(int(pid))))
27 // boardId 2 not exist
28 boards.DeletePost(cross, 2, pid, pid, "")
29 println("----------------------------------------------------")
30 println(boards.Render("test_board/" + strconv.Itoa(int(pid))))
31}
32
33// Error:
34// invalid non-user call