(t *testing.T)
| 51 | } |
| 52 | |
| 53 | func TestEllipsis(t *testing.T) { |
| 54 | testcases := []struct { |
| 55 | source string |
| 56 | width int |
| 57 | expected string |
| 58 | }{ |
| 59 | {source: "t🐳ststring", width: 0, expected: ""}, |
| 60 | {source: "t🐳ststring", width: 1, expected: "t"}, |
| 61 | {source: "t🐳ststring", width: 2, expected: "t…"}, |
| 62 | {source: "t🐳ststring", width: 6, expected: "t🐳st…"}, |
| 63 | {source: "t🐳ststring", width: 20, expected: "t🐳ststring"}, |
| 64 | {source: "你好世界teststring", width: 0, expected: ""}, |
| 65 | {source: "你好世界teststring", width: 1, expected: "你"}, |
| 66 | {source: "你好世界teststring", width: 3, expected: "你…"}, |
| 67 | {source: "你好世界teststring", width: 6, expected: "你好…"}, |
| 68 | {source: "你好世界teststring", width: 20, expected: "你好世界teststring"}, |
| 69 | } |
| 70 | |
| 71 | for _, testcase := range testcases { |
| 72 | assert.Check(t, is.Equal(testcase.expected, Ellipsis(testcase.source, testcase.width))) |
| 73 | } |
| 74 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…