(t *testing.T)
| 82 | } |
| 83 | |
| 84 | func TestParseVersion(t *testing.T) { |
| 85 | tests := []struct { |
| 86 | version string |
| 87 | major int |
| 88 | minor int |
| 89 | patch int |
| 90 | isCanary bool |
| 91 | canaryNum int |
| 92 | }{ |
| 93 | {"15.0.1", 15, 0, 1, false, 0}, |
| 94 | {"14.3.0-canary.77", 14, 3, 0, true, 77}, |
| 95 | {"v16.2.5", 16, 2, 5, false, 0}, |
| 96 | {"14.3.0-canary.100", 14, 3, 0, true, 100}, |
| 97 | {"13.5.6", 13, 5, 6, false, 0}, |
| 98 | } |
| 99 | |
| 100 | for _, tt := range tests { |
| 101 | t.Run(tt.version, func(t *testing.T) { |
| 102 | major, minor, patch, isCanary, canaryNum := parseVersion(tt.version) |
| 103 | if major != tt.major || minor != tt.minor || patch != tt.patch || |
| 104 | isCanary != tt.isCanary || canaryNum != tt.canaryNum { |
| 105 | t.Errorf("parseVersion(%s) = (%d, %d, %d, %v, %d), want (%d, %d, %d, %v, %d)", |
| 106 | tt.version, major, minor, patch, isCanary, canaryNum, |
| 107 | tt.major, tt.minor, tt.patch, tt.isCanary, tt.canaryNum) |
| 108 | } |
| 109 | }) |
| 110 | } |
| 111 | } |
nothing calls this directly
no test coverage detected