@@ -207,6 +207,61 @@ func TestFormatWithArgFormatting(t *testing.T) {
207207 }
208208}
209209
210+ func TestFormatWithArgFormattingForTypedSlice (t * testing.T ) {
211+ for name , test := range map [string ]struct {
212+ template string
213+ args []any
214+ expected string
215+ }{
216+ "list_with_int_slice" : {
217+ template : "This is a list(slice) test: {0:L-}" ,
218+ args : []any {[]int {101 , 202 , 303 }},
219+ expected : "This is a list(slice) test: 101-202-303" ,
220+ },
221+ "list_with_uint_slice" : {
222+ template : "This is a list(slice) test: {0:L-}" ,
223+ args : []any {[]uint {102 , 204 , 308 }},
224+ expected : "This is a list(slice) test: 102-204-308" ,
225+ },
226+ "list_with_int32_slice" : {
227+ template : "This is a list(slice) test: {0:L-}" ,
228+ args : []any {[]int32 {100 , 200 , 300 }},
229+ expected : "This is a list(slice) test: 100-200-300" ,
230+ },
231+ "list_with_int64_slice" : {
232+ template : "This is a list(slice) test: {0:L-}" ,
233+ args : []any {[]int64 {1001 , 2002 , 3003 }},
234+ expected : "This is a list(slice) test: 1001-2002-3003" ,
235+ },
236+ "list_with_float64_slice" : {
237+ template : "This is a list(slice) test: {0:L-}" ,
238+ args : []any {[]float64 {1.01 , 2.02 , 3.03 }},
239+ expected : "This is a list(slice) test: 1.01-2.02-3.03" ,
240+ },
241+ "list_with_float32_slice" : {
242+ template : "This is a list(slice) test: {0:L-}" ,
243+ args : []any {[]float32 {5.01 , 6.02 , 7.03 }},
244+ expected : "This is a list(slice) test: 5.01-6.02-7.03" ,
245+ },
246+ "list_with_bool_slice" : {
247+ template : "This is a list(slice) test: {0:L-}" ,
248+ args : []any {[]bool {true , true , false }},
249+ expected : "This is a list(slice) test: true-true-false" ,
250+ },
251+ "list_with_string_slice" : {
252+ template : "This is a list(slice) test: {0:L-}" ,
253+ args : []any {[]string {"s1" , "s2" , "s3" }},
254+ expected : "This is a list(slice) test: s1-s2-s3" ,
255+ },
256+ } {
257+ // Run test here
258+ t .Run (name , func (t * testing.T ) {
259+ // assert.NotNil(t, test)
260+ assert .Equal (t , test .expected , stringFormatter .Format (test .template , test .args ... ))
261+ })
262+ }
263+ }
264+
210265// TestStrFormatWithComplicatedText - this test represents issue with complicated text
211266func TestFormatComplex (t * testing.T ) {
212267 for name , test := range map [string ]struct {
0 commit comments