1 Star 0 Fork 0

JeffreyBool/binding

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
yaml_test.go 480 Bytes
一键复制 编辑 原始数据 按行查看 历史
zhanggaoyuan 提交于 2020-10-29 18:49 . 移植 gin binding
// Copyright 2019 Gin Core Team. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
package binding
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestYAMLBindingBindBody(t *testing.T) {
var s struct {
Foo string `yaml:"foo"`
}
err := yamlBinding{}.BindBody([]byte("foo: FOO"), &s)
require.NoError(t, err)
assert.Equal(t, "FOO", s.Foo)
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/JeffreyBool/binding.git
git@gitee.com:JeffreyBool/binding.git
JeffreyBool
binding
binding
main

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385