Improves gtest's failure messages. In particulars, char pointers and
char arrays are not escapped properly.
This commit is contained in:
@@ -27,8 +27,11 @@
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// A unit test for Google Test itself. This verifies that the basic
|
||||
// constructs of Google Test work.
|
||||
// The purpose of this file is to generate Google Test output under
|
||||
// various conditions. The output will then be verified by
|
||||
// gtest_output_test.py to ensure that Google Test generates the
|
||||
// desired messages. Therefore, most tests in this file are MEANT TO
|
||||
// FAIL.
|
||||
//
|
||||
// Author: wan@google.com (Zhanyong Wan)
|
||||
|
||||
@@ -101,6 +104,16 @@ INSTANTIATE_TEST_CASE_P(PrintingFailingParams,
|
||||
FailingParamTest,
|
||||
testing::Values(2));
|
||||
|
||||
static const char kGoldenString[] = "\"Line\0 1\"\nLine 2";
|
||||
|
||||
TEST(NonfatalFailureTest, EscapesStringOperands) {
|
||||
std::string actual = "actual \"string\"";
|
||||
EXPECT_EQ(kGoldenString, actual);
|
||||
|
||||
const char* golden = kGoldenString;
|
||||
EXPECT_EQ(golden, actual);
|
||||
}
|
||||
|
||||
// Tests catching a fatal failure in a subroutine.
|
||||
TEST(FatalFailureTest, FatalFailureInSubroutine) {
|
||||
printf("(expecting a failure that x should be 1)\n");
|
||||
|
||||
Reference in New Issue
Block a user