Commit e51fbd20 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh
Browse files

C++: Fix debugging of lexer test

spell() crashes if identifier is not properly created

Change-Id: I1c3949c3fed2282d893914fa2922f6c281d1f8cd
Reviewed-by: default avatarPrzemyslaw Gorszkowski <>
Reviewed-by: default avatarErik Verbruggen <>
parent 15680ebe
......@@ -33,6 +33,8 @@
#include <QtTest>
#include <QDebug>
//#define DEBUG_TOKENS
typedef QList<unsigned> List;
......@@ -61,12 +63,13 @@ void tst_SimpleLexer::basic()
for (; i < tokenList.size(); ++i) {
QVERIFY2(i < expectedTokenKindList.size(), "More tokens than expected.");
// Compare spelled tokens to have it more readable
const Token token =;
const unsigned expectedTokenKind =;
Token expectedToken; // Create a Token in order to spell the token kind
expectedToken.f.kind = expectedTokenKind;
// qDebug("Comparing (i=%d): \"%s\" \"%s\"", i, token.spell(), expectedToken.spell());
qDebug("Comparing (i=%d): \"%s\" \"%s\"", i,
QCOMPARE(token.kind(), expectedTokenKind);
QVERIFY2(i == expectedTokenKindList.size(), "Less tokens than expected.");
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment