Skip to content Search Apps Documentation Source Content Run Reset Eval Playground File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

zz_escape_test.gno

0.52 Kb · 17 lines
 1package collatz
 2
 3import (
 4	"strings"
 5	"testing"
 6
 7	"gno.land/p/moul/md/v0"
 8	"gno.land/p/nt/uassert/v0"
 9)
10
11// A path that is not a valid input is echoed back. It is the visitor's text,
12// so a backtick in it must not close a code span and let a link through.
13func TestInvalidPathIsEscaped(t *testing.T) {
14	out := Render("/x` [claim](https://evil.example) `")
15	// Still there, but inside a span md.InlineCode widened past its backticks.
16	uassert.True(t, strings.Contains(out, md.InlineCode("x` [claim](https://evil.example) `")), out)
17}