Skip to content

Commit

Permalink
add test case for len function
Browse files Browse the repository at this point in the history
Signed-off-by: czechbol <[email protected]>
  • Loading branch information
czechbol committed Aug 28, 2024
1 parent 2babcc4 commit 529f6b4
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions testutils/g115_samples.go
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,23 @@ func foo(x int) uint32 {
}
return uint32(x)
}
`,
}, 0, gosec.NewConfig()},
{[]string{
`
package main
import (
"math"
)
func foo(items []string) uint32 {
x := len(items)
if x > math.MaxUint32 {
return math.MaxUint32
}
return uint32(x)
}
`,
}, 0, gosec.NewConfig()},
}

0 comments on commit 529f6b4

Please sign in to comment.