Goland no tests were run
引用
原因
Instead of `fmt.Printf(...` in `AddTwoNumbers` try either `fmt.Println(...` or `fmt.Printf("foo\n')`
The absence of the newline in the output of your `AddTwoNumbers` method is is causing the format of the test execution outputs to not have each test in a new line. The test runner is not being able to interpret that a test was run. Adding that newline, keeps a clean output.
处理方案
func TestMakeSlice(t *testing.T) {
// user test
// add println to avoid "goland No Tests Were Run"
fmt.Println("")
在GoLand中,由于`AddTwoNumbers`方法的输出缺少新行,导致测试执行的输出格式不正确,使得测试运行器无法识别。解决方案是在测试用例中添加`fmt.Println()`以确保每个测试在新行上,保持输出清晰。



5541

被折叠的 条评论
为什么被折叠?



