MCPcopy Index your code
hub / github.com/go-python/gopy / TestGetGoVersion

Function TestGetGoVersion

bind/utils_test.go:12–40  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestGetGoVersion(t *testing.T) {
13 for _, tt := range []struct {
14 info string
15 major int64
16 minor int64
17 err error
18 }{
19 {"go1.5", 1, 5, nil},
20 {"go1.6", 1, 6, nil},
21 {"go1.7", 1, 7, nil},
22 {"go1.8", 1, 8, nil},
23 {"gcc4", -1, -1, errors.New("gopy: invalid Go version information: \"gcc4\"")},
24 {"1.8go", -1, -1, errors.New("gopy: invalid Go version information: \"1.8go\"")},
25 {"llvm", -1, -1, errors.New("gopy: invalid Go version information: \"llvm\"")},
26 } {
27 major, minor, err := getGoVersion(tt.info)
28 if major != tt.major {
29 t.Errorf("getGoVersion(%s): expected major %d, actual %d", tt.info, tt.major, major)
30 }
31
32 if minor != tt.minor {
33 t.Errorf("getGoVersion(%s): expected major %d, actual %d", tt.info, tt.minor, minor)
34 }
35
36 if err != nil && err.Error() != tt.err.Error() {
37 t.Errorf("getGoVersion(%s): expected err %s, actual %s", tt.info, tt.err, err)
38 }
39 }
40}
41
42func TestExtractPythonName(t *testing.T) {
43 for _, tt := range []struct {

Callers

nothing calls this directly

Calls 2

getGoVersionFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected