drjltlm156790 2017-02-11 20:43
浏览 33
已采纳

不能找到我的测试

When i try to run my tests in golang i get the following error

testing: warning: no tests to run

I also tried to create a test project to see if it behaves the same in other projects these are my 2 files.

package test

func test() string {
    return "test"
}

And here is my test.

package test

import (
    "testing"

    "github.com/stretchr/testify/assert"
 )

 func testTest(t *testing.T) {
    assert.Equal(t, "test", test(), "String was not test")
 }

I tried running it with:

go test
go test -v

Also i tested the behaviour in git bash and the cmd. Im using Windows 10 with Go 1.7.1.

I hope somebody can help me.

  • 写回答

1条回答 默认 最新

  • douzui6173 2017-02-11 21:29
    关注

    Test functions must begin with Test. Try renaming your function to TestTest. That should fix it. Full info here: https://golang.org/pkg/testing

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器