Skip to content

Commit b20cb99

Browse files
authored
fix: loop variable captured by func literal in parameters test (#5878)
I noticed this when adding a new parameter type. There's a test case for an empty string that returned false for validation, but appears like it could be true. If there is no value for a string, then the default is used. In this case there is no default, but that's technically fine I believe.
1 parent e663eaa commit b20cb99

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

coderd/workspacebuilds_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,7 @@ func TestWorkspaceBuildValidateRichParameters(t *testing.T) {
900900
{numberParameterName, "10", true, numberRichParameters},
901901
{numberParameterName, "11", false, numberRichParameters},
902902

903-
{stringParameterName, "", false, stringRichParameters},
903+
{stringParameterName, "", true, stringRichParameters},
904904
{stringParameterName, "foobar", true, stringRichParameters},
905905

906906
{stringParameterName, "abcd", true, regexRichParameters},
@@ -912,6 +912,7 @@ func TestWorkspaceBuildValidateRichParameters(t *testing.T) {
912912
}
913913

914914
for _, tc := range tests {
915+
tc := tc
915916
t.Run(tc.parameterName+"-"+tc.value, func(t *testing.T) {
916917
t.Parallel()
917918

0 commit comments

Comments
 (0)