Skip to content

Underscores shouldn't be used in googletest test names #2637

@tiagoshibata

Description

@tiagoshibata

Describe the bug
Use of underscores in test case names (e.g. TEST(DateTimeTransformer, Past_1976_Nov_17__12_27_04)) in googletest is not recommended, since it has a few gotchas (https://github.com/google/googletest/blob/master/googletest/docs/faq.md#why-should-test-suite-names-and-test-names-not-contain-underscore). Furthermore, some tests (such as TEST(DateTimeTransformer, Past_1976_Nov_17__12_27_04)) have double underscores, which are reserved to be used by the compiler and standard library. It's not a big issue and unlikely to break, but it's not standards conforming and, quoting googletest's docs:

If you violate the rule, there may not be immediate consequences, but your test may (just may) break with a new compiler (or a new version of the compiler you are using) or with a new version of googletest. Therefore it's best to follow the rule.

Urgency
N/A

System information
N/A

To Reproduce
Files such as onnxruntime\test\automl_ops\datetimetransformer_test.cc have a bunch of underscores in test names.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions