Skip to content

Does not seem to work #10

@kunwardeep

Description

@kunwardeep

How to reproduce

1> go get github.com/golangci/golangci-lint/cmd/golangci-lint@master (as the latest change is not in the release)
2> Set the linter to use tParallel
3> Run golangci-lint run ./...

Code to run the tests on

package main

func Add(i, j int) int {
	return i + j
}

package main

import (
	"fmt"
	"testing"

	"github.com/stretchr/testify/assert"
)

func Test_Add(t *testing.T) {

	testCases := []struct {
		name           string
		val1           int
		val2           int
		expectedResult int
	}{
		{
			name:           "add correct",
			val1:           2,
			val2:           4,
			expectedResult: 6,
		},
		{
			name:           "add negative",
			val1:           -2,
			val2:           -4,
			expectedResult: -6,
		},
	}

	for _, tc := range testCases {
		fmt.Println(tc.name)
	}

	for _, tc := range testCases {
		t.Run(tc.name, func(t *testing.T) {

			assert.Equal(t, tc.expectedResult, Add(tc.val1, tc.val2))
		})
	}
}

Screen Shot 2020-10-16 at 5 04 03 pm

I would've expected the linter to tell me that there is no t.Parallel being called.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions