From 27f866687cd4d810372ba8b8776650d314ea40ba Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Wed, 3 Dec 2008 11:34:46 +0100 Subject: Added a simple auto test for our C++ front-end. --- tests/manual/cplusplus/main.cpp | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 tests/manual/cplusplus/main.cpp (limited to 'tests/manual/cplusplus/main.cpp') diff --git a/tests/manual/cplusplus/main.cpp b/tests/manual/cplusplus/main.cpp new file mode 100644 index 0000000000..18b89137a5 --- /dev/null +++ b/tests/manual/cplusplus/main.cpp @@ -0,0 +1,37 @@ + +#include + +#include +#include + +#include +#include +#include +#include +#include + +int main(int, char *[]) +{ + Control control; + StringLiteral *fileId = control.findOrInsertFileName(""); + + QFile in; + if (! in.open(stdin, QFile::ReadOnly)) + return EXIT_FAILURE; + + const QByteArray source = in.readAll(); + + TranslationUnit unit(&control, fileId); + unit.setSource(source.constData(), source.size()); + unit.parse(); + + if (TranslationUnitAST *ast = unit.ast()) { + Scope globalScope; + Semantic sem(&control); + for (DeclarationAST *decl = ast->declarations; decl; decl = decl->next) { + sem.check(decl, &globalScope); + } + } + + return EXIT_SUCCESS; +} -- cgit v1.2.1