// PKGPATH: gno.land/r/gnoland/boards2/v1/filetests/z_hub_8_b_filetest // Test getting replies from a comment package z_hub_8_b_filetest import ( "testing" boards2 "gno.land/r/gnoland/boards2/v1" ) var comment boards2.Comment func init(cur realm) { testing.SetRealm(testing.NewUserRealm("g1rp7cmetn27eqlpjpc4vuusf8kaj746tysc0qgh")) boardID := boards2.CreateBoard(cross(cur), "test123", false, false) threadID := boards2.CreateThread(cross(cur), boardID, "Title", "Body") commentID := boards2.CreateReply(cross(cur), boardID, threadID, 0, "Comment") // Create replies boards2.CreateReply(cross(cur), boardID, threadID, commentID, "Reply 1") subCommentID := boards2.CreateReply(cross(cur), boardID, threadID, commentID, "Reply 2") // Add a sub-reply (it should not be included in the output) boards2.CreateReply(cross(cur), boardID, threadID, subCommentID, "Reply 3") // Get readonly comment comment, _ = boards2.GetComment(uint64(boardID), uint64(threadID), uint64(commentID)) } func main(cur realm) { replies := boards2.GetReplies(comment.BoardID(), comment.ThreadID(), comment.ID(), 0, comment.ReplyCount()) for _, r := range replies { println(r.ID(), r.Body()) } } // Output: // 3 Reply 1 // 4 Reply 2