clean up cpp some more
This commit is contained in:
parent
a46e72c1e2
commit
e3923335b8
@ -36,4 +36,12 @@ namespace HeadlessSpecRunner {
|
||||
void ConsoleOutput::red() {
|
||||
if (showColors) std::cout << "\033[0;31m";
|
||||
}
|
||||
|
||||
void ConsoleOutput::errorLog(const QString &msg, int lineNumber, const QString &sourceID) {
|
||||
red();
|
||||
*outputIO << "[error] ";
|
||||
clear();
|
||||
*outputIO << qPrintable(sourceID) << ":" << lineNumber << " : " << qPrintable(msg);
|
||||
*outputIO << std::endl;
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ namespace HeadlessSpecRunner {
|
||||
ConsoleOutput();
|
||||
void passed(const QString &specDetail);
|
||||
void failed(const QString &specDetail);
|
||||
void errorLog(const QString &msg, int lineNumber, const QString &sourceID);
|
||||
std::ostream *outputIO;
|
||||
QStack<QString> successes;
|
||||
QStack<QString> failures;
|
||||
|
@ -30,6 +30,15 @@ namespace HeadlessSpecRunner {
|
||||
QVERIFY(output.successes.size() == 0);
|
||||
QVERIFY(output.failures.size() == 1);
|
||||
}
|
||||
|
||||
void ConsoleOutputTest::testErrorLog() {
|
||||
stringstream buffer;
|
||||
HeadlessSpecRunner::ConsoleOutput output;
|
||||
|
||||
output.outputIO = &buffer;
|
||||
output.errorLog("message", 1, "source");
|
||||
QVERIFY(buffer.str() == "[error] source:1 : message\n");
|
||||
}
|
||||
}
|
||||
|
||||
QTEST_MAIN(HeadlessSpecRunner::ConsoleOutputTest);
|
||||
|
@ -17,6 +17,7 @@ namespace HeadlessSpecRunner {
|
||||
private slots:
|
||||
void testPassed();
|
||||
void testFailed();
|
||||
void testErrorLog();
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include <QtGui>
|
||||
#include <QtWebKit>
|
||||
#include <iostream>
|
||||
|
||||
#include "Page.h"
|
||||
|
||||
|
@ -114,11 +114,7 @@ namespace HeadlessSpecRunner {
|
||||
|
||||
void Runner::errorLog(const QString &msg, int lineNumber, const QString &sourceID)
|
||||
{
|
||||
red();
|
||||
std::cout << "[error] ";
|
||||
clear();
|
||||
std::cout << qPrintable(sourceID) << ":" << lineNumber << " : " << qPrintable(msg);
|
||||
std::cout << std::endl;
|
||||
consoleOutput.errorLog(msg, lineNumber, sourceID);
|
||||
|
||||
hasErrors = true;
|
||||
m_runs = 0;
|
||||
|
Binary file not shown.
@ -32,7 +32,7 @@ module Qt
|
||||
"macx-g++"
|
||||
end)
|
||||
|
||||
command = "#{path} -spec #{spec}"
|
||||
command = "#{path} #{envs} -spec #{spec}"
|
||||
command << " #{project_file}" if project_file
|
||||
command
|
||||
end
|
||||
@ -95,6 +95,14 @@ module Qt
|
||||
end
|
||||
|
||||
private
|
||||
def envs
|
||||
%w{QMAKE_CC QMAKE_CXX}.collect do |env|
|
||||
if ENV[env]
|
||||
"#{env}=#{ENV[env]}"
|
||||
end
|
||||
end.compact.join(" ")
|
||||
end
|
||||
|
||||
def number_of_cpus
|
||||
if defined?(Facter)
|
||||
Facter.sp_number_processors rescue Facter.processorcount
|
||||
|
@ -55,13 +55,15 @@ describe Qt::Qmake do
|
||||
context 'linux' do
|
||||
let(:platform) { :linux }
|
||||
|
||||
it { should == "qmake -spec linux-g++" }
|
||||
it { should =~ /^qmake/ }
|
||||
it { should =~ /-spec linux-g\+\+$/ }
|
||||
end
|
||||
|
||||
context 'mac os x' do
|
||||
let(:platform) { :mac_os_x }
|
||||
|
||||
it { should == "qmake -spec macx-g++" }
|
||||
it { should =~ /^qmake/ }
|
||||
it { should =~ /-spec macx-g\+\+$/ }
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user