-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
fix: use upper camel case to unify the case name of unit testing cases #3402
base: master
Are you sure you want to change the base?
Conversation
@oldme-git 我看改动的文件比较多,都是把下划线改为了大驼峰,但在单测命名这块本身没有规范,这么大量的修改看不出来能给项目带来什么收益。 |
@oldme-git I see that there are many files that have been changed, and the underscores have been changed to hump. However, there is no standard in the naming of single tests. It is hard to see what benefits such a large number of changes can bring to the project. |
单测命名这块的规范官方给的示例都是 TestXxx,第三方规范也都是 TestXxx,哪怕不批量改成TestXxx,也要统一一种风格比较好吧,你看呢 |
The official examples of single test naming specifications are all TestXxx, and the third-party specifications are also TestXxx. Even if you don’t change them to TestXxx in batches, it’s better to unify one style. You see? |
@oldme-git 我重新回顾了一下,这里的下划线最初是参考标准库的 |
@gqcn 我详细看了一下 go 标准库, |
@gqcn I looked at the go standard library in detail. |
@gqcn 另外,虽然没有正式的 go 官方标准,但是在开发文档中还是提及了 Test 的命名标准。参见: https://pkg.go.dev/testing#section-documentation |
@gqcn In addition, although there is no formal go official standard, the naming standard of Test is still mentioned in the development documentation. See: https://pkg.go.dev/testing#section-documentation |
Dear reviewer:
统一单元测试的函数命名为大写驼峰,向
golang
标准库对齐加入 ci 检测,不符合要求的抛出 fail,请详细 review .github/workflows/before_script.sh
库里有些单测不是很严谨,同一个包里甚至有
Test_Abc_Def
,TestAbcDef
和Test_abc_def