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

0.73 Kb · 29 lines
 1// PKGPATH: gno.land/r/gnoland/boards2/v0/filetests/z_hub_7_a_filetest
 2
 3// Test getting comments from a thread without comments
 4package z_hub_7_a_filetest
 5
 6import (
 7	"testing"
 8
 9	boards2 "gno.land/r/gnoland/boards2/v0"
10)
11
12var thread boards2.Thread
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
19	// Get readonly thread
20	thread, _ = boards2.GetThread(uint64(boardID), uint64(threadID))
21}
22
23func main(cur realm) {
24	comments := boards2.GetComments(thread.BoardID(), thread.ID(), 0, thread.CommentCount())
25	println(len(comments))
26}
27
28// Output:
29// 0