From 54b931134404a3bb07dc0c1ec3d497d692b90557 Mon Sep 17 00:00:00 2001 From: Cosmin Stroe Date: Sat, 21 Apr 2018 11:08:11 -0500 Subject: pkg/markup/markdown: Issue mentions should also render with square brackets (#4707) * gofmt reformat of markdown.go --- pkg/markup/markup_test.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'pkg/markup/markup_test.go') diff --git a/pkg/markup/markup_test.go b/pkg/markup/markup_test.go index 6e19a23c..b741cc5d 100644 --- a/pkg/markup/markup_test.go +++ b/pkg/markup/markup_test.go @@ -121,6 +121,19 @@ func Test_RenderIssueIndexPattern(t *testing.T) { So(string(RenderIssueIndexPattern([]byte(testCases[i]), urlPrefix, metas)), ShouldEqual, testCases[i+1]) } }) + Convey("It should render issue mention in square brackets", func() { + testCases := []string{ + "[#54321 issue]", "[#54321 issue]", + "test [#54321] issue", "test [#54321] issue", + "test [#54321 extra] issue", "test [#54321 extra] issue", + "test [#54321 issue]", "test [#54321 issue]", + "test [#54321]", "test [#54321]", + } + + for i := 0; i < len(testCases); i += 2 { + So(string(RenderIssueIndexPattern([]byte(testCases[i]), urlPrefix, metas)), ShouldEqual, testCases[i+1]) + } + }) Convey("It should render multiple issue mentions in the same line", func() { testCases := []string{ "#54321 #1243", "#54321 #1243", @@ -265,6 +278,19 @@ func Test_RenderIssueIndexPattern(t *testing.T) { So(string(RenderIssueIndexPattern([]byte(testCases[i]), urlPrefix, metas)), ShouldEqual, testCases[i+1]) } }) + Convey("It should render issue mention in square brackets", func() { + testCases := []string{ + "[ABG-124] issue", "[ABG-124] issue", + "test [ABG-124] issue", "test [ABG-124] issue", + "test [ABG-124 extra] issue", "test [ABG-124 extra] issue", + "test [ABG-124 issue]", "test [ABG-124 issue]", + "test [ABG-124]", "test [ABG-124]", + } + + for i := 0; i < len(testCases); i += 2 { + So(string(RenderIssueIndexPattern([]byte(testCases[i]), urlPrefix, metas)), ShouldEqual, testCases[i+1]) + } + }) Convey("It should render multiple issue mentions in the same line", func() { testCases := []string{ "ABG-124 OTT-4321", "ABG-124 OTT-4321", -- cgit v1.2.3