Skip to content

Commit 401c362

Browse files
committed
Extract initGame() in typinggame_test
1 parent cea0f8e commit 401c362

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

kadai3-1/lfcd85/typinggame/typinggame_test.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,23 @@ import (
99
"github.com/gopherdojo/dojo5/kadai3-1/lfcd85/typinggame"
1010
)
1111

12-
func TestExecute(t *testing.T) {
13-
g := typinggame.Game{
12+
func initGame() typinggame.Game {
13+
return typinggame.Game{
1414
typinggame.Words{"hoge"},
1515
1 * time.Second,
1616
}
17+
}
18+
19+
func TestExecute(t *testing.T) {
20+
g := initGame()
1721

1822
if err := typinggame.Execute(g); err != nil {
1923
t.Errorf("failed to execute new game: %v", err)
2024
}
2125
}
2226

2327
func TestGame_run(t *testing.T) {
24-
g := typinggame.Game{
25-
typinggame.Words{"hoge"},
26-
1 * time.Second,
27-
}
28+
g := initGame()
2829

2930
ch := make(chan string)
3031
go func() {

0 commit comments

Comments
 (0)