From d6cd4baf390d38a63f5478de70fc99f46a511fa0 Mon Sep 17 00:00:00 2001 From: bashbunni Date: Mon, 14 Aug 2023 15:51:33 -0700 Subject: [PATCH] test: short chinese text formatting --- glamour_test.go | 8 +++++++- testdata/issues/short-chinese-text.md | 9 +++++++++ testdata/issues/short-chinese-text.test | 11 +++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 testdata/issues/short-chinese-text.md create mode 100644 testdata/issues/short-chinese-text.test diff --git a/glamour_test.go b/glamour_test.go index 2cf1bb6d..84aa41d8 100644 --- a/glamour_test.go +++ b/glamour_test.go @@ -234,6 +234,12 @@ func TestWrapping(t *testing.T) { mdpath: "testdata/issues/42.md", goldpath: "testdata/issues/42.test", }, + { + name: "chinese short", + locale: "C.UTF-8", + mdpath: "testdata/issues/short-chinese-text.md", + goldpath: "testdata/issues/short-chinese-text.test", + }, { name: "chinese long", locale: "C.UTF-8", @@ -270,7 +276,7 @@ func TestWrapping(t *testing.T) { } if diff := cmp.Diff(string(got), string(want)); diff != "" { - t.Fatalf("got != want\n-want +got:\ndiff:\n%s", string(diff)) + t.Fatalf("got != want\n-want +got:\ndiff:\n%s", diff) } }) } diff --git a/testdata/issues/short-chinese-text.md b/testdata/issues/short-chinese-text.md new file mode 100644 index 00000000..20b22f13 --- /dev/null +++ b/testdata/issues/short-chinese-text.md @@ -0,0 +1,9 @@ +李绅 《悯农》 + +锄禾日当午, + +汗滴禾下土。 + +谁知盘中餐, + +粒粒皆辛苦。 diff --git a/testdata/issues/short-chinese-text.test b/testdata/issues/short-chinese-text.test new file mode 100644 index 00000000..2c019a44 --- /dev/null +++ b/testdata/issues/short-chinese-text.test @@ -0,0 +1,11 @@ + + 李绅 《悯农》                                                                +                                                                              + 锄禾日当午,                                                                 +                                                                              + 汗滴禾下土。                                                                 +                                                                              + 谁知盘中餐,                                                                 +                                                                              + 粒粒皆辛苦。                                                                 +