From 3dee7dc26b161502eb5d2e3f7368f7086dafb820 Mon Sep 17 00:00:00 2001 From: Xavier Coulon Date: Mon, 19 Sep 2022 07:31:57 +0200 Subject: [PATCH] test(parser/renderer): verify quoted text case verifies that `*a_b* _c_` is parsed and renderer as expected bug itself ws fixed in eecd0bb Fixes #1078 Signed-off-by: Xavier Coulon --- pkg/parser/quoted_text_test.go | 28 +++++++++++++++++++++ pkg/renderer/sgml/html5/quoted_text_test.go | 9 +++++++ 2 files changed, 37 insertions(+) diff --git a/pkg/parser/quoted_text_test.go b/pkg/parser/quoted_text_test.go index d4e6b9eb..81b4d912 100644 --- a/pkg/parser/quoted_text_test.go +++ b/pkg/parser/quoted_text_test.go @@ -1662,6 +1662,34 @@ var _ = Describe("quoted texts", func() { Expect(ParseDocument(source)).To(MatchDocument(expected)) }) + It("unbalanced italic in bold", func() { + source := `*a_b* _c_` + expected := &types.Document{ + Elements: []interface{}{ + &types.Paragraph{ + Elements: []interface{}{ + &types.QuotedText{ + Kind: types.SingleQuoteBold, + Elements: []interface{}{ + &types.StringElement{Content: "a_b"}, + }, + }, + &types.StringElement{ + Content: " ", + }, + &types.QuotedText{ + Kind: types.SingleQuoteItalic, + Elements: []interface{}{ + &types.StringElement{Content: "c"}, + }, + }, + }, + }, + }, + } + Expect(ParseDocument(source)).To(MatchDocument(expected)) + }) + It("unparsed bold in monospace", func() { source := "`a*b*`" expected := &types.Document{ diff --git a/pkg/renderer/sgml/html5/quoted_text_test.go b/pkg/renderer/sgml/html5/quoted_text_test.go index 710ed55a..032d8b39 100644 --- a/pkg/renderer/sgml/html5/quoted_text_test.go +++ b/pkg/renderer/sgml/html5/quoted_text_test.go @@ -598,6 +598,15 @@ content.

Expect(RenderHTML(source)).To(MatchHTML(expected)) }) + It("unbalanced italic in bold", func() { + source := `*a_b* _c_` + expected := `
+

a_b c

+
+` + Expect(RenderHTML(source)).To(MatchHTML(expected)) + }) + It("unparsed bold in monospace", func() { source := "`a*b*`" expected := `