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

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

zz_escape_test.gno

0.53 Kb · 17 lines
 1package connect4
 2
 3import (
 4	"strings"
 5	"testing"
 6
 7	"gno.land/p/nym-moultest123/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}