Skip to content

Commit

Permalink
unittest Assert/IsOriginCall
Browse files Browse the repository at this point in the history
  • Loading branch information
tbruyelle committed Mar 5, 2023
1 parent f03123a commit dde938d
Show file tree
Hide file tree
Showing 36 changed files with 176 additions and 6 deletions.
3 changes: 3 additions & 0 deletions cmd/gnodev/test_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ func TestTest(t *testing.T) {
args: []string{"test", "--verbose", "--run", ".*/hi", "../../examples/gno.land/p/demo/ufmt"},
stdoutShouldContain: "RUN TestSprintf",
stderrShouldContain: "ok ./../../examples/gno.land/p/demo/ufmt",
}, {
args: []string{"test", "../../tests/integ/origin-call"},
stderrShouldContain: "ok ./../../tests/integ/origin-call",
}, {
args: []string{"test", "--verbose", "--run", ".*/NoExists", "../../examples/gno.land/p/demo/ufmt"},
stderrShouldContain: "ok ./../../examples/gno.land/p/demo/ufmt",
Expand Down
4 changes: 4 additions & 0 deletions examples/gno.land/r/demo/boards/z_0_a_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@
package boards_test

import (
"std"

"gno.land/p/demo/testutils"
"gno.land/r/demo/boards"
)

var bid boards.BoardID

func init() {
std.TestSetOrigCaller(testutils.TestAddress("test"))
bid = boards.CreateBoard("test_board")
boards.CreateThread(bid, "First Post (title)", "Body of the first post. (body)")
pid := boards.CreateThread(bid, "Second Post (title)", "Body of the second post. (body)")
Expand Down
4 changes: 4 additions & 0 deletions examples/gno.land/r/demo/boards/z_0_b_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@ package boards_test
// SEND: 199000000ugnot

import (
"std"

"gno.land/p/demo/testutils"
"gno.land/r/demo/boards"
"gno.land/r/demo/users"
)

var bid boards.BoardID

func init() {
std.TestSetOrigCaller(testutils.TestAddress("test"))
users.Register("", "gnouser", "my profile")
bid = boards.CreateBoard("test_board")
}
Expand Down
4 changes: 4 additions & 0 deletions examples/gno.land/r/demo/boards/z_0_c_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@ package boards_test
// SEND: 200000000ugnot

import (
"std"

"gno.land/p/demo/testutils"
"gno.land/r/demo/boards"
"gno.land/r/demo/users"
)

var bid boards.BoardID

func init() {
std.TestSetOrigCaller(testutils.TestAddress("test"))
users.Register("", "gnouser", "my profile")
boards.CreateThread(1, "First Post (title)", "Body of the first post. (body)")
}
Expand Down
4 changes: 4 additions & 0 deletions examples/gno.land/r/demo/boards/z_0_d_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@ package boards_test
// SEND: 200000000ugnot

import (
"std"

"gno.land/p/demo/testutils"
"gno.land/r/demo/boards"
"gno.land/r/demo/users"
)

var bid boards.BoardID

func init() {
std.TestSetOrigCaller(testutils.TestAddress("test"))
users.Register("", "gnouser", "my profile")
bid = boards.CreateBoard("test_board")
boards.CreateReply(bid, 0, 0, "Reply of the second post")
Expand Down
4 changes: 4 additions & 0 deletions examples/gno.land/r/demo/boards/z_0_e_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@ package boards_test
// SEND: 200000000ugnot

import (
"std"

"gno.land/p/demo/testutils"
"gno.land/r/demo/boards"
"gno.land/r/demo/users"
)

var bid boards.BoardID

func init() {
std.TestSetOrigCaller(testutils.TestAddress("test"))
users.Register("", "gnouser", "my profile")
boards.CreateReply(bid, 0, 0, "Reply of the second post")
}
Expand Down
4 changes: 4 additions & 0 deletions examples/gno.land/r/demo/boards/z_0_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@ package boards_test
// SEND: 200000000ugnot

import (
"std"

"gno.land/p/demo/testutils"
"gno.land/r/demo/boards"
"gno.land/r/demo/users"
)

var bid boards.BoardID

func init() {
std.TestSetOrigCaller(testutils.TestAddress("test"))
users.Register("", "gnouser", "my profile")

bid = boards.CreateBoard("test_board")
Expand Down
3 changes: 3 additions & 0 deletions examples/gno.land/r/demo/boards/z_10_a_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ package boards_test
// SEND: 200000000ugnot

import (
"std"
"strconv"

"gno.land/p/demo/testutils"
"gno.land/r/demo/boards"
"gno.land/r/demo/users"
)
Expand All @@ -16,6 +18,7 @@ var (
)

func init() {
std.TestSetOrigCaller(testutils.TestAddress("test"))
users.Register("", "gnouser", "my profile")

bid = boards.CreateBoard("test_board")
Expand Down
3 changes: 3 additions & 0 deletions examples/gno.land/r/demo/boards/z_10_b_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ package boards_test
// SEND: 2000000000ugnot

import (
"std"
"strconv"

"gno.land/p/demo/testutils"
"gno.land/r/demo/boards"
"gno.land/r/demo/users"
)
Expand All @@ -16,6 +18,7 @@ var (
)

func init() {
std.TestSetOrigCaller(testutils.TestAddress("test"))
users.Register("", "gnouser", "my profile")

bid = boards.CreateBoard("test_board")
Expand Down
3 changes: 3 additions & 0 deletions examples/gno.land/r/demo/boards/z_10_c_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ package boards_test
// SEND: 200000000ugnot

import (
"std"
"strconv"

"gno.land/p/demo/testutils"
"gno.land/r/demo/boards"
"gno.land/r/demo/users"
)
Expand All @@ -17,6 +19,7 @@ var (
)

func init() {
std.TestSetOrigCaller(testutils.TestAddress("test"))
users.Register("", "gnouser", "my profile")

bid = boards.CreateBoard("test_board")
Expand Down
3 changes: 3 additions & 0 deletions examples/gno.land/r/demo/boards/z_10_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ package boards_test
// SEND: 200000000ugnot

import (
"std"
"strconv"

"gno.land/p/demo/testutils"
"gno.land/r/demo/boards"
"gno.land/r/demo/users"
)
Expand All @@ -16,6 +18,7 @@ var (
)

func init() {
std.TestSetOrigCaller(testutils.TestAddress("test"))
users.Register("", "gnouser", "my profile")

bid = boards.CreateBoard("test_board")
Expand Down
3 changes: 3 additions & 0 deletions examples/gno.land/r/demo/boards/z_11_a_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ package boards_test
// SEND: 2000000000ugnot

import (
"std"
"strconv"

"gno.land/p/demo/testutils"
"gno.land/r/demo/boards"
"gno.land/r/demo/users"
)
Expand All @@ -16,6 +18,7 @@ var (
)

func init() {
std.TestSetOrigCaller(testutils.TestAddress("test"))
users.Register("", "gnouser", "my profile")

bid = boards.CreateBoard("test_board")
Expand Down
3 changes: 3 additions & 0 deletions examples/gno.land/r/demo/boards/z_11_b_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ package boards_test
// SEND: 2000000000ugnot

import (
"std"
"strconv"

"gno.land/p/demo/testutils"
"gno.land/r/demo/boards"
"gno.land/r/demo/users"
)
Expand All @@ -16,6 +18,7 @@ var (
)

func init() {
std.TestSetOrigCaller(testutils.TestAddress("test"))
users.Register("", "gnouser", "my profile")

bid = boards.CreateBoard("test_board")
Expand Down
3 changes: 3 additions & 0 deletions examples/gno.land/r/demo/boards/z_11_c_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ package boards_test
// SEND: 2000000000ugnot

import (
"std"
"strconv"

"gno.land/p/demo/testutils"
"gno.land/r/demo/boards"
"gno.land/r/demo/users"
)
Expand All @@ -16,6 +18,7 @@ var (
)

func init() {
std.TestSetOrigCaller(testutils.TestAddress("test"))
users.Register("", "gnouser", "my profile")

bid = boards.CreateBoard("test_board")
Expand Down
3 changes: 3 additions & 0 deletions examples/gno.land/r/demo/boards/z_11_d_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ package boards_test
// SEND: 2000000000ugnot

import (
"std"
"strconv"

"gno.land/p/demo/testutils"
"gno.land/r/demo/boards"
"gno.land/r/demo/users"
)
Expand All @@ -17,6 +19,7 @@ var (
)

func init() {
std.TestSetOrigCaller(testutils.TestAddress("test"))
users.Register("", "gnouser", "my profile")

bid = boards.CreateBoard("test_board")
Expand Down
3 changes: 3 additions & 0 deletions examples/gno.land/r/demo/boards/z_11_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ package boards_test
// SEND: 2000000000ugnot

import (
"std"
"strconv"

"gno.land/p/demo/testutils"
"gno.land/r/demo/boards"
"gno.land/r/demo/users"
)
Expand All @@ -16,6 +18,7 @@ var (
)

func init() {
std.TestSetOrigCaller(testutils.TestAddress("test"))
users.Register("", "gnouser", "my profile")

bid = boards.CreateBoard("test_board")
Expand Down
4 changes: 4 additions & 0 deletions examples/gno.land/r/demo/boards/z_1_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@ package boards_test
// SEND: 200000000ugnot

import (
"std"

"gno.land/p/demo/testutils"
"gno.land/r/demo/boards"
"gno.land/r/demo/users"
)

var board *boards.Board

func init() {
std.TestSetOrigCaller(testutils.TestAddress("test"))
users.Register("", "gnouser", "my profile")

_ = boards.CreateBoard("test_board_1")
Expand Down
3 changes: 3 additions & 0 deletions examples/gno.land/r/demo/boards/z_2_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ package boards_test
// SEND: 200000000ugnot

import (
"std"
"strconv"

"gno.land/p/demo/testutils"
"gno.land/r/demo/boards"
"gno.land/r/demo/users"
)
Expand All @@ -16,6 +18,7 @@ var (
)

func init() {
std.TestSetOrigCaller(testutils.TestAddress("test"))
users.Register("", "gnouser", "my profile")

bid = boards.CreateBoard("test_board")
Expand Down
3 changes: 3 additions & 0 deletions examples/gno.land/r/demo/boards/z_3_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ package boards_test
// SEND: 200000000ugnot

import (
"std"
"strconv"

"gno.land/p/demo/testutils"
"gno.land/r/demo/boards"
"gno.land/r/demo/users"
)
Expand All @@ -16,6 +18,7 @@ var (
)

func init() {
std.TestSetOrigCaller(testutils.TestAddress("test"))
users.Register("", "gnouser", "my profile")

bid = boards.CreateBoard("test_board")
Expand Down
9 changes: 6 additions & 3 deletions examples/gno.land/r/demo/boards/z_4_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ package boards_test
// SEND: 200000000ugnot

import (
"std"
"strconv"

"gno.land/p/demo/testutils"
"gno.land/r/demo/boards"
"gno.land/r/demo/users"
)
Expand All @@ -16,6 +18,7 @@ var (
)

func init() {
std.TestSetOrigCaller(testutils.TestAddress("test"))
users.Register("", "gnouser", "my profile")

bid = boards.CreateBoard("test_board")
Expand Down Expand Up @@ -458,7 +461,7 @@ func main() {
// },
// "V": {
// "@type": "/gno.StringValue",
// "value": "g1arjyc64rpthwn8zhxtzjvearm5scy43y7vm985"
// "value": "g1w3jhxazlta047h6lta047h6lta047h6lwmjv0n"
// }
// },
// {
Expand Down Expand Up @@ -837,7 +840,7 @@ func main() {
// },
// "V": {
// "@type": "/gno.StringValue",
// "value": "g1arjyc64rpthwn8zhxtzjvearm5scy43y7vm985"
// "value": "g1w3jhxazlta047h6lta047h6lta047h6lwmjv0n"
// }
// },
// {
Expand All @@ -847,7 +850,7 @@ func main() {
// },
// "V": {
// "@type": "/gno.RefValue",
// "Hash": "04bcdca23188f0e1b9a57b36c4bb33ed3cd72446",
// "Hash": "205f2a839a0ec5a5fb335cacca1cf87b1c2f5268",
// "ObjectID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:82"
// }
// },
Expand Down
1 change: 1 addition & 0 deletions examples/gno.land/r/demo/boards/z_5_b_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
const admin = std.Address("g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj")

func main() {
std.TestSetOrigCaller(testutils.TestAddress("test"))
users.Register("", "gnouser", "my profile")
// create board via registered user
bid := boards.CreateBoard("test_board")
Expand Down
Loading

0 comments on commit dde938d

Please sign in to comment.