z_12_c_filetest.gno
0.70 Kb ยท 27 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 main() {
14 testing.SetRealm(std.NewUserRealm(std.Address("g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm"))) // so that CurrentRealm.Addr() matches OrigCaller
15 users.Register(cross, "gnouser123")
16 bid1 := boards.CreateBoard(cross, "test_board1")
17 boards.CreateThread(cross, bid1, "First Post (title)", "Body of the first post. (body)")
18 bid2 := boards.CreateBoard(cross, "test_board2")
19
20 // create a repost to a non-existing thread
21 rid := boards.CreateRepost(cross, bid1, 5, "", "Check this out", bid2)
22 println(rid)
23 println(boards.Render("test_board1"))
24}
25
26// Error:
27// thread not exist