mirror of https://github.com/halo-dev/halo
fix: checkstyle error. (#1375)
parent
15381e655e
commit
a2c9e42970
|
@ -11,9 +11,9 @@ import run.halo.app.utils.MarkdownUtils;
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class HTMLWordCountTest {
|
public class HTMLWordCountTest {
|
||||||
|
|
||||||
String markdownWithPicture = "图片字数测试\n" +
|
String markdownWithPicture = "图片字数测试\n"
|
||||||
"";
|
+ ".png)";
|
||||||
|
|
||||||
String markdownWithTitle = "# 标题字数测试";
|
String markdownWithTitle = "# 标题字数测试";
|
||||||
|
|
||||||
|
@ -23,35 +23,37 @@ public class HTMLWordCountTest {
|
||||||
|
|
||||||
String markdownWithLink = "[链接字数测试](https://www.baidu.com)";
|
String markdownWithLink = "[链接字数测试](https://www.baidu.com)";
|
||||||
|
|
||||||
String markdownWithTable =
|
String markdownWithTable = "|表格|字数|测试|\n"
|
||||||
"|表格|字数|测试|\n" +
|
+ "|-------|-------|-------|\n"
|
||||||
"|-------|-------|-------|\n" +
|
+ "|表格|字数|测试|\n";
|
||||||
"|表格|字数|测试|\n";
|
|
||||||
|
|
||||||
String plainText = "纯文本字数测试";
|
String plainText = "纯文本字数测试";
|
||||||
|
|
||||||
String complexText = "# 复杂文本测试\n\n" +
|
String complexText = "# 复杂文本测试\n\n"
|
||||||
"\n\n" +
|
+ ""
|
||||||
"++~~***复杂文本测试***~~++ `复杂文本测试` [复杂文本测试](https://halo.run)\n\n" +
|
+ "\n\n"
|
||||||
"|复杂|文本|测试|\n" +
|
+ "++~~***复杂文本测试***~~++ `复杂文本测试` [复杂文本测试](https://halo.run)\n\n"
|
||||||
"|-------|-------|-------|\n" +
|
+ "|复杂|文本|测试|\n"
|
||||||
"|复杂|文本|测试|\n\n" +
|
+ "|-------|-------|-------|\n"
|
||||||
"## 复杂文本测试\n";
|
+ "|复杂|文本|测试|\n\n"
|
||||||
|
+ "## 复杂文本测试\n";
|
||||||
|
|
||||||
String htmlText =
|
String htmlText =
|
||||||
"<body><h1>复杂文本测试 </h1>\n" +
|
"<body><h1>复杂文本测试 </h1>\n"
|
||||||
"<p><img src=\"http://127.0.0.1:8090/upload/2021/04/image-51142fdc369c48698dd75c24f6049738\" " +
|
+ "<p><img src=\"http://127.0.0"
|
||||||
"referrerpolicy=\"no-referrer\" alt=\"图片不算字数\"> \n" +
|
+ ".1:8090/upload/2021/04/image-51142fdc369c48698dd75c24f6049738\" "
|
||||||
"<del><strong><em>复杂文本测试</em></strong></del> <code>复杂文本测试</code> <a href='https://halo" +
|
+ "referrerpolicy=\"no-referrer\" alt=\"图片不算字数\"> \n"
|
||||||
".run'>复杂文本测试</a> </p>\n" +
|
+ "<del><strong><em>复杂文本测试</em></strong></del> <code>复杂文本测试</code> <a "
|
||||||
"<figure><table>\n" +
|
+ "href='https://halo"
|
||||||
"<thead>\n" +
|
+ ".run'>复杂文本测试</a> </p>\n"
|
||||||
"<tr><th>复杂</th><th>文本</th><th>测试</th></tr></thead>\n" +
|
+ "<figure><table>\n"
|
||||||
"<tbody><tr><td>复杂</td><td>文本</td><td>测试</td></tr></tbody>\n" +
|
+ "<thead>\n"
|
||||||
"</table></figure>\n" +
|
+ "<tr><th>复杂</th><th>文本</th><th>测试</th></tr></thead>\n"
|
||||||
"<h2>复杂文本测试</h2>\n" +
|
+ "<tbody><tr><td>复杂</td><td>文本</td><td>测试</td></tr></tbody>\n"
|
||||||
"</body>\n" +
|
+ "</table></figure>\n"
|
||||||
"</html>";
|
+ "<h2>复杂文本测试</h2>\n"
|
||||||
|
+ "</body>\n"
|
||||||
|
+ "</html>";
|
||||||
|
|
||||||
String nullString = null;
|
String nullString = null;
|
||||||
|
|
||||||
|
@ -72,13 +74,15 @@ public class HTMLWordCountTest {
|
||||||
@Test
|
@Test
|
||||||
void fontTypeTest() {
|
void fontTypeTest() {
|
||||||
assertEquals("字体样式字数测试".length(),
|
assertEquals("字体样式字数测试".length(),
|
||||||
BasePostServiceImpl.htmlFormatWordCount(MarkdownUtils.renderHtml(markdownWithFontType)));
|
BasePostServiceImpl
|
||||||
|
.htmlFormatWordCount(MarkdownUtils.renderHtml(markdownWithFontType)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void codeTypeTest() {
|
void codeTypeTest() {
|
||||||
assertEquals("代码样式字数测试".length(),
|
assertEquals("代码样式字数测试".length(),
|
||||||
BasePostServiceImpl.htmlFormatWordCount(MarkdownUtils.renderHtml(markdownWithCodeType)));
|
BasePostServiceImpl
|
||||||
|
.htmlFormatWordCount(MarkdownUtils.renderHtml(markdownWithCodeType)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue