From 98de2aabbafe8df495a546afae38f77fa889e3d8 Mon Sep 17 00:00:00 2001 From: Nico Braun <39703898+bluebrown@users.noreply.github.com> Date: Sat, 2 Sep 2023 22:50:54 +0200 Subject: [PATCH] test(lex): fix static check warning literalloopclosure (#18) * test(lex): fix literalloopclosure Signed-off-by: Nico Braun * fixup! test(lex): fix literalloopclosure --------- Signed-off-by: Nico Braun Co-authored-by: Jim --- lex_test.go | 2 ++ mql_test.go | 1 + mql_unexported_test.go | 1 + parser_test.go | 1 + tests/postgres/postgres_test.go | 4 ++-- 5 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lex_test.go b/lex_test.go index 8b0e970..9b5b689 100644 --- a/lex_test.go +++ b/lex_test.go @@ -161,6 +161,7 @@ func Test_lexKeywordState(t *testing.T) { }, } for _, tc := range tests { + tc := tc t.Run(tc.name, func(t *testing.T) { assert, require := assert.New(t), require.New(t) @@ -220,6 +221,7 @@ func Test_lexWhitespaceState(t *testing.T) { }, } for _, tc := range tests { + tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() assert, require := assert.New(t), require.New(t) diff --git a/mql_test.go b/mql_test.go index 52d5222..e4b4280 100644 --- a/mql_test.go +++ b/mql_test.go @@ -201,6 +201,7 @@ func TestParse(t *testing.T) { }, } for _, tc := range tests { + tc := tc t.Run(tc.name, func(t *testing.T) { assert, require := assert.New(t), require.New(t) whereClause, err := mql.Parse(tc.query, tc.model, tc.opts...) diff --git a/mql_unexported_test.go b/mql_unexported_test.go index 9dc6317..92f0dea 100644 --- a/mql_unexported_test.go +++ b/mql_unexported_test.go @@ -123,6 +123,7 @@ func Test_exprToWhereClause(t *testing.T) { }, } for _, tc := range tests { + tc := tc t.Run(tc.name, func(t *testing.T) { assert, require := assert.New(t), require.New(t) whereClause, err := exprToWhereClause(tc.expr, tc.validators, tc.opt...) diff --git a/parser_test.go b/parser_test.go index 5f88a4c..d723841 100644 --- a/parser_test.go +++ b/parser_test.go @@ -292,6 +292,7 @@ func Test_parser(t *testing.T) { }, } for _, tc := range tests { + tc := tc t.Run(tc.name, func(t *testing.T) { assert, require := assert.New(t), require.New(t) p := newParser(tc.raw) diff --git a/tests/postgres/postgres_test.go b/tests/postgres/postgres_test.go index 13c539f..eaca04c 100644 --- a/tests/postgres/postgres_test.go +++ b/tests/postgres/postgres_test.go @@ -58,8 +58,8 @@ func Test_postgres(t *testing.T) { }, } for _, tc := range tests { - testName := tc.name - t.Run(testName, func(t *testing.T) { + tc := tc + t.Run(tc.name, func(t *testing.T) { assert, require := assert.New(t), require.New(t) where, err := mql.Parse(tc.query, user{}, tc.opts...) if tc.wantErrContains != "" {