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_hub_9_a_filetest.gno

1.19 Kb · 57 lines
 1// PKGPATH: gno.land/r/gnoland/boards2/v0/filetests/z_hub_9_a_filetest
 2
 3// Test default thread comment values
 4package z_hub_9_a_filetest
 5
 6import (
 7	"testing"
 8
 9	"gno.land/p/gnoland/boards/v0"
10
11	boards2 "gno.land/r/gnoland/boards2/v0"
12)
13
14var (
15	boardID   boards.ID
16	threadID  boards.ID
17	commentID boards.ID
18)
19
20func init(cur realm) {
21	testing.SetRealm(testing.NewUserRealm("g1skl80cuz8zq3lul9pgz5pc35l2pfzgxgfpsqkx"))
22	boardID = boards2.CreateBoard(cross(cur), "origin123", false, false)
23	threadID = boards2.CreateThread(cross(cur), boardID, "Title", "Body")
24	commentID = boards2.CreateReply(cross(cur), boardID, threadID, 0, "Comment")
25}
26
27func main(cur realm) {
28	comment, found := boards2.GetComment(uint64(boardID), uint64(threadID), uint64(commentID))
29	if !found {
30		return
31	}
32
33	println(comment.ID())
34	println(comment.BoardID())
35	println(comment.ThreadID())
36	println(comment.ParentID())
37	println(comment.Body())
38	println(comment.Hidden())
39	println(comment.ReplyCount())
40	println(comment.FlagCount())
41	println(comment.Creator())
42	println(comment.CreatedAt())
43	println(comment.UpdatedAt())
44}
45
46// Output:
47// 2
48// 1
49// 1
50// 1
51// Comment
52// false
53// 0
54// 0
55// g1skl80cuz8zq3lul9pgz5pc35l2pfzgxgfpsqkx
56// 1234567890
57// 0