mirror of
https://github.com/github/codeql.git
synced 2025-12-23 12:16:33 +01:00
17 lines
477 B
Go
17 lines
477 B
Go
package toolchain
|
|
|
|
import "testing"
|
|
|
|
func TestParseGoVersion(t *testing.T) {
|
|
tests := map[string]string{
|
|
"go version go1.18.9 linux/amd64": "go1.18.9",
|
|
"warning: GOPATH set to GOROOT (/usr/local/go) has no effect\ngo version go1.18.9 linux/amd64": "go1.18.9",
|
|
}
|
|
for input, expected := range tests {
|
|
actual := parseGoVersion(input)
|
|
if actual != expected {
|
|
t.Errorf("Expected parseGoVersion(\"%s\") to be \"%s\", but got \"%s\".", input, expected, actual)
|
|
}
|
|
}
|
|
}
|