package parser import "testing" // Emphasis closed by CJK punctuation and followed by CJK text, as // Chinese writes it without spaces. func TestCJKEmphasis(t *testing.T) { for src, want := range map[string]string{ "**五种方式都能承载。**下面是判断": "

五种方式都能承载。下面是判断

\n", "**已有可靠内网:直接 HTTP。**接入成本最低。": "

已有可靠内网:直接 HTTP。接入成本最低。

\n", "针对你强调的**“简单”**,我会这样选": "

针对你强调的“简单”,我会这样选

\n", "~~删除。~~保留": "

删除。保留

\n", "snake_case_name": "

snake_case_name

\n", "a **b** c": "

a b c

\n", // _ and a single ~ keep CommonMark's rule next to CJK text. "中文__粗体。__后文": "

中文__粗体。__后文

\n", "第1章~“附录”和“序”~第3章": "

第1章~“附录”和“序”~第3章

\n", // Latin text with curly quotes reads as before. "He said “*hello*” to me.": "

He said “hello” to me.

\n", "**Alice**’s and **Bob**’s toys": "

Alice’s and Bob’s toys

\n", } { if got := render(src, Default); got != want { t.Errorf("%q: got %q, want %q", src, got, want) } } }