예제 #1
0
// 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)
		}
	}
}
예제 #2
0
// 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)
		}
	}
}
예제 #3
0
func main() {
	var p *person.Person = person.NewPerson("John", 21)
	fmt.Println(p)
}