Skip to content

Commit 1b33e6d

Browse files
mpywclaude
andcommitted
refactor: Merge remaining test pairs
Merge 2 additional test pairs: - multipleFuncArgsBothGood + multipleFuncArgsBothBad -> multipleFuncArgsBoth - interfaceMethodWithCtxArgument + interfaceMethodWithoutCtxArgument -> interfaceMethodWithArgument Total tests reduced from 237 to 235. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent b0a0850 commit 1b33e6d

File tree

4 files changed

+51
-74
lines changed

4 files changed

+51
-74
lines changed

testdata/metatest/structure.json

Lines changed: 45 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1977,42 +1977,6 @@
19771977
},
19781978
"level": "advanced"
19791979
},
1980-
"interfaceMethodWithCtxArgument": {
1981-
"title": "Interface method with ctx argument",
1982-
"targets": [
1983-
"errgroup",
1984-
"waitgroup"
1985-
],
1986-
"variants": {
1987-
"good": {
1988-
"description": "Context is passed as argument to interface method.",
1989-
"functions": {
1990-
"errgroup": "goodInterfaceMethodWithCtxArg",
1991-
"waitgroup": "goodInterfaceMethodWithCtxArg"
1992-
}
1993-
},
1994-
"bad": null
1995-
},
1996-
"level": "evil"
1997-
},
1998-
"interfaceMethodWithoutCtxArgument": {
1999-
"title": "Interface method without ctx argument",
2000-
"targets": [
2001-
"errgroup",
2002-
"waitgroup"
2003-
],
2004-
"variants": {
2005-
"bad": {
2006-
"description": "Interface method call without context argument.",
2007-
"functions": {
2008-
"errgroup": "badInterfaceMethodWithoutCtxArg",
2009-
"waitgroup": "badInterfaceMethodWithoutCtxArg"
2010-
}
2011-
},
2012-
"good": null
2013-
},
2014-
"level": "evil"
2015-
},
20161980
"interleavedLayersCtxNoCtxCtxShadowing": {
20171981
"title": "Interleaved layers - ctx->no ctx->ctx shadowing",
20181982
"targets": [
@@ -2935,38 +2899,6 @@
29352899
},
29362900
"level": "basic"
29372901
},
2938-
"multipleFuncArgsBothBad": {
2939-
"title": "Multiple func args - both bad",
2940-
"targets": [
2941-
"goroutinecreator"
2942-
],
2943-
"variants": {
2944-
"bad": {
2945-
"description": "Multiple function arguments, none use context.",
2946-
"functions": {
2947-
"goroutinecreator": "badMultipleFuncs"
2948-
}
2949-
},
2950-
"good": null
2951-
},
2952-
"level": "creator"
2953-
},
2954-
"multipleFuncArgsBothGood": {
2955-
"title": "Multiple func args - both good",
2956-
"targets": [
2957-
"goroutinecreator"
2958-
],
2959-
"variants": {
2960-
"good": {
2961-
"description": "Multiple function arguments, all use context.",
2962-
"functions": {
2963-
"goroutinecreator": "goodMultipleFuncs"
2964-
}
2965-
},
2966-
"bad": null
2967-
},
2968-
"level": "creator"
2969-
},
29702902
"multipleFuncArgsFirstBad": {
29712903
"title": "Multiple func args - first bad",
29722904
"targets": [
@@ -4125,6 +4057,51 @@
41254057
}
41264058
}
41274059
}
4060+
},
4061+
"multipleFuncArgsBoth": {
4062+
"title": "Multiple func args - both context usage",
4063+
"targets": [
4064+
"goroutinecreator"
4065+
],
4066+
"level": "creator",
4067+
"variants": {
4068+
"good": {
4069+
"description": "Multiple function arguments, all use context.",
4070+
"functions": {
4071+
"goroutinecreator": "goodMultipleFuncs"
4072+
}
4073+
},
4074+
"bad": {
4075+
"description": "Multiple function arguments, none use context.",
4076+
"functions": {
4077+
"goroutinecreator": "badMultipleFuncs"
4078+
}
4079+
}
4080+
}
4081+
},
4082+
"interfaceMethodWithArgument": {
4083+
"title": "Interface method with argument",
4084+
"targets": [
4085+
"errgroup",
4086+
"waitgroup"
4087+
],
4088+
"level": "evil",
4089+
"variants": {
4090+
"good": {
4091+
"description": "Context is passed as argument to interface method.",
4092+
"functions": {
4093+
"errgroup": "goodInterfaceMethodWithCtxArg",
4094+
"waitgroup": "goodInterfaceMethodWithCtxArg"
4095+
}
4096+
},
4097+
"bad": {
4098+
"description": "Interface method call without context argument.",
4099+
"functions": {
4100+
"errgroup": "badInterfaceMethodWithoutCtxArg",
4101+
"waitgroup": "badInterfaceMethodWithoutCtxArg"
4102+
}
4103+
}
4104+
}
41284105
}
41294106
}
41304107
}

testdata/src/errgroup/evil.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ func (f *myFactory) CreateWorker(ctx context.Context) func() error {
164164
}
165165
}
166166

167-
// [GOOD]: Interface method with ctx argument
167+
// [GOOD]: Interface method with argument
168168
//
169169
// Context is passed as argument to interface method.
170170
//
@@ -181,7 +181,7 @@ type WorkerFactoryNoCtx interface {
181181
CreateWorker() func() error
182182
}
183183

184-
// [BAD]: Interface method without ctx argument
184+
// [BAD]: Interface method with argument
185185
//
186186
// Interface method call without context argument.
187187
//

testdata/src/goroutinecreator/creator.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func badInlineFuncLiteral(ctx context.Context) {
7070
_ = g.Wait()
7171
}
7272

73-
// [BAD]: Multiple func args - both bad
73+
// [BAD]: Multiple func args - both context usage
7474
//
7575
// Multiple function arguments, none use context.
7676
func badMultipleFuncs(ctx context.Context) {
@@ -139,7 +139,7 @@ func goodInlineFuncLiteral(ctx context.Context) {
139139
_ = g.Wait()
140140
}
141141

142-
// [GOOD]: Multiple func args - both good
142+
// [GOOD]: Multiple func args - both context usage
143143
//
144144
// Multiple function arguments, all use context.
145145
func goodMultipleFuncs(ctx context.Context) {

testdata/src/waitgroup/evil.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ func (f *myFactory) CreateWorker(ctx context.Context) func() {
157157
}
158158
}
159159

160-
// [GOOD]: Interface method with ctx argument
160+
// [GOOD]: Interface method with argument
161161
//
162162
// Context is passed as argument to interface method.
163163
//
@@ -174,7 +174,7 @@ type WorkerFactoryNoCtx interface {
174174
CreateWorker() func()
175175
}
176176

177-
// [BAD]: Interface method without ctx argument
177+
// [BAD]: Interface method with argument
178178
//
179179
// Interface method call without context argument.
180180
//

0 commit comments

Comments
 (0)