Refactor some Str2html code (followup)

* [BUG] Restrict when to make link absolute in markdown
This commit is contained in:
Earl Warren 2024-03-04 06:54:36 +08:00
parent 68099f2f00
commit 58bc3af08d
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -742,7 +742,7 @@ Citation needed[^0].`,
for _, test := range testcases { for _, test := range testcases {
res, err := markdown.RenderString(&markup.RenderContext{Ctx: git.DefaultContext}, test.testcase) res, err := markdown.RenderString(&markup.RenderContext{Ctx: git.DefaultContext}, test.testcase)
assert.NoError(t, err, "Unexpected error in testcase: %q", test.testcase) assert.NoError(t, err, "Unexpected error in testcase: %q", test.testcase)
assert.Equal(t, test.expected, res, "Unexpected result in testcase %q", test.testcase) assert.Equal(t, test.expected, string(res), "Unexpected result in testcase %q", test.testcase)
} }
} }
@ -1189,7 +1189,7 @@ func TestCustomMarkdownURL(t *testing.T) {
}, },
}, input) }, input)
assert.NoError(t, err) assert.NoError(t, err)
assert.Equal(t, strings.TrimSpace(expected), strings.TrimSpace(buffer)) assert.Equal(t, strings.TrimSpace(expected), strings.TrimSpace(string(buffer)))
} }
test("[test](abp:subscribe?location=https://codeberg.org/filters.txt&title=joy)", test("[test](abp:subscribe?location=https://codeberg.org/filters.txt&title=joy)",