亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

關于Golang單元測試中參數問題

關于Golang單元測試中參數問題

浮沉哖華_微安 2019-03-21 09:30:41
func TestUserAges_Get(t *testing.T) {????type fields struct {????????ages ?map[string]int????????Mutex sync.Mutex????}????type args struct {????????name string????}????tests := []struct {????????name ? string????????fields fields????????args ? args????????want ? int????}{????????// TODO 以上結構體中的參數寫法????}????for _, tt := range tests {????????t.Run(tt.name, func(t *testing.T) {????????????ua := &UserAges{????????????????ages: ?tt.fields.ages,????????????????Mutex: tt.fields.Mutex,????????????}????????????if got := ua.Get(tt.args.name); got != tt.want {????????????????t.Errorf("UserAges.Get() = %v, want %v", got, tt.want)????????????}????????})????}}
查看完整描述

3 回答

  • 3 回答
  • 0 關注
  • 1225 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號