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