From 8ebc6e616ceeb9e768a9ac800abeb69c0b85e2ca Mon Sep 17 00:00:00 2001 From: heerim hong Date: Sun, 21 Jul 2024 16:34:21 +0900 Subject: [PATCH] test: add test (shouldn't overflow when coloring already colored large text) --- tests/test.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/test.js b/tests/test.js index 04c99a7..8703238 100644 --- a/tests/test.js +++ b/tests/test.js @@ -156,6 +156,15 @@ test("non-string input", () => { assert.equal(pc.red(Infinity), FMT.red[0] + "Infinity" + FMT.red[1]) }) +test("shouldn't overflow when coloring already colored large text", () => { + try { + pc.blue(pc.red("x").repeat(10000)) + assert(true) + } catch { + assert(false) + } +}) + function test(name, fn) { try { fn()