Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_commondao_must_execute_1_filetest.gno

0.60 Kb ยท 24 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 }
16func (testPropDef) Tally(commondao.VotingContext) (bool, error) { return true, nil }
17func (testPropDef) Execute(cur realm) error                     { return errors.New("boom!") }
18
19func main() {
20	commondao.MustExecute(testPropDef{})
21}
22
23// Error:
24// boom!