From 385107ebc71a74dae031b713ea5a9c54635eeff8 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Mon, 9 May 2011 15:36:04 +1000 Subject: Remove Q_ASSERT's from qscriptvaluegenerated test Report a fatal error if there are problems reading from the input data stream rather than failing silently in non-debug builds. Change-Id: I7a913bf47dccb37bab09e1cd79e5022b04e42c27 Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern --- .../testgen/testgenerator.cpp | 25 ++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/tests/auto/qscriptvaluegenerated/testgen/testgenerator.cpp b/tests/auto/qscriptvaluegenerated/testgen/testgenerator.cpp index 4d20f89..df2d38a 100644 --- a/tests/auto/qscriptvaluegenerated/testgen/testgenerator.cpp +++ b/tests/auto/qscriptvaluegenerated/testgen/testgenerator.cpp @@ -545,6 +545,17 @@ static void squashTags(QString dataTag, const QVector& results, QList(s)); + } +} QHash TestGenerator::generateTest() { @@ -596,7 +607,10 @@ QHash TestGenerator::generateTest() m_tempFile.seek(0); QDataStream in(&m_tempFile); in >> dataTags; - Q_ASSERT(in.status() == in.Ok); + if (in.status() != in.Ok) + qFatal("%s: stream has bad status %s after reading dataTags", + Q_FUNC_INFO, + qPrintable(streamStatusString(in.status()))); while(!in.atEnd()) { @@ -720,10 +734,13 @@ QHash TestGenerator::generateTest() castUInt32List.append(QPair(dataTag, castUInt32Res)); castUInt16List.append(QPair(dataTag, castUInt16Res)); - Q_ASSERT(in.status() == in.Ok); + if (in.status() != in.Ok) + qFatal("%s: stream has bad status %s after reading data items", + Q_FUNC_INFO, + qPrintable(streamStatusString(in.status()))); } - - Q_ASSERT(in.atEnd()); + if (!in.atEnd()) + qFatal("%s: stream has more data after reading all data items", Q_FUNC_INFO); // Generate. QHash result; -- cgit v0.12