Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
f4e875b9
Commit
f4e875b9
authored
Mar 02, 2009
by
Roberto Raggi
Browse files
Initial testing of the preprocessor.
parent
fd22788d
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/libs/cplusplus/pp-engine.cpp
View file @
f4e875b9
...
...
@@ -481,6 +481,21 @@ void Preprocessor::popState()
_savedStates
.
removeLast
();
}
QByteArray
Preprocessor
::
operator
()(
const
QByteArray
&
filename
,
const
QByteArray
&
source
)
{
QByteArray
preprocessed
;
operator
()(
filename
,
source
,
&
preprocessed
);
return
preprocessed
;
}
QByteArray
Preprocessor
::
operator
()(
const
QByteArray
&
source
)
{
QByteArray
preprocessed
;
operator
()(
source
,
&
preprocessed
);
return
preprocessed
;
}
void
Preprocessor
::
operator
()
(
const
QByteArray
&
filename
,
const
QByteArray
&
source
,
QByteArray
*
result
)
...
...
src/libs/cplusplus/pp-engine.h
View file @
f4e875b9
...
...
@@ -181,6 +181,11 @@ namespace CPlusPlus {
public:
Preprocessor
(
Client
*
client
,
Environment
&
env
);
QByteArray
operator
()(
const
QByteArray
&
filename
,
const
QByteArray
&
source
);
QByteArray
operator
()(
const
QByteArray
&
source
);
void
operator
()(
const
QByteArray
&
filename
,
const
QByteArray
&
source
,
QByteArray
*
result
);
...
...
tests/auto/cplusplus/cplusplus.pro
View file @
f4e875b9
TEMPLATE
=
subdirs
SUBDIRS
=
shared
ast
semantic
lookup
SUBDIRS
=
shared
ast
semantic
lookup
preprocessor
CONFIG
+=
ordered
tests/auto/cplusplus/preprocessor/preprocessor.pro
0 → 100644
View file @
f4e875b9
TEMPLATE
=
app
CONFIG
+=
qt
warn_on
console
depend_includepath
QT
=
core
testlib
TARGET
=
tst_
$$
TARGET
DEFINES
+=
CPLUSPLUS_WITH_NAMESPACE
include
(..
/../../../
src
/
libs
/
cplusplus
/
cplusplus
-
lib
.
pri
)
SOURCES
+=
tst_preprocessor
.
cpp
tests/auto/cplusplus/preprocessor/tst_preprocessor.cpp
0 → 100644
View file @
f4e875b9
#include <QtTest>
#include <pp.h>
CPLUSPLUS_USE_NAMESPACE
class
tst_Preprocessor
:
public
QObject
{
Q_OBJECT
private
Q_SLOTS
:
void
pp_with_no_client
();
};
void
tst_Preprocessor
::
pp_with_no_client
()
{
using
namespace
CPlusPlus
;
Client
*
client
=
0
;
// no client.
Environment
env
;
Preprocessor
preprocess
(
client
,
env
);
QByteArray
preprocessed
=
preprocess
(
"#define foo(a,b) a + b
\n
foo(1, 2)
\n
"
);
QByteArray
expected
=
"1 + 2"
;
QCOMPARE
(
preprocessed
.
trimmed
(),
expected
);
}
QTEST_APPLESS_MAIN
(
tst_Preprocessor
)
#include "tst_preprocessor.moc"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment