mirror of
https://github.com/crazybber/go-pattern-examples.git
synced 2024-11-23 04:16:02 +03:00
21 lines
374 B
Go
21 lines
374 B
Go
|
package simplefactory
|
||
|
|
||
|
import "testing"
|
||
|
|
||
|
//TestTeacher test get New with factory
|
||
|
func TestTeacher(t *testing.T) {
|
||
|
te := New(teacher)
|
||
|
name := te.Say("Tom")
|
||
|
if name != "I am Teacher: Tom" {
|
||
|
t.Fatal("Teacher test fail")
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func TestStudent(t *testing.T) {
|
||
|
st := New(student)
|
||
|
name := st.Say("Tom")
|
||
|
if name != "I am student: Tom" {
|
||
|
t.Fatal("student test fail")
|
||
|
}
|
||
|
}
|