(t *testing.T)
| 143 | } |
| 144 | } |
| 145 | |
| 146 | func TestVersionMatchesSemver(t *testing.T) { |
| 147 | testCases := []struct { |
| 148 | name string |
| 149 | versionRange string |
| 150 | version string |
| 151 | want bool |
| 152 | wantErr bool |
| 153 | }{ |
| 154 | { |
| 155 | name: "version_matches_semver_range", |
| 156 | versionRange: ">=3.13.0", |
| 157 | version: "3.13.1", |
| 158 | want: true, |
| 159 | }, |
| 160 | { |
| 161 | name: "version_does_not_match_semver_range", |
| 162 | versionRange: ">=3.13.0", |
| 163 | version: "3.12.1", |
| 164 | want: false, |
| 165 | }, |
| 166 | { |
| 167 | name: "invalid_version_range", |
| 168 | versionRange: "3.13.0", |
| 169 | version: "3.12.1", |
| 170 | want: false, |
| 171 | }, |
| 172 | { |
| 173 | name: "invalid_version", |
| 174 | versionRange: ">=3.13.0", |
| 175 | version: "3.12.1a", |
| 176 | wantErr: true, |
| 177 | }, |
| 178 | } |
| 179 | for _, tc := range testCases { |
| 180 | t.Run(tc.name, func(t *testing.T) { |
| 181 | ctx := gcp.NewContext() |
| 182 | got, err := versionMatchesSemver(ctx, tc.versionRange, tc.version) |
| 183 | if tc.wantErr == (err == nil) { |
| 184 | t.Errorf("versionMatchesSemver(ctx, %q, %q) got error: %v, want err? %t", tc.versionRange, tc.version, err, tc.wantErr) |
| 185 | } |
| 186 | if got != tc.want { |
| 187 | t.Errorf("versionMatchesSemver(ctx, %q, %q) = %t, want %t", tc.versionRange, tc.version, got, tc.want) |
| 188 | } |
| 189 | }) |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | func TestSupportSmartDefaultEntrypoint(t *testing.T) { |
nothing calls this directly
no test coverage detected