Search Apps Documentation Source Content File Folder Download Copy Actions Download 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/v1/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/v1"
10)
11
12var thread boards2.Thread
13
14func init(cur realm) {
15	testing.SetRealm(testing.NewUserRealm("g1rp7cmetn27eqlpjpc4vuusf8kaj746tysc0qgh"))
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