diff --git a/tests/auto/qmljsc/testpurejavascriptgenerator_integration.cpp b/tests/auto/qmljsc/testpurejavascriptgenerator_integration.cpp index cb097b6..f7b843e 100644 --- a/tests/auto/qmljsc/testpurejavascriptgenerator_integration.cpp +++ b/tests/auto/qmljsc/testpurejavascriptgenerator_integration.cpp @@ -1,91 +1,91 @@ /* * Qml.js Compiler - a QML to JS compiler bringing QML's power to the web. * * Copyright (C) 2015 Jan Marker * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * */ #include "../../../src/qmljsc/purejavascriptgenerator.h" #include #include #include #include #include #include #include Q_DECLARE_METATYPE(QQmlJS::AST::Node*) -class PureJavaScriptGeneratorIntegration +class TestPureJavaScriptGeneratorIntegration : public QObject { Q_OBJECT private: QQmlJS::AST::Node* astForFile(QString fileName) { QString input = fileContent(fileName); QQmlJS::Engine* engine = new QQmlJS::Engine(); QQmlJS::Lexer* lexer = new QQmlJS::Lexer(engine); lexer->setCode(input, 1, true); QQmlJS::Parser* parser = new QQmlJS::Parser(engine); if (!parser->parseProgram()) { qDebug() << parser->errorMessage(); } return parser->rootNode(); } QString fileContent(QString fileName) { QFile inputFile(fileName); Q_ASSERT(inputFile.open(QFile::ReadOnly)); return QString(inputFile.readAll()); } private slots: void test_compileJavaScriptFile_data() { QTest::addColumn("ast"); QTest::addColumn("expectedOutput"); QTest::newRow("expressions") << astForFile(":/test/expressions.js") << fileContent(":/test/expressions.js"); } void test_compileJavaScriptFile() { // Prepare QFETCH(QQmlJS::AST::Node*, ast); QFETCH(QString, expectedOutput); PureJavaScriptGenerator generator; // Do ast->accept(&generator); // Verify QCOMPARE(generator.getGeneratedCode(), expectedOutput); } }; -QTEST_MAIN(PureJavaScriptGeneratorIntegration) +QTEST_MAIN(TestPureJavaScriptGeneratorIntegration) #include "testpurejavascriptgenerator_integration.moc"