Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_20_d_filetest.gno

0.78 Kb ยท 36 lines
 1package main
 2
 3import (
 4	"testing"
 5
 6	boards2 "gno.land/r/gnoland/boards2/v1"
 7)
 8
 9const owner address = "g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq" // @devx
10
11var (
12	bid boards2.BoardID
13	tid boards2.PostID
14	rid boards2.PostID
15)
16
17func init() {
18	testing.SetRealm(testing.NewUserRealm(owner))
19	bid = boards2.CreateBoard(cross, "test123", false)
20	tid = boards2.CreateThread(cross, bid, "foo", "bar")
21	rid = boards2.CreateReply(cross, bid, tid, 0, "reply")
22}
23
24func main() {
25	testing.SetRealm(testing.NewUserRealm(owner))
26
27	// unfrozen thread - should work
28	boards2.CreateReply(cross, bid, tid, rid, "child 1")
29
30	// frozen thread - can't reply
31	boards2.FreezeReply(cross, bid, tid, rid)
32	boards2.CreateReply(cross, bid, tid, rid, "child 2")
33}
34
35// Error:
36// replying to a hidden or frozen reply is not allowed