TestSpec_PublicAPI_ParseVersionValue validates the documented behavior of ParseVersionValue as described in the package README.md. Specification examples: stringutil.ParseVersionValue("20") // "20" stringutil.ParseVersionValue(20) // "20" stringutil.ParseVersionValue(20.0) // "20" S
(t *testing.T)
| 106 | // |
| 107 | // Spec also states: "Returns an empty string for nil." |
| 108 | func TestSpec_PublicAPI_ParseVersionValue(t *testing.T) { |
| 109 | tests := []struct { |
| 110 | name string |
| 111 | input any |
| 112 | expected string |
| 113 | }{ |
| 114 | { |
| 115 | name: "string input '20' returns '20' (documented example)", |
| 116 | input: "20", |
| 117 | expected: "20", |
| 118 | }, |
| 119 | { |
| 120 | name: "int input 20 returns '20' (documented example)", |
| 121 | input: 20, |
| 122 | expected: "20", |
| 123 | }, |
| 124 | { |
| 125 | name: "float64 input 20.0 returns '20' (documented example)", |
| 126 | input: 20.0, |
| 127 | expected: "20", |
| 128 | }, |
| 129 | { |
| 130 | name: "nil input returns empty string (documented)", |
| 131 | input: nil, |
| 132 | expected: "", |
| 133 | }, |
| 134 | } |
| 135 | |
| 136 | for _, tt := range tests { |
| 137 | t.Run(tt.name, func(t *testing.T) { |
| 138 | result := ParseVersionValue(tt.input) |
| 139 | assert.Equal(t, tt.expected, result, |
| 140 | "ParseVersionValue(%v) should match documented output", tt.input) |
| 141 | }) |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | // TestSpec_PublicAPI_IsPositiveInteger validates the documented behavior of |
| 146 | // IsPositiveInteger as described in the package README.md. |
nothing calls this directly
no test coverage detected