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

0.85 Kb · 30 lines
 1// PKGPATH: gno.land/r/gnoland/boards2/v0/filetests/z_hub_8_a_filetest
 2
 3// Test getting replies from a comment without replies
 4package z_hub_8_a_filetest
 5
 6import (
 7	"testing"
 8
 9	boards2 "gno.land/r/gnoland/boards2/v0"
10)
11
12var comment boards2.Comment
13
14func init(cur realm) {
15	testing.SetRealm(testing.NewUserRealm("g1skl80cuz8zq3lul9pgz5pc35l2pfzgxgfpsqkx"))
16	boardID := boards2.CreateBoard(cross(cur), "test123", false, false)
17	threadID := boards2.CreateThread(cross(cur), boardID, "Title", "Body")
18	commentID := boards2.CreateReply(cross(cur), boardID, threadID, 0, "Comment")
19
20	// Get readonly comment
21	comment, _ = boards2.GetComment(uint64(boardID), uint64(threadID), uint64(commentID))
22}
23
24func main(cur realm) {
25	replies := boards2.GetReplies(comment.BoardID(), comment.ThreadID(), comment.ID(), 0, comment.ReplyCount())
26	println(len(replies))
27}
28
29// Output:
30// 0