第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

創(chuàng)建單元測(cè)試以使用內(nèi)容創(chuàng)建文件

創(chuàng)建單元測(cè)試以使用內(nèi)容創(chuàng)建文件

Go
慕森王 2021-04-04 17:14:00
我有以下獲取文件并向其中寫入內(nèi)容的功能。func setFile(file *os.File, appStr models.App) {    file.WriteString("1.0")    file.WriteString("Created-By: application generation process")    for _, mod := range appStr.Modules {        file.WriteString(NEW_LINE)        file.WriteString(NEW_LINE)        file.WriteString("Application")        file.WriteString(NEW_LINE)        file.WriteString("ApplicationContent")        file.WriteString(NEW_LINE)        file.WriteString("ContentType")    }}為此,我生成如下的單元測(cè)試func Test_setFile(t *testing.T) {    type args struct {        file   *os.File        appStr models.App    }    var tests []struct {        name string        args args    }    for _, tt := range tests {        t.Run(tt.name, func(t *testing.T) {            setFile(tt.args.file, tt.args.AppStr)        })    }}這里的問題是im取決于文件,為這種功能創(chuàng)建單元測(cè)試的更好方法是什么在正在創(chuàng)建文件的單元測(cè)試中運(yùn)行代碼,然后使用此功能對(duì)其進(jìn)行更新,然后對(duì)其進(jìn)行解析并檢查其值?有沒有更好的方法來實(shí)現(xiàn)這種功能?
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 272 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)