Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_commondao_must_execute_0_filetest.gno

0.77 Kb · 28 lines
 1// PKGPATH: gno.land/r/test
 2package test
 3
 4import (
 5	"testing"
 6	"time"
 7
 8	"gno.land/p/nt/commondao/v0"
 9)
10
11type testPropDef struct{}
12
13func (testPropDef) Title() string                               { return "" }
14func (testPropDef) Body() string                                { return "" }
15func (testPropDef) VotingPeriod() time.Duration                 { return 0 }
16func (testPropDef) Executor() commondao.ExecFunc                { return nil }
17func (testPropDef) Tally(commondao.VotingContext) (bool, error) { return true, nil }
18
19func main() {
20	// Make sure proposal is executed in a realm different than the one where definitions has been defined
21	testing.SetRealm(testing.NewCodeRealm("gno.land/r/testing/dao"))
22
23	commondao.MustExecute(testPropDef{})
24	println("ok")
25}
26
27// Output:
28// ok