MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / TestParseEntityMap

Function TestParseEntityMap

xmlparser/entities_test.go:11–34  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

9)
10
11func TestParseEntityMap(t *testing.T) {
12 directive := &xmlparser.Directive{
13 Data: []byte(`<!DOCTYPE svg [
14 <!ENTITY entity1 "Value1">
15 <!ENTITY entity2 'Value2'>
16 <!ENTITY entity3 "Value with spaces">
17 <!--
18 <!ENTITY fake "ShouldNotBeParsed">
19 -->
20 ]>`),
21 }
22
23 nodes := []xmlparser.Token{directive}
24
25 em := xmlparser.ParseEntityMap(nodes)
26
27 expected := map[string][]byte{
28 "entity1": []byte("Value1"),
29 "entity2": []byte("Value2"),
30 "entity3": []byte("Value with spaces"),
31 }
32
33 require.Equal(t, expected, em)
34}
35
36func TestReplaceEntities(t *testing.T) {
37 em := map[string][]byte{

Callers

nothing calls this directly

Calls 1

ParseEntityMapFunction · 0.92

Tested by

no test coverage detected