Skip to content
Quiz · From a file to a project · lesson 8 of 10

Quiz — Fatalf in a subtest

Does the subtest TestHalf/4 run?

GO
func TestHalf(t *testing.T) {
    for _, n := range []int{2, 3, 4} {
        t.Run(fmt.Sprint(n), func(t *testing.T) {
            if n%2 != 0 {
                t.Fatalf("%d is odd", n)
            }
        })
    }
}

Subscribe to take the course

The course is free. Sign in with Telegram and subscribe to the channel to open every lesson.

Sign in another way