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