Skip to content

Commit 529f6b4

Browse files
committed
add test case for len function
Signed-off-by: czechbol <[email protected]>
1 parent 2babcc4 commit 529f6b4

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

testutils/g115_samples.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,23 @@ func foo(x int) uint32 {
493493
}
494494
return uint32(x)
495495
}
496+
`,
497+
}, 0, gosec.NewConfig()},
498+
{[]string{
499+
`
500+
package main
501+
502+
import (
503+
"math"
504+
)
505+
506+
func foo(items []string) uint32 {
507+
x := len(items)
508+
if x > math.MaxUint32 {
509+
return math.MaxUint32
510+
}
511+
return uint32(x)
512+
}
496513
`,
497514
}, 0, gosec.NewConfig()},
498515
}

0 commit comments

Comments
 (0)