summaryrefslogtreecommitdiff
path: root/tests/auto/cplusplus/preprocessor
diff options
context:
space:
mode:
authorFrancois Ferrand <thetypz@gmail.com>2012-03-16 14:10:46 +0100
committerErik Verbruggen <erik.verbruggen@nokia.com>2012-03-19 10:33:14 +0100
commit3e9105e40150a413b65d21588a468e7914697bcc (patch)
tree073bc7a8655781c58fd1aea3c04a0262710a52eb /tests/auto/cplusplus/preprocessor
parentffd58c577a273cd650180e527a2abcff4d8c7df2 (diff)
downloadqt-creator-3e9105e40150a413b65d21588a468e7914697bcc.tar.gz
Preprocessor: fix handling of first empty argument.
First empty argument used to be dropped: e.g. MACRO(,test) would be expanded with one parameter only, with value 'test'. Change-Id: I693fbb7faf1360f62266fa04c4b39c2de0d159a7 Reviewed-by: Erik Verbruggen <erik.verbruggen@nokia.com>
Diffstat (limited to 'tests/auto/cplusplus/preprocessor')
-rw-r--r--tests/auto/cplusplus/preprocessor/tst_preprocessor.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/auto/cplusplus/preprocessor/tst_preprocessor.cpp b/tests/auto/cplusplus/preprocessor/tst_preprocessor.cpp
index 1c5d6fd320..06e910be63 100644
--- a/tests/auto/cplusplus/preprocessor/tst_preprocessor.cpp
+++ b/tests/auto/cplusplus/preprocessor/tst_preprocessor.cpp
@@ -43,6 +43,7 @@ Q_OBJECT
private Q_SLOTS:
void va_args();
void named_va_args();
+ void first_empty_macro_arg();
void unfinished_function_like_macro_call();
void nasty_macro_expansion();
void tstst();
@@ -82,6 +83,23 @@ void tst_Preprocessor::named_va_args()
QVERIFY(preprocessed.contains("int f(int a,int b);"));
}
+void tst_Preprocessor::first_empty_macro_arg()
+{
+ Client *client = 0; // no client.
+ Environment env;
+
+ Preprocessor preprocess(client, &env);
+ QByteArray preprocessed = preprocess(QLatin1String("<stdin>"),
+ QByteArray("\n#define foo(a,b) a int b;"
+ "\nfoo(const,cVal)\n"
+ "\nfoo(,Val)\n"
+ "\nfoo( ,Val2)\n"));
+
+ QVERIFY(preprocessed.contains("const int cVal;"));
+ QVERIFY(preprocessed.contains("int Val;"));
+ QVERIFY(preprocessed.contains("int Val2;"));
+}
+
void tst_Preprocessor::unfinished_function_like_macro_call()
{
Client *client = 0; // no client.