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

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

用銀杏故障測試兩個(gè)字符串

用銀杏故障測試兩個(gè)字符串

Go
牛魔王的故事 2021-08-16 15:49:17
首先,我想告訴你,我對 Go 非常陌生,而且我來自 Python。話雖如此,我可以繼續(xù)解決我的問題。我遇到以下問題:cacciald@cacciald-Lenovo-G470:~/workspace/gopath/src/github.com/lcacciagioni/bosh_web_console/executor$ go testRunning Suite: Executor Suite=============================Random Seed: 1409854483Will run 1 of 1 specs? Failure [0.005 seconds]Executor/home/cacciald/workspace/gopath/src/github.com/lcacciagioni/bosh_web_console/executor/executor_test.go:21  Should execute a command [It]  /home/cacciald/workspace/gopath/src/github.com/lcacciagioni/bosh_web_console/executor/executor_test.go:20  Expected      <string>: Hello World  to be equivalent to      <string>: Hello World  /home/cacciald/workspace/gopath/src/github.com/lcacciagioni/bosh_web_console/executor/executor_test.go:19------------------------------Summarizing 1 Failure:[Fail] Executor [It] Should execute a command /home/cacciald/workspace/gopath/src/github.com/lcacciagioni/bosh_web_console/executor/executor_test.go:19Ran 1 of 1 Specs in 0.006 secondsFAIL! -- 0 Passed | 1 Failed | 0 Pending | 0 Skipped --- FAIL: TestExecutor (0.01 seconds)FAILexit status 1FAIL    github.com/lcacciagioni/bosh_web_console/executor       0.019s這是代碼:// Package executor will provide a way to execute console commands in our// Operative System.-package executorimport (        "bytes"        "log"        "os/exec")func Runner(command, params string) string {        cmd := exec.Command(command, params)        var out bytes.Buffer        cmd.Stdout = &out        err := cmd.Run()        if err != nil {                log.Fatal(err)        }        return out.String()}這是我的簡單測試:package executor_testimport (        . "github.com/lcacciagioni/bosh_web_console/executor"        . "github.com/onsi/ginkgo"        . "github.com/onsi/gomega")var _ = Describe("Executor", func() {        var (                cmd    string                params string        )如果有人能告訴我為什么這不起作用,那就太好了!??!
查看完整描述

1 回答

?
ibeautiful

TA貢獻(xiàn)1993條經(jīng)驗(yàn) 獲得超6個(gè)贊

你忘了\n的echo。


這工作正常:


 var _ = Describe("Executor", func() {

             var (

                     cmd    string

                     params string

             )


             It("Should execute a command", func() {

                     cmd = "echo"

                     params = "Hello World"

                     Expect(Runner(cmd, params)).To(BeEquivalentTo(params + "\n"))

             })

     })


查看完整回答
反對 回復(fù) 2021-08-16
  • 1 回答
  • 0 關(guān)注
  • 193 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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