Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update structs-methods-and-interfaces.md #61

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion zh-CN/structs-methods-and-interfaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ func (c Triangle) Area() float64 {

我们知道它仅仅和三角形有关,但是如果在一个包含二十个测试用例的系统里出现类似的错误呢?开发人员如何知道是哪个测试用例失败了呢?这对于开发人员来说不是一个好的体验,他们需要手工检查所有的测试用例以定位到哪个用例失败了。

我们可以改进我们的错误输出为 "%#v got %.2f want %.2f. %#v",这样会打印结构体中域的值。这样开发人员能一眼看出被测试的属性。
我们可以改进我们的错误输出为 "%#v got %.2f want %.2f",这样会打印结构体中域的值。这样开发人员能一眼看出被测试的属性。

关于列表驱动测试的最后一点提示是使用 t.Run。

Expand Down