1// Copyright 2019 Gin Core Team. All rights reserved.
2// Use of this source code is governed by a MIT style
3// license that can be found in the LICENSE file.
4
5package binding
6
7import (
8	"testing"
9
10	"github.com/stretchr/testify/assert"
11	"github.com/stretchr/testify/require"
12)
13
14func TestXMLBindingBindBody(t *testing.T) {
15	var s struct {
16		Foo string `xml:"foo"`
17	}
18	xmlBody := `<?xml version="1.0" encoding="UTF-8"?>
19<root>
20   <foo>FOO</foo>
21</root>`
22	err := xmlBinding{}.BindBody([]byte(xmlBody), &s)
23	require.NoError(t, err)
24	assert.Equal(t, "FOO", s.Foo)
25}
26