z_7_filetest.gno

0.94 Kb ยท 36 lines
 1package main
 2
 3// SEND: 1000000ugnot
 4
 5import (
 6	"std"
 7	"testing"
 8
 9	"gno.land/r/demo/boards"
10	users "gno.land/r/gnoland/users/v1"
11)
12
13func init() {
14	// register
15	testing.SetRealm(std.NewUserRealm(std.Address("g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm"))) // so that CurrentRealm.Addr() matches OrigCaller
16	users.Register(cross, "gnouser123")
17
18	// create board and post
19	bid := boards.CreateBoard(cross, "test_board")
20	boards.CreateThread(cross, bid, "First Post (title)", "Body of the first post. (body)")
21}
22
23func main() {
24	println(boards.Render("test_board"))
25}
26
27// Output:
28// \[[post](/r/demo/boards$help&func=CreateThread&bid=1)]
29//
30// ----------------------------------------
31// ## [First Post (title)](/r/demo/boards:test_board/1)
32//
33// Body of the first post. (body)
34// \- [@gnouser123](/u/gnouser123), [2009-02-13 11:31pm UTC](/r/demo/boards:test_board/1) \[[x](/r/demo/boards$help&func=DeletePost&bid=1&postid=1&threadid=1)] (0 replies) (0 reposts)
35//
36//