@@ -290,3 +290,73 @@ func TestPrintTableNoDataCustomMessage(t *testing.T) {
290290 })
291291 assert .Equal (t , "No cats found.\n " , stdOut .String ())
292292}
293+
294+ func TestPrintTableWithEmojiVariationSelectors (t * testing.T ) {
295+ p , stdOut , _ := setupPrinter ()
296+ p .SetUseColor (false )
297+ p .Table (TableData {
298+ Header : []string {"Name" , "Status" , "Description" },
299+ Data : [][]interface {}{
300+ {"Anton's demo dashboard 🌪️" , "Active" , "Weather dashboard" },
301+ {"Fire tracker 🔥️" , "Inactive" , "Fire monitoring" },
302+ {"Regular dashboard" , "Active" , "No emojis here" },
303+ {"Mixed ️🌪️ selectors️" , "Testing" , "Complex case" },
304+ },
305+ })
306+
307+ // Expected output should have variation selectors removed
308+ //nolint:lll
309+ expected := "NAME | STATUS | DESCRIPTION \n Anton's demo dashboard 🌪 | Active | Weather dashboard\n Fire tracker 🔥 | Inactive | Fire monitoring \n Regular dashboard | Active | No emojis here \n Mixed 🌪 selectors | Testing | Complex case \n "
310+ assert .Equal (t , expected , stdOut .String ())
311+ }
312+
313+ func TestRemoveEmojiVariationSelectors (t * testing.T ) {
314+ tests := []struct {
315+ name string
316+ input string
317+ expected string
318+ }{
319+ {
320+ name : "text with variation selector 16 (emoji presentation)" ,
321+ input : "Anton's demo dashboard 🌪️" ,
322+ expected : "Anton's demo dashboard 🌪" ,
323+ },
324+ {
325+ name : "text with variation selector 15 (text presentation)" ,
326+ input : "Number 1️⃣ with text selector" ,
327+ expected : "Number 1⃣ with text selector" ,
328+ },
329+ {
330+ name : "text without variation selectors" ,
331+ input : "Regular text with emoji 🚀" ,
332+ expected : "Regular text with emoji 🚀" ,
333+ },
334+ {
335+ name : "empty string" ,
336+ input : "" ,
337+ expected : "" ,
338+ },
339+ {
340+ name : "only variation selectors" ,
341+ input : "\uFE0E \uFE0F " ,
342+ expected : "" ,
343+ },
344+ {
345+ name : "multiple emojis with and without selectors" ,
346+ input : "Fire 🔥️ and water 💧 tornado 🌪️ rocket 🚀" ,
347+ expected : "Fire 🔥 and water 💧 tornado 🌪 rocket 🚀" ,
348+ },
349+ {
350+ name : "text with both variation selectors" ,
351+ input : "Mix️ed\uFE0E selectors️" ,
352+ expected : "Mixed selectors" ,
353+ },
354+ }
355+
356+ for _ , tt := range tests {
357+ t .Run (tt .name , func (t * testing.T ) {
358+ result := removeEmojiVariationSelectors (tt .input )
359+ assert .Equal (t , tt .expected , result )
360+ })
361+ }
362+ }
0 commit comments