Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_executor_1_filetest.gno

0.41 Kb · 29 lines
 1// PKGPATH: gno.land/r/definition/test
 2package test
 3
 4import (
 5	"errors"
 6
 7	"gno.land/p/nt/commondao/v0/exts/definition"
 8)
 9
10var wantErr = errors.New("test error")
11
12func executor(realm) error {
13	return wantErr
14}
15
16func main() {
17	// Arrange
18	def := definition.MustNew("Title", "Body", definition.WithExecutor(executor))
19	fn := def.Executor()
20
21	// Act
22	err := fn(cross)
23
24	// Assert
25	println(err == wantErr)
26}
27
28// Output:
29// true