don't print a ton of duplicates

This commit is contained in:
John Bintz 2011-04-10 14:30:55 -04:00
parent 93ea7c62dd
commit 89e09d3abe
2 changed files with 19 additions and 2 deletions

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
specrunner/specrunner.moc
specrunner/specrunner.o
specrunner/specrunner.app
specrunner/specrunner
specrunner/Makefile

View File

@ -86,7 +86,19 @@ void HeadlessSpecRunner::log(int indent, const QString &msg)
std::cout << std::endl; std::cout << std::endl;
} }
#define DUMP_MSG "(function(n, i) { if (n.toString() === '[object NodeList]') { for (var c = 0; c < n.length; ++c) arguments.callee(n[c], i); return } if (n.className === 'description' || n.className == 'resultMessage fail') debug.log(i, n.textContent); var e = n.firstElementChild; while (e) { arguments.callee(e, i + 1); e = e.nextElementSibling; } })(document.getElementsByClassName('suite failed'), 1);" #define DUMP_MSG "(function(n, i) { \
if (n.toString() === '[object NodeList]') { \
for (var c = 0; c < n.length; ++c) arguments.callee(n[c], i); return \
}\
if (n.className === 'description' || n.className == 'resultMessage fail') {\
debug.log(i, n.textContent);\
}\
var e = n.firstElementChild;\
while (e) {\
arguments.callee(e, i + 1); e = e.nextElementSibling; \
}\
n.className = '';\
})(document.getElementsByClassName('suite failed'), 1);"
void HeadlessSpecRunner::timerEvent(QTimerEvent *event) void HeadlessSpecRunner::timerEvent(QTimerEvent *event)
{ {
@ -108,7 +120,7 @@ void HeadlessSpecRunner::timerEvent(QTimerEvent *event)
std::cout << "FAIL: " << qPrintable(desc.toPlainText()) << std::endl; std::cout << "FAIL: " << qPrintable(desc.toPlainText()) << std::endl;
m_page.mainFrame()->addToJavaScriptWindowObject("debug", this); m_page.mainFrame()->addToJavaScriptWindowObject("debug", this);
m_page.mainFrame()->evaluateJavaScript(DUMP_MSG); m_page.mainFrame()->evaluateJavaScript(DUMP_MSG);
QDesktopServices::openUrl(m_page.mainFrame()->url()); //QDesktopServices::openUrl(m_page.mainFrame()->url());
QApplication::instance()->exit(1); QApplication::instance()->exit(1);
return; return;
} }