mirror of
https://github.com/gocsaf/csaf.git
synced 2025-12-22 11:55:40 +01:00
Change checker to allow integration test coverage
* Add realMain() to allow a call with test argument redacted. * Add main_test to call realMain with arguments after `--`.
This commit is contained in:
parent
530a02742e
commit
6dada4fd14
2 changed files with 27 additions and 7 deletions
21
cmd/csaf_checker/main_test.go
Normal file
21
cmd/csaf_checker/main_test.go
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// call realMain() with Args that skip over params used by "go test"
|
||||
// allow calls like
|
||||
// go test -c -vet=off -covermode=atomic -o app.debug
|
||||
// ./app.debug -test.coverprofile=functest.cov -- --insecure localhost
|
||||
func TestMain(t *testing.T) {
|
||||
var endOfTestParams int
|
||||
for i, a := range os.Args[1:] {
|
||||
if a == "--" {
|
||||
endOfTestParams = i + 1
|
||||
}
|
||||
}
|
||||
|
||||
realMain(os.Args[endOfTestParams+1:])
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue