(t *testing.T)
| 248 | } |
| 249 | |
| 250 | func TestAdjustLineWidth_TaskIDCorrectlyTruncated(t *testing.T) { |
| 251 | w := &ttyWriter{} |
| 252 | lines := []lineData{ |
| 253 | { |
| 254 | taskID: "very-long-image-name-that-exceeds-minimum-length", |
| 255 | status: "Pulling", |
| 256 | details: "", |
| 257 | }, |
| 258 | } |
| 259 | |
| 260 | terminalWidth := 40 |
| 261 | timerLen := 5 |
| 262 | w.adjustLineWidth(lines, timerLen, terminalWidth) |
| 263 | |
| 264 | lineWidth := 5 + len(lines[0].taskID) + 7 + timerLen |
| 265 | |
| 266 | assert.Assert(t, lineWidth <= terminalWidth, |
| 267 | "line width %d should not exceed terminal width %d (taskID=%q)", |
| 268 | lineWidth, terminalWidth, lines[0].taskID) |
| 269 | |
| 270 | assert.Assert(t, strings.HasSuffix(lines[0].taskID, "..."), "truncated taskID should end with ...") |
| 271 | } |
| 272 | |
| 273 | // TestAdjustLineWidth_MultiByteTaskIDFits guards against drift between |
| 274 | // applyPadding (rune-based) and maxBeforeStatusWidth (formerly byte-based): |
nothing calls this directly
no test coverage detected