test: add ctor with comma-err

This commit is contained in:
Sebastien Binet 2015-07-29 16:57:53 +02:00
parent 79e0e447cb
commit 7fa9bcd9cd
1 changed files with 7 additions and 0 deletions

View File

@ -51,6 +51,13 @@ func NewPersonWithAge(age int) Person {
} }
} }
// NewActivePerson creates a new Person with a certain amount of work done.
func NewActivePerson(h int) (Person, error) {
var p Person
err := p.Work(h)
return p, err
}
func (p Person) String() string { func (p Person) String() string {
return fmt.Sprintf("hi.Person{Name=%q, Age=%d}", p.Name, p.Age) return fmt.Sprintf("hi.Person{Name=%q, Age=%d}", p.Name, p.Age)
} }