(t *testing.T)
| 9 | ) |
| 10 | |
| 11 | func 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 | |
| 36 | func TestReplaceEntities(t *testing.T) { |
| 37 | em := map[string][]byte{ |
nothing calls this directly
no test coverage detected