// test function func TestIntroduction(t *testing.T) { for _, name := range personData { var p = person.NewPerson(name, 0) var answer = "Hello my name is " + name var result = p.Introduction() if result != answer { // raise error t.Error("For", name, "expected", answer, "got", result) } } }
// test function func TestName(t *testing.T) { for _, name := range personData { var p = person.NewPerson(name, 0) var answer = name var result = p.Name() if result != answer { // raise error t.Error("For", name, "expected", answer, "got", result) } } }
func main() { var p *person.Person = person.NewPerson("John", 21) fmt.Println(p) }