MCPcopy Create free account
hub / github.com/antchfx/xmlquery / TestEscapeValueWrite

Function TestEscapeValueWrite

node_test.go:430–446  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

428}
429
430func TestEscapeValueWrite(t *testing.T) {
431 data := `<AAA>&lt;*&gt;</AAA>`
432
433 root, err := Parse(strings.NewReader(data))
434 if err != nil {
435 t.Error(err)
436 }
437
438 var b strings.Builder
439 err = root.Write(&b, true)
440 testTrue(t, err == nil)
441 escapedInnerText := b.String()
442 if !strings.Contains(escapedInnerText, "&lt;*&gt;") {
443 t.Fatal("Inner Text has not been escaped")
444 }
445
446}
447
448func TestUnnecessaryEscapeOutputValue(t *testing.T) {
449 data := `<?xml version="1.0" encoding="utf-8"?>

Callers

nothing calls this directly

Calls 4

ParseFunction · 0.85
testTrueFunction · 0.85
WriteMethod · 0.80
StringMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…