写点什么

Golang testing: “no test files”

用户头像
北纬32°
关注
发布于: 2020 年 05 月 21 日

问题描述

Golang Test Case not Work



解决方案

Files containing tests should be called name_test, with the _test suffix. They should be alongside the code that they are testing.


To run the tests recursively call go test -v ./...

From How to Write Go Code:


You write a test by creating a file with a name ending in _test.go that contains functions named TestXXX with signature func (t *testing.T). The test framework runs each such function; if the function calls a failure function such as t.Error or t.Fail, the test is considered to have failed.


via: https://stackoverflow.com/questions/28240489/golang-testing-no-test-files/28240537


用户头像

北纬32°

关注

All is well. 2017.10.27 加入

- Android Developer - iOS Developer - Gopher

评论

发布
暂无评论
Golang testing: “no test files”