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

RecordProperty support for double/bool/char/etc #199

Open
GoogleCodeExporter opened this issue Jul 31, 2015 · 1 comment
Open

RecordProperty support for double/bool/char/etc #199

GoogleCodeExporter opened this issue Jul 31, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Pass double value into RecordProperty, get compiler warning
Warning: passing `double' for converting 2 of `static void 
testing::Test::RecordProperty(const 
char*, int)'
due to no double option 
2. RecordProperty seems to currently support int/char* 
./gtest/gtest.h:  static void RecordProperty(const char* key, const char* 
value);
./gtest/gtest.h:  static void RecordProperty(const char* key, int value)

What is the expected output? What do you see instead?
Would be cool to have versions of the method for different types, so wouldnt 
have to convert 
double to char* outside the method, in order to see the result in the XML file. 
Other types could 
be supported too.

What version of the product are you using? On what operating system?
Linux, gtest 1.3.0

Original issue reported on code.google.com by [email protected] on 18 Sep 2009 at 10:09

@GoogleCodeExporter
Copy link
Author

Probably we should templatize it:

template <typename T>
void RecordProperty(const char* name, const T& value);

The implementation will just stream value to a stringstream and then extract 
the string.

This allows any printable type to be used in RecordProperty.

Original comment by [email protected] on 18 Sep 2009 at 5:14

  • Changed state: Accepted
  • Added labels: OpSys-All, Type-Enhancement, Usability
  • Removed labels: Type-Defect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant