Go Table Test Structure

🎓 A collection of things I've learned


Go Table Test Structure

Because I can never remember how to structure the for loop with t.Run inside it, and have to look at other projects every single time:

https://pkg.go.dev/gotest.tools/assert

func Test_NewFunction(t *testing.T) {
	tests := []struct {
		name string
	}{
		{
			name: "",
		},
	}

	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
      assert.Equal(t, tt.expected, actual)
		})
	}
}