Skip to content

Commit c66cfc0

Browse files
authored
feat: Add test for Unicode styled word counting
1 parent c9fef8a commit c66cfc0

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/test/java/top/howiehz/halo/plugin/extra/api/utils/PostWordCountUtilTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ void testCountPlainTextWordsNullAndEmpty() {
7777

7878
@Test
7979
void safeCountAsciiWords() {
80-
// 测试英文单词计数
80+
// 测试英文单词/数字计数
8181
assertEquals(BigInteger.valueOf(3),
8282
PostWordCountUtil.countPlainTextWords("Hello world test"));
8383
assertEquals(BigInteger.valueOf(4),
@@ -86,6 +86,8 @@ void safeCountAsciiWords() {
8686
assertEquals(BigInteger.valueOf(2), PostWordCountUtil.countPlainTextWords("Hello world!"));
8787
assertEquals(BigInteger.valueOf(3), PostWordCountUtil.countPlainTextWords("Hello, Halo 2"));
8888
assertEquals(BigInteger.valueOf(2), PostWordCountUtil.countPlainTextWords("10.11"));
89+
// 𝓗𝑒𝓵𝓵𝑜 𝓌𝑜𝓇𝓁𝒹
90+
assertEquals(BigInteger.valueOf(2), PostWordCountUtil.countPlainTextWords("\uD835\uDCD7\uD835\uDC52\uD835\uDCF5\uD835\uDCF5\uD835\uDC5C \uD835\uDCCC\uD835\uDC5C\uD835\uDCC7\uD835\uDCC1\uD835\uDCB9"));
8991
}
9092

9193
@Test

0 commit comments

Comments
 (0)