From 068502c9b491accf51f2c794587e91380c75111e Mon Sep 17 00:00:00 2001 From: Tim Reichen Date: Thu, 2 Nov 2023 00:10:43 +0100 Subject: [PATCH] refactor(console): format test names (#3756) refactor test names --- console/unicode_width_test.ts | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/console/unicode_width_test.ts b/console/unicode_width_test.ts index 7b3b2da16558..1b31a33674a5 100644 --- a/console/unicode_width_test.ts +++ b/console/unicode_width_test.ts @@ -3,40 +3,38 @@ import { unicodeWidth } from "./unicode_width.ts"; import { assertEquals } from "../assert/mod.ts"; -Deno.test("unicodeWidth", async (t) => { - await t.step("ASCII", () => { +Deno.test("unicodeWidth()", async (t) => { + await t.step("checks ASCII input", () => { const lorem = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; assertEquals(unicodeWidth(lorem), lorem.length); }); - await t.step("CJK", () => { + await t.step("checks CJK input", () => { const qianZiWen = "天地玄黃宇宙洪荒日月盈昃辰宿列張寒來暑往秋收冬藏閏餘成歲律呂調陽雲騰致雨露結爲霜金生麗水玉出崑岡劍號巨闕珠稱夜光果珍李柰菜重芥薑海鹹河淡鱗潛羽翔龍師火帝鳥官人皇始制文字乃服衣裳推位讓國有虞陶唐弔民伐罪周發殷湯坐朝問道垂拱平章愛育黎首臣伏戎羌遐邇壹體率賓歸王鳴鳳在樹白駒食場化被草木賴及萬方蓋此身髮四大五常恭惟鞠養豈敢毀傷女慕貞絜男效才良知過必改得能莫忘罔談彼短靡恃己長信使可覆器欲難量墨悲絲淬詩讚羔羊"; assertEquals(unicodeWidth(qianZiWen), qianZiWen.length * 2); }); - await t.step("Unicode normalization", async (t) => { - const str = "á"; + const str = "á"; - await t.step("NFC", () => { - const nfc = str.normalize("NFC"); + await t.step("checks NFC normalized input", () => { + const nfc = str.normalize("NFC"); - assertEquals(nfc.length, 1); - assertEquals(unicodeWidth(nfc), 1); - }); + assertEquals(nfc.length, 1); + assertEquals(unicodeWidth(nfc), 1); + }); - await t.step("NFD", () => { - const nfd = str.normalize("NFD"); + await t.step("checks NFD normalized input", () => { + const nfd = str.normalize("NFD"); - assertEquals(nfd.length, 2); - assertEquals(unicodeWidth(nfd), 1); - }); + assertEquals(nfd.length, 2); + assertEquals(unicodeWidth(nfd), 1); }); - await t.step("Emoji", () => { + await t.step("checks emoji input", () => { assertEquals(unicodeWidth("👩"), 2); // Woman assertEquals(unicodeWidth("🔬"), 2); // Microscope // Note: Returns 4 for the below case, following the upstream crate