z_2_k_filetest.gno

0.74 Kb ยท 37 lines
 1package main
 2
 3import (
 4	"std"
 5	"testing"
 6
 7	boards2 "gno.land/r/gnoland/boards2/v1"
 8)
 9
10const (
11	owner   = std.Address("g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq") // @devx
12	comment = "Second comment"
13)
14
15var (
16	bid      boards2.BoardID
17	tid, rid boards2.PostID
18)
19
20func init() {
21	testing.SetRealm(std.NewUserRealm(owner))
22	bid = boards2.CreateBoard(cross, "test-board", false)
23	tid = boards2.CreateThread(cross, bid, "Foo", "bar")
24	rid = boards2.CreateReply(cross, bid, tid, 0, "Parent comment")
25
26	// Flag parent post so it's hidden
27	boards2.FlagReply(cross, bid, tid, rid, "")
28}
29
30func main() {
31	testing.SetRealm(std.NewUserRealm(owner))
32
33	boards2.CreateReply(cross, bid, tid, rid, "Sub comment")
34}
35
36// Error:
37// replying to a hidden or frozen reply is not allowed