71. GoってこんなコードGoってこんなコード
for _, sut := range []struct {
value string
description string
}{
{value: "1", description: "1です"},
{value: "2", description: "2です"},
{value: "3", description: "3です"},
} {
if !isNumeric(sut.value) {
t.Errorf("expected number , but actual %s. test case :%s", sut.value, sut.description)
}
}
・テーブルドリブンテスト
72. ・テーブルドリブンテスト
GoってこんなコードGoってこんなコード
for _, sut := range []struct {
value string
description string
}{
{value: "1", description: "1です"},
{value: "2", description: "2です"},
{value: "3", description: "3です"},
} {
if !isNumeric(sut.value) {
t.Errorf("expected number , but actual %s. test case :%s", sut.value, sut.description)
}
}
testケースをガッとまとめて
(語彙力)
73. ・テーブルドリブンテスト
GoってこんなコードGoってこんなコード
for _, sut := range []struct {
value string
description string
}{
{value: "1", description: "1です"},
{value: "2", description: "2です"},
{value: "3", description: "3です"},
} {
if !isNumeric(sut.value) {
t.Errorf("expected number , but actual %s. test case :%s", sut.value, sut.description)
}
}
ビャッと検証
(語彙力)