Skip to content Search Apps Documentation Source Content Run Reset Eval Playground File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

z_create_reply_10_filetest.gno

0.91 Kb · 40 lines
 1// PKGPATH: gno.land/r/gnoland/boards2/v0/filetests/z_create_reply_10_filetest
 2
 3package z_create_reply_10_filetest
 4
 5import (
 6	"testing"
 7
 8	"gno.land/p/gnoland/boards/v0"
 9
10	boards2 "gno.land/r/gnoland/boards2/v0"
11)
12
13const (
14	owner   address = "g1skl80cuz8zq3lul9pgz5pc35l2pfzgxgfpsqkx"
15	comment         = "Second comment"
16)
17
18var (
19	bid      boards.ID
20	tid, rid boards.ID
21)
22
23func init(cur realm) {
24	testing.SetRealm(testing.NewUserRealm(owner))
25	bid = boards2.CreateBoard(cross(cur), "test-board", false, false)
26	tid = boards2.CreateThread(cross(cur), bid, "Foo", "bar")
27	rid = boards2.CreateReply(cross(cur), bid, tid, 0, "Parent comment")
28
29	// Flag parent post so it's hidden
30	boards2.FlagReply(cross(cur), bid, tid, rid, "Reason")
31}
32
33func main(cur realm) {
34	testing.SetRealm(testing.NewUserRealm(owner))
35
36	boards2.CreateReply(cross(cur), bid, tid, rid, "Sub comment")
37}
38
39// Error:
40// replying to a hidden or frozen reply is not allowed