codespan_test.gno
0.58 Kb · 18 lines
1package grants
2
3import (
4 "strings"
5 "testing"
6
7 "gno.land/p/nt/testutils/v0"
8)
9
10// A crafted URL path used to close this code span early and render its own
11// markdown. md.InlineCode sizes the fence past any backtick run, so the payload
12// comes back inside a double fence with the backtick intact.
13func TestRenderPathCannotEscapeItsCodeSpan(t *testing.T) {
14 out := Renderer{Program: NewProgram("ugnot", testutils.TestAddress("a")), Title: "T", Link: "/r/x/v0"}.Render("a`b")
15 if !strings.Contains(out, "``a`b``") {
16 t.Fatalf("the fence did not outscan the caller's backtick: %q", out)
17 }
18}