z_commondao_execute_0_filetest.gno

0.87 Kb ยท 42 lines
 1// PKGPATH: gno.land/r/test
 2package test
 3
 4import (
 5	"time"
 6
 7	"gno.land/p/nt/commondao"
 8)
 9
10const member = address("g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq") // @devx
11
12var (
13	dao      *commondao.CommonDAO
14	proposal *commondao.Proposal
15)
16
17type testPropDef struct{}
18
19func (testPropDef) Title() string               { return "" }
20func (testPropDef) Body() string                { return "" }
21func (testPropDef) VotingPeriod() time.Duration { return 0 }
22func (testPropDef) Execute(cur realm) error     { return nil }
23
24func (testPropDef) Tally(commondao.ReadonlyVotingRecord, commondao.MemberSet) (bool, error) {
25	return true, nil
26}
27
28func init() {
29	dao = commondao.New(commondao.WithMember(member))
30	proposal = dao.MustPropose(member, testPropDef{})
31}
32
33func main() {
34	err := dao.Execute(proposal.ID())
35
36	println(err == nil)
37	println(string(proposal.Status()))
38}
39
40// Output:
41// true
42// passed