MCPcopy Create free account
hub / github.com/github/gh-aw / TestParseVersionValue

Function TestParseVersionValue

pkg/stringutil/stringutil_test.go:312–395  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

310}
311
312func TestParseVersionValue(t *testing.T) {
313 tests := []struct {
314 name string
315 version any
316 expected string
317 }{
318 // String versions
319 {
320 name: "string version",
321 version: "v1.2.3",
322 expected: "v1.2.3",
323 },
324 {
325 name: "numeric string",
326 version: "123",
327 expected: "123",
328 },
329 {
330 name: "empty string",
331 version: "",
332 expected: "",
333 },
334 // Integer versions
335 {
336 name: "int version",
337 version: 42,
338 expected: "42",
339 },
340 {
341 name: "int64 version",
342 version: int64(100),
343 expected: "100",
344 },
345 {
346 name: "uint64 version",
347 version: uint64(999),
348 expected: "999",
349 },
350 // Float versions
351 {
352 name: "float64 simple",
353 version: float64(1.5),
354 expected: "1.5",
355 },
356 {
357 name: "float64 whole number",
358 version: float64(2.0),
359 expected: "2",
360 },
361 {
362 name: "float64 with precision",
363 version: float64(1.234),
364 expected: "1.234",
365 },
366 // Unsupported types
367 {
368 name: "nil",
369 version: nil,

Callers

nothing calls this directly

Calls 2

ParseVersionValueFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected