Ai
2 Star 10 Fork 0

tencentcloud/tencentcloud-sdk-go

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
section_test.go 1.59 KB
一键复制 编辑 原始数据 按行查看 历史
zhangxu-ai 提交于 2021-07-27 16:40 +08:00 . feat : credential manager (#137)
package common
import (
"reflect"
"testing"
)
func Test_section_key(t *testing.T) {
type fields struct {
content map[string]*value
}
type args struct {
name string
}
tests := []struct {
name string
fields fields
args args
want *value
}{
{
"contain key",
fields{content: map[string]*value{
"key1": {raw: "value1"},
},
},
args{name: "key1"}, &value{raw: "value1"},
},
{
"not contain key",
fields{content: map[string]*value{}},
args{name: "notkey"},
&value{},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
s := &section{
content: tt.fields.content,
}
if got := s.key(tt.args.name); !reflect.DeepEqual(got, tt.want) {
t.Errorf("key() = %v, want %v", got, tt.want)
}
})
}
}
func Test_sections_section(t *testing.T) {
type fields struct {
contains map[string]*section
}
type args struct {
name string
}
tests := []struct {
name string
fields fields
args args
want *section
}{
{
"contain key",
fields{contains: map[string]*section{
"default": {content: map[string]*value{"key1": {raw: "value1"}}}},
},
args{name: "default"}, &section{content: map[string]*value{"key1": {raw: "value1"}}},
},
{
"not contain key",
fields{contains: map[string]*section{}},
args{name: "notkey"},
&section{},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
ss := sections{
contains: tt.fields.contains,
}
if got := ss.section(tt.args.name); !reflect.DeepEqual(got, tt.want) {
t.Errorf("section() = %v, want %v", got, tt.want)
}
})
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/tencentcloud/tencentcloud-sdk-go.git
git@gitee.com:tencentcloud/tencentcloud-sdk-go.git
tencentcloud
tencentcloud-sdk-go
tencentcloud-sdk-go
master

搜索帮助