fr
fr

Question from the Go test

Medium

Why is it recommended to use t.Run in a table-driven test loop?

for _, tc := range testCases {
    t.Run(tc.name, func(t *testing.T) {
        // Exécution du cas de test
        got := FunctionUnderTest(tc.input)
        if got != tc.want {
            t.Errorf("got %v, want %v", got, tc.want)
        }
    })
}
Author: WeLoveDevsStatus: PublishedQuestion not yet passed
Edit
0
Community EvaluationsNo one has reviewed this question yet, be the first!