1 // Copyright 2022 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 5 package binding 6 7 import ( 8 "testing" 9 10 "github.com/stretchr/testify/assert" 11 "github.com/stretchr/testify/require" 12 ) 13 14 func TestTOMLBindingBindBody(t *testing.T) { 15 var s struct { 16 Foo string `toml:"foo"` 17 } 18 tomlBody := `foo="FOO"` 19 err := tomlBinding{}.BindBody([]byte(tomlBody), &s) 20 require.NoError(t, err) 21 assert.Equal(t, "FOO", s.Foo) 22 } 23