From 3fdc69cfddaaebb167016e8028f157877ca9ba86 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Tue, 30 Aug 2011 15:59:09 -0400 Subject: [PATCH] starting work on report file output --- .../ConsoleOutput.cpp | 226 +++++++++--------- ext/jasmine-webkit-specrunner/ConsoleOutput.h | 55 +++-- .../ConsoleOutput_test.cpp | 31 ++- .../ConsoleOutput_test.h | 39 ++- ext/jasmine-webkit-specrunner/Page.cpp | 2 - ext/jasmine-webkit-specrunner/Page.h | 2 - ext/jasmine-webkit-specrunner/Page_test.cpp | 4 +- ext/jasmine-webkit-specrunner/Page_test.h | 4 +- .../ReportFileOutput.cpp | 10 + .../ReportFileOutput.h | 29 +++ .../ReportFileOutput_test.cpp | 22 ++ .../ReportFileOutput_test.h | 19 ++ .../ReportFileOutput_test.pro | 7 + ext/jasmine-webkit-specrunner/Runner.cpp | 2 - ext/jasmine-webkit-specrunner/Runner.h | 8 +- ext/jasmine-webkit-specrunner/common.pri | 4 +- ext/jasmine-webkit-specrunner/specrunner.cpp | 2 +- 17 files changed, 267 insertions(+), 199 deletions(-) create mode 100644 ext/jasmine-webkit-specrunner/ReportFileOutput.cpp create mode 100644 ext/jasmine-webkit-specrunner/ReportFileOutput.h create mode 100644 ext/jasmine-webkit-specrunner/ReportFileOutput_test.cpp create mode 100644 ext/jasmine-webkit-specrunner/ReportFileOutput_test.h create mode 100644 ext/jasmine-webkit-specrunner/ReportFileOutput_test.pro diff --git a/ext/jasmine-webkit-specrunner/ConsoleOutput.cpp b/ext/jasmine-webkit-specrunner/ConsoleOutput.cpp index cb4b937..3b92cff 100644 --- a/ext/jasmine-webkit-specrunner/ConsoleOutput.cpp +++ b/ext/jasmine-webkit-specrunner/ConsoleOutput.cpp @@ -1,142 +1,140 @@ #include "ConsoleOutput.h" -namespace HeadlessSpecRunner { - ConsoleOutput::ConsoleOutput() : QObject(), +ConsoleOutput::ConsoleOutput() : QObject(), showColors(false), consoleLogUsed(false) { outputIO = &std::cout; } - void ConsoleOutput::passed(const QString &specDetail) { - green(); - *outputIO << '.'; - clear(); - outputIO->flush(); +void ConsoleOutput::passed(const QString &specDetail) { + green(); + *outputIO << '.'; + clear(); + outputIO->flush(); - consoleLogUsed = false; - successes.push(specDetail); - } + consoleLogUsed = false; + successes.push(specDetail); +} - void ConsoleOutput::failed(const QString &specDetail) { - red(); - *outputIO << 'F'; - clear(); - outputIO->flush(); +void ConsoleOutput::failed(const QString &specDetail) { + red(); + *outputIO << 'F'; + clear(); + outputIO->flush(); - consoleLogUsed = false; - failures.push(specDetail); - } + consoleLogUsed = false; + failures.push(specDetail); +} - void ConsoleOutput::green() { - if (showColors) std::cout << "\033[0;32m"; - } +void ConsoleOutput::green() { + if (showColors) std::cout << "\033[0;32m"; +} - void ConsoleOutput::clear() { - if (showColors) std::cout << "\033[m"; - } +void ConsoleOutput::clear() { + if (showColors) std::cout << "\033[m"; +} - void ConsoleOutput::red() { - if (showColors) std::cout << "\033[0;31m"; - } +void ConsoleOutput::red() { + if (showColors) std::cout << "\033[0;31m"; +} - void ConsoleOutput::yellow() - { - if (showColors) std::cout << "\033[0;33m"; - } +void ConsoleOutput::yellow() +{ + if (showColors) std::cout << "\033[0;33m"; +} - void ConsoleOutput::errorLog(const QString &msg, int lineNumber, const QString &sourceID) { - red(); - *outputIO << "[error] "; - clear(); - *outputIO << qPrintable(sourceID) << ":" << lineNumber << " : " << qPrintable(msg); +void ConsoleOutput::errorLog(const QString &msg, int lineNumber, const QString &sourceID) { + red(); + *outputIO << "[error] "; + clear(); + *outputIO << qPrintable(sourceID) << ":" << lineNumber << " : " << qPrintable(msg); + *outputIO << std::endl; +} + +void ConsoleOutput::internalLog(const QString ¬e, const QString &msg) { + red(); + *outputIO << "[" << qPrintable(note) << "] "; + clear(); + *outputIO << qPrintable(msg); + *outputIO << std::endl; +} + +void ConsoleOutput::consoleLog(const QString &msg) { + if (!consoleLogUsed) { *outputIO << std::endl; + consoleLogUsed = true; } - void ConsoleOutput::internalLog(const QString ¬e, const QString &msg) { - red(); - *outputIO << "[" << qPrintable(note) << "] "; - clear(); - *outputIO << qPrintable(msg); + green(); + *outputIO << "[console] "; + if (msg.contains("\n")) *outputIO << std::endl; + clear(); + *outputIO << qPrintable(msg); + *outputIO << std::endl; +} + +void ConsoleOutput::logSpecFilename(const QString &name) { + *outputIO << std::endl << std::endl; + red(); + *outputIO << qPrintable(name) << std::endl; + clear(); +} + +void ConsoleOutput::logSpecResult(const QString &result) { + red(); + *outputIO << " " << qPrintable(result) << std::endl; + clear(); +} + +void ConsoleOutput::reportFailure(const QString &totalTests, const QString &failedTests, const QString &duration) { + red(); + *outputIO << std::endl << "FAIL: "; + formatTestResults(totalTests, failedTests, duration); + *outputIO << std::endl; + clear(); +} + +void ConsoleOutput::reportSuccess(const QString &totalTests, const QString &failedTests, const QString &duration) { + green(); + *outputIO << std::endl << "PASS: "; + formatTestResults(totalTests, failedTests, duration); + *outputIO << std::endl; + clear(); +} + +void ConsoleOutput::reportSuccessWithJSErrors(const QString &totalTests, const QString &failedTests, const QString &duration) { + yellow(); + *outputIO << std::endl << "PASS with JS errors: "; + formatTestResults(totalTests, failedTests, duration); + *outputIO << std::endl; + clear(); +} + +void ConsoleOutput::formatTestResults(const QString &totalTests, const QString &failedTests, const QString &duration) { + *outputIO << qPrintable(totalTests) << " "; + if (totalTests == "1") { + *outputIO << "test"; + } else { + *outputIO << "tests"; } - void ConsoleOutput::consoleLog(const QString &msg) { - if (!consoleLogUsed) { - *outputIO << std::endl; - consoleLogUsed = true; - } + *outputIO << ", "; - green(); - *outputIO << "[console] "; - if (msg.contains("\n")) - *outputIO << std::endl; - clear(); - *outputIO << qPrintable(msg); - *outputIO << std::endl; + *outputIO << qPrintable(failedTests) << " "; + if (failedTests == "1") { + *outputIO << "failure"; + } else { + *outputIO << "failures"; } - void ConsoleOutput::logSpecFilename(const QString &name) { - *outputIO << std::endl << std::endl; - red(); - *outputIO << qPrintable(name) << std::endl; - clear(); - } + *outputIO << ", "; - void ConsoleOutput::logSpecResult(const QString &result) { - red(); - *outputIO << " " << qPrintable(result) << std::endl; - clear(); - } - - void ConsoleOutput::reportFailure(const QString &totalTests, const QString &failedTests, const QString &duration) { - red(); - *outputIO << std::endl << "FAIL: "; - formatTestResults(totalTests, failedTests, duration); - *outputIO << std::endl; - clear(); - } - - void ConsoleOutput::reportSuccess(const QString &totalTests, const QString &failedTests, const QString &duration) { - green(); - *outputIO << std::endl << "PASS: "; - formatTestResults(totalTests, failedTests, duration); - *outputIO << std::endl; - clear(); - } - - void ConsoleOutput::reportSuccessWithJSErrors(const QString &totalTests, const QString &failedTests, const QString &duration) { - yellow(); - *outputIO << std::endl << "PASS with JS errors: "; - formatTestResults(totalTests, failedTests, duration); - *outputIO << std::endl; - clear(); - } - - void ConsoleOutput::formatTestResults(const QString &totalTests, const QString &failedTests, const QString &duration) { - *outputIO << qPrintable(totalTests) << " "; - if (totalTests == "1") { - *outputIO << "test"; - } else { - *outputIO << "tests"; - } - - *outputIO << ", "; - - *outputIO << qPrintable(failedTests) << " "; - if (failedTests == "1") { - *outputIO << "failure"; - } else { - *outputIO << "failures"; - } - - *outputIO << ", "; - - *outputIO << qPrintable(duration) << " "; - if (duration == "1") { - *outputIO << "sec."; - } else { - *outputIO << "secs."; - } + *outputIO << qPrintable(duration) << " "; + if (duration == "1") { + *outputIO << "sec."; + } else { + *outputIO << "secs."; } } diff --git a/ext/jasmine-webkit-specrunner/ConsoleOutput.h b/ext/jasmine-webkit-specrunner/ConsoleOutput.h index cb71cca..898e7e4 100644 --- a/ext/jasmine-webkit-specrunner/ConsoleOutput.h +++ b/ext/jasmine-webkit-specrunner/ConsoleOutput.h @@ -5,35 +5,34 @@ #include #include -namespace HeadlessSpecRunner { - class ConsoleOutput : public QObject { - Q_OBJECT - public: - ConsoleOutput(); - void passed(const QString &specDetail); - void failed(const QString &specDetail); - void errorLog(const QString &msg, int lineNumber, const QString &sourceID); - void internalLog(const QString ¬e, const QString &msg); - void consoleLog(const QString &msg); - void logSpecFilename(const QString &name); - void logSpecResult(const QString &result); +class ConsoleOutput : public QObject { + public: + ConsoleOutput(); - void reportFailure(const QString &totalTests, const QString &failedTests, const QString &duration); - void reportSuccess(const QString &totalTests, const QString &failedTests, const QString &duration); - void reportSuccessWithJSErrors(const QString &totalTests, const QString &failedTests, const QString &duration); + void passed(const QString &specDetail); + void failed(const QString &specDetail); + void errorLog(const QString &msg, int lineNumber, const QString &sourceID); + void internalLog(const QString ¬e, const QString &msg); + void consoleLog(const QString &msg); + void logSpecFilename(const QString &name); + void logSpecResult(const QString &result); - std::ostream *outputIO; - QStack successes; - QStack failures; - bool showColors; - bool consoleLogUsed; - private: - void green(); - void clear(); - void red(); - void yellow(); - void formatTestResults(const QString &totalTests, const QString &failedTests, const QString &duration); - }; -} + void reportFailure(const QString &totalTests, const QString &failedTests, const QString &duration); + void reportSuccess(const QString &totalTests, const QString &failedTests, const QString &duration); + void reportSuccessWithJSErrors(const QString &totalTests, const QString &failedTests, const QString &duration); + + std::ostream *outputIO; + QStack successes; + QStack failures; + + bool showColors; + bool consoleLogUsed; + private: + void green(); + void clear(); + void red(); + void yellow(); + void formatTestResults(const QString &totalTests, const QString &failedTests, const QString &duration); +}; #endif diff --git a/ext/jasmine-webkit-specrunner/ConsoleOutput_test.cpp b/ext/jasmine-webkit-specrunner/ConsoleOutput_test.cpp index baa3cf7..dccdd52 100644 --- a/ext/jasmine-webkit-specrunner/ConsoleOutput_test.cpp +++ b/ext/jasmine-webkit-specrunner/ConsoleOutput_test.cpp @@ -5,13 +5,11 @@ using namespace std; -namespace HeadlessSpecRunner { - ConsoleOutputTest::ConsoleOutputTest() : QObject() { - } + ConsoleOutputTest::ConsoleOutputTest() : QObject() {} void ConsoleOutputTest::testPassed() { stringstream buffer; - HeadlessSpecRunner::ConsoleOutput output; + ConsoleOutput output; output.consoleLogUsed = true; output.outputIO = &buffer; @@ -24,7 +22,7 @@ namespace HeadlessSpecRunner { void ConsoleOutputTest::testFailed() { stringstream buffer; - HeadlessSpecRunner::ConsoleOutput output; + ConsoleOutput output; output.consoleLogUsed = true; output.outputIO = &buffer; @@ -37,7 +35,7 @@ namespace HeadlessSpecRunner { void ConsoleOutputTest::testErrorLog() { stringstream buffer; - HeadlessSpecRunner::ConsoleOutput output; + ConsoleOutput output; output.outputIO = &buffer; output.errorLog("message", 1, "source"); @@ -46,7 +44,7 @@ namespace HeadlessSpecRunner { void ConsoleOutputTest::testInternalLog() { stringstream buffer; - HeadlessSpecRunner::ConsoleOutput output; + ConsoleOutput output; output.outputIO = &buffer; output.internalLog("note", "message"); @@ -55,7 +53,7 @@ namespace HeadlessSpecRunner { void ConsoleOutputTest::testConsoleLog() { stringstream buffer; - HeadlessSpecRunner::ConsoleOutput output; + ConsoleOutput output; output.consoleLogUsed = false; output.outputIO = &buffer; @@ -65,7 +63,7 @@ namespace HeadlessSpecRunner { void ConsoleOutputTest::testConsoleLogUsed() { stringstream buffer; - HeadlessSpecRunner::ConsoleOutput output; + ConsoleOutput output; output.consoleLogUsed = true; output.outputIO = &buffer; @@ -75,7 +73,7 @@ namespace HeadlessSpecRunner { void ConsoleOutputTest::testLogSpecFilename() { stringstream buffer; - HeadlessSpecRunner::ConsoleOutput output; + ConsoleOutput output; output.outputIO = &buffer; output.logSpecFilename("whatever"); @@ -84,7 +82,7 @@ namespace HeadlessSpecRunner { void ConsoleOutputTest::testLogSpecResult() { stringstream buffer; - HeadlessSpecRunner::ConsoleOutput output; + ConsoleOutput output; output.outputIO = &buffer; output.logSpecResult("whatever"); @@ -93,7 +91,7 @@ namespace HeadlessSpecRunner { void ConsoleOutputTest::testReportResultsFailedSingular() { stringstream buffer; - HeadlessSpecRunner::ConsoleOutput output; + ConsoleOutput output; output.outputIO = &buffer; output.reportFailure("1", "1", "1"); @@ -102,7 +100,7 @@ namespace HeadlessSpecRunner { void ConsoleOutputTest::testReportResultsFailedPlural() { stringstream buffer; - HeadlessSpecRunner::ConsoleOutput output; + ConsoleOutput output; output.outputIO = &buffer; output.reportFailure("2", "2", "2"); @@ -111,7 +109,7 @@ namespace HeadlessSpecRunner { void ConsoleOutputTest::testReportResultsSucceeded() { stringstream buffer; - HeadlessSpecRunner::ConsoleOutput output; + ConsoleOutput output; output.outputIO = &buffer; output.reportSuccess("2", "2", "2"); @@ -120,13 +118,12 @@ namespace HeadlessSpecRunner { void ConsoleOutputTest::testReportResultsSucceededWithJSErrors() { stringstream buffer; - HeadlessSpecRunner::ConsoleOutput output; + ConsoleOutput output; output.outputIO = &buffer; output.reportSuccessWithJSErrors("2", "2", "2"); QVERIFY(buffer.str() == "\nPASS with JS errors: 2 tests, 2 failures, 2 secs.\n"); } -} -QTEST_MAIN(HeadlessSpecRunner::ConsoleOutputTest); +QTEST_MAIN(ConsoleOutputTest); diff --git a/ext/jasmine-webkit-specrunner/ConsoleOutput_test.h b/ext/jasmine-webkit-specrunner/ConsoleOutput_test.h index 5f1d371..246e231 100644 --- a/ext/jasmine-webkit-specrunner/ConsoleOutput_test.h +++ b/ext/jasmine-webkit-specrunner/ConsoleOutput_test.h @@ -1,5 +1,5 @@ -#ifndef JHW_TEST_PAGE -#define JHW_TEST_PAGE +#ifndef JHW_TEST_CONSOLE_OUTPUT +#define JHW_TEST_CONSOLE_OUTPUT #include #include @@ -8,28 +8,25 @@ #include "ConsoleOutput.h" -namespace HeadlessSpecRunner { - class ConsoleOutputTest : public QObject { - Q_OBJECT - public: - ConsoleOutputTest(); +class ConsoleOutputTest : public QObject { + Q_OBJECT + public: + ConsoleOutputTest(); private slots: void testPassed(); - void testFailed(); - void testErrorLog(); - void testInternalLog(); - void testConsoleLog(); - void testConsoleLogUsed(); - void testLogSpecFilename(); - void testLogSpecResult(); + void testFailed(); + void testErrorLog(); + void testInternalLog(); + void testConsoleLog(); + void testConsoleLogUsed(); + void testLogSpecFilename(); + void testLogSpecResult(); - void testReportResultsFailedSingular(); - void testReportResultsFailedPlural(); - void testReportResultsSucceeded(); - void testReportResultsSucceededWithJSErrors(); - }; -} + void testReportResultsFailedSingular(); + void testReportResultsFailedPlural(); + void testReportResultsSucceeded(); + void testReportResultsSucceededWithJSErrors(); +}; #endif - diff --git a/ext/jasmine-webkit-specrunner/Page.cpp b/ext/jasmine-webkit-specrunner/Page.cpp index d277e21..f532c9c 100644 --- a/ext/jasmine-webkit-specrunner/Page.cpp +++ b/ext/jasmine-webkit-specrunner/Page.cpp @@ -4,7 +4,6 @@ #include "Page.h" -namespace HeadlessSpecRunner { Page::Page() : QWebPage(), confirmResult(true) {} void Page::javaScriptConsoleMessage(const QString &message, int lineNumber, const QString &sourceID) { @@ -28,4 +27,3 @@ namespace HeadlessSpecRunner { void Page::oneFalseConfirm() { confirmResult = false; } -} diff --git a/ext/jasmine-webkit-specrunner/Page.h b/ext/jasmine-webkit-specrunner/Page.h index 4c7e151..01963c4 100644 --- a/ext/jasmine-webkit-specrunner/Page.h +++ b/ext/jasmine-webkit-specrunner/Page.h @@ -4,7 +4,6 @@ #include #include -namespace HeadlessSpecRunner { class Page: public QWebPage { Q_OBJECT public: @@ -20,6 +19,5 @@ namespace HeadlessSpecRunner { private: bool confirmResult; }; -} #endif diff --git a/ext/jasmine-webkit-specrunner/Page_test.cpp b/ext/jasmine-webkit-specrunner/Page_test.cpp index 9934af1..7cc213a 100644 --- a/ext/jasmine-webkit-specrunner/Page_test.cpp +++ b/ext/jasmine-webkit-specrunner/Page_test.cpp @@ -3,7 +3,6 @@ #include "Page.h" #include "Page_test.h" -namespace HeadlessSpecRunner { PageTest::PageTest() : QObject(), internalLogCalled(false) { } @@ -39,7 +38,6 @@ namespace HeadlessSpecRunner { page.mainFrame()->setHtml(""); QVERIFY(consoleLogCalled); } -} -QTEST_MAIN(HeadlessSpecRunner::PageTest); +QTEST_MAIN(PageTest); diff --git a/ext/jasmine-webkit-specrunner/Page_test.h b/ext/jasmine-webkit-specrunner/Page_test.h index 7d500b1..dcd7872 100644 --- a/ext/jasmine-webkit-specrunner/Page_test.h +++ b/ext/jasmine-webkit-specrunner/Page_test.h @@ -5,7 +5,6 @@ #include "Page.h" -namespace HeadlessSpecRunner { class PageTest : public QObject { Q_OBJECT public: @@ -14,7 +13,7 @@ namespace HeadlessSpecRunner { private: bool internalLogCalled; bool consoleLogCalled; - HeadlessSpecRunner::Page page; + Page page; private slots: void internalLog(const QString ¬e, const QString &msg); @@ -23,7 +22,6 @@ namespace HeadlessSpecRunner { void testJavaScriptConfirmWithoutLog(); void testJavaScriptConsoleMessage(); }; -} #endif diff --git a/ext/jasmine-webkit-specrunner/ReportFileOutput.cpp b/ext/jasmine-webkit-specrunner/ReportFileOutput.cpp new file mode 100644 index 0000000..5093ed1 --- /dev/null +++ b/ext/jasmine-webkit-specrunner/ReportFileOutput.cpp @@ -0,0 +1,10 @@ +#include "ReportFileOutput.h" + +ReportFileOutput::ReportFileOutput() : QObject() { + +} + +void ReportFileOutput::passed(const QString &specDetail) { + *outputIO << "PASS||" << qPrintable(specDetail) << std::endl; + successes.push(specDetail); +} diff --git a/ext/jasmine-webkit-specrunner/ReportFileOutput.h b/ext/jasmine-webkit-specrunner/ReportFileOutput.h new file mode 100644 index 0000000..fedf612 --- /dev/null +++ b/ext/jasmine-webkit-specrunner/ReportFileOutput.h @@ -0,0 +1,29 @@ +#ifndef JHW_REPORT_FILE_OUTPUT +#define JHW_REPORT_FILE_OUTPUT + +#include +#include +#include + +class ReportFileOutput : public QObject { + public: + ReportFileOutput(); + + void passed(const QString &specDetail); + void failed(const QString &specDetail); + void errorLog(const QString &msg, int lineNumber, const QString &sourceID); + void internalLog(const QString ¬e, const QString &msg); + void consoleLog(const QString &msg); + void logSpecFilename(const QString &name); + void logSpecResult(const QString &result); + + void reportFailure(const QString &totalTests, const QString &failedTests, const QString &duration); + void reportSuccess(const QString &totalTests, const QString &failedTests, const QString &duration); + void reportSuccessWithJSErrors(const QString &totalTests, const QString &failedTests, const QString &duration); + + std::ostream *outputIO; + QStack successes; + QStack failures; +}; + +#endif diff --git a/ext/jasmine-webkit-specrunner/ReportFileOutput_test.cpp b/ext/jasmine-webkit-specrunner/ReportFileOutput_test.cpp new file mode 100644 index 0000000..b25931e --- /dev/null +++ b/ext/jasmine-webkit-specrunner/ReportFileOutput_test.cpp @@ -0,0 +1,22 @@ +#include + +#include "ReportFileOutput.h" +#include "ReportFileOutput_test.h" + +using namespace std; + +ReportFileOutputTest::ReportFileOutputTest() : QObject() {} + +void ReportFileOutputTest::testPassed() { + stringstream buffer; + ReportFileOutput output; + + output.outputIO = &buffer; + output.passed("test||done||file.js:23"); + QVERIFY(buffer.str() == "PASS||test||done||file.js:23\n"); + QVERIFY(output.successes.size() == 1); + QVERIFY(output.failures.size() == 0); +} + +QTEST_MAIN(ReportFileOutputTest); + diff --git a/ext/jasmine-webkit-specrunner/ReportFileOutput_test.h b/ext/jasmine-webkit-specrunner/ReportFileOutput_test.h new file mode 100644 index 0000000..7fe1516 --- /dev/null +++ b/ext/jasmine-webkit-specrunner/ReportFileOutput_test.h @@ -0,0 +1,19 @@ +#ifndef JHW_TEST_REPORT_FILE_OUTPUT +#define JHW_TEST_REPORT_FILE_OUTPUT + +#include +#include +#include +#include + +#include "ReportFileOutput.h" + +class ReportFileOutputTest : public QObject { + Q_OBJECT + public: + ReportFileOutputTest(); + private slots: + void testPassed(); +}; + +#endif diff --git a/ext/jasmine-webkit-specrunner/ReportFileOutput_test.pro b/ext/jasmine-webkit-specrunner/ReportFileOutput_test.pro new file mode 100644 index 0000000..12485f0 --- /dev/null +++ b/ext/jasmine-webkit-specrunner/ReportFileOutput_test.pro @@ -0,0 +1,7 @@ +include(common.pri) +include(test.pri) + +SOURCES += ReportFileOutput_test.cpp +HEADERS += ReportFileOutput_test.h + + diff --git a/ext/jasmine-webkit-specrunner/Runner.cpp b/ext/jasmine-webkit-specrunner/Runner.cpp index 208be7c..d633449 100644 --- a/ext/jasmine-webkit-specrunner/Runner.cpp +++ b/ext/jasmine-webkit-specrunner/Runner.cpp @@ -7,7 +7,6 @@ #include "Runner.h" -namespace HeadlessSpecRunner { Runner::Runner() : QObject() , m_runs(0) , hasErrors(false) @@ -201,5 +200,4 @@ namespace HeadlessSpecRunner { QApplication::instance()->exit(1); } } -} diff --git a/ext/jasmine-webkit-specrunner/Runner.h b/ext/jasmine-webkit-specrunner/Runner.h index a1275d6..bb78b5f 100644 --- a/ext/jasmine-webkit-specrunner/Runner.h +++ b/ext/jasmine-webkit-specrunner/Runner.h @@ -10,8 +10,8 @@ #include "Page.h" #include "ConsoleOutput.h" +#include "ReportFileOutput.h" -namespace HeadlessSpecRunner { class Runner: public QObject { Q_OBJECT public: @@ -38,7 +38,7 @@ namespace HeadlessSpecRunner { bool hasElement(const char *select); void timerEvent(QTimerEvent *event); private: - HeadlessSpecRunner::Page m_page; + Page m_page; QBasicTimer m_ticker; int m_runs; bool hasErrors; @@ -49,10 +49,10 @@ namespace HeadlessSpecRunner { QString reportFilename; QStack failedSpecs; - HeadlessSpecRunner::ConsoleOutput consoleOutput; + ConsoleOutput consoleOutput; + ReportFileOutput reportFileOutput; void loadSpec(); }; -} #endif diff --git a/ext/jasmine-webkit-specrunner/common.pri b/ext/jasmine-webkit-specrunner/common.pri index e19d607..7fdf73b 100644 --- a/ext/jasmine-webkit-specrunner/common.pri +++ b/ext/jasmine-webkit-specrunner/common.pri @@ -4,6 +4,6 @@ QMAKE_INFO_PLIST = Info.plist QMAKESPEC = macx-g++ QT += network webkit -SOURCES = Page.cpp Runner.cpp ConsoleOutput.cpp -HEADERS = Page.h Runner.h ConsoleOutput.h +SOURCES = Page.cpp Runner.cpp ConsoleOutput.cpp ReportFileOutput.cpp +HEADERS = Page.h Runner.h ConsoleOutput.h ReportFileOutput.h diff --git a/ext/jasmine-webkit-specrunner/specrunner.cpp b/ext/jasmine-webkit-specrunner/specrunner.cpp index 0ae4469..66dd7a0 100644 --- a/ext/jasmine-webkit-specrunner/specrunner.cpp +++ b/ext/jasmine-webkit-specrunner/specrunner.cpp @@ -54,7 +54,7 @@ int main(int argc, char** argv) QApplication app(argc, argv); app.setApplicationName("jasmine-headless-webkit"); - HeadlessSpecRunner::Runner runner; + Runner runner; runner.setColors(showColors); runner.reportFile(reporter);