Intermediate
Go (Golang)
Q82 / 100
What is table-driven testing in Go?
Correct! Well done.
Incorrect.
The correct answer is B) A pattern declaring test cases as a slice of structs with inputs and expected outputs, running each case in a subtest loop
B
Correct Answer
A pattern declaring test cases as a slice of structs with inputs and expected outputs, running each case in a subtest loop
Explanation
tests := []struct{in string; want int}{{"abc",3},{"",0}}; for _, tt := range tests { t.Run(tt.in, func(t *testing.T) { ... }) }
Progress
82/100