| 123456789 |
- import { expect, test } from "bun:test"
- import { Locale } from "../../src/util/locale"
- test("truncates text from the right by terminal width", () => {
- expect(Locale.truncateWidth("abcdefgh", 5)).toBe("abcd…")
- expect(Locale.truncateWidth("ab界cd", 5)).toBe("ab界…")
- expect(Locale.truncateWidth("abcdefgh", 1)).toBe("…")
- expect(Locale.truncateWidth("abcdefgh", 0)).toBe("")
- })
|