z_commondao_must_execute_1_filetest.gno
0.57 Kb ยท 30 lines
1// PKGPATH: gno.land/r/test
2package test
3
4import (
5 "errors"
6 "time"
7
8 "gno.land/p/nt/commondao"
9)
10
11type testPropDef struct{}
12
13func (testPropDef) Title() string { return "" }
14func (testPropDef) Body() string { return "" }
15func (testPropDef) VotingPeriod() time.Duration { return 0 }
16
17func (testPropDef) Tally(commondao.ReadonlyVotingRecord, commondao.MemberSet) (bool, error) {
18 return true, nil
19}
20
21func (testPropDef) Execute(cur realm) error {
22 return errors.New("boom!")
23}
24
25func main() {
26 commondao.MustExecute(testPropDef{})
27}
28
29// Error:
30// boom!