diff --git a/ext/jasmine-webkit-specrunner/ConsoleOutput.cpp b/ext/jasmine-webkit-specrunner/ConsoleOutput.cpp index 431aacd..0ae5172 100644 --- a/ext/jasmine-webkit-specrunner/ConsoleOutput.cpp +++ b/ext/jasmine-webkit-specrunner/ConsoleOutput.cpp @@ -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; + } } diff --git a/ext/jasmine-webkit-specrunner/ConsoleOutput.h b/ext/jasmine-webkit-specrunner/ConsoleOutput.h index 0861aa3..5069e4e 100644 --- a/ext/jasmine-webkit-specrunner/ConsoleOutput.h +++ b/ext/jasmine-webkit-specrunner/ConsoleOutput.h @@ -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 successes; QStack failures; diff --git a/ext/jasmine-webkit-specrunner/ConsoleOutput_test.cpp b/ext/jasmine-webkit-specrunner/ConsoleOutput_test.cpp index 6917615..d99d7a8 100644 --- a/ext/jasmine-webkit-specrunner/ConsoleOutput_test.cpp +++ b/ext/jasmine-webkit-specrunner/ConsoleOutput_test.cpp @@ -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); diff --git a/ext/jasmine-webkit-specrunner/ConsoleOutput_test.h b/ext/jasmine-webkit-specrunner/ConsoleOutput_test.h index 455113a..1537eea 100644 --- a/ext/jasmine-webkit-specrunner/ConsoleOutput_test.h +++ b/ext/jasmine-webkit-specrunner/ConsoleOutput_test.h @@ -17,6 +17,7 @@ namespace HeadlessSpecRunner { private slots: void testPassed(); void testFailed(); + void testErrorLog(); }; } diff --git a/ext/jasmine-webkit-specrunner/Page.cpp b/ext/jasmine-webkit-specrunner/Page.cpp index aab256e..6b9f91e 100644 --- a/ext/jasmine-webkit-specrunner/Page.cpp +++ b/ext/jasmine-webkit-specrunner/Page.cpp @@ -1,5 +1,6 @@ #include #include +#include #include "Page.h" diff --git a/ext/jasmine-webkit-specrunner/Runner.cpp b/ext/jasmine-webkit-specrunner/Runner.cpp index 83ed612..7330bae 100644 --- a/ext/jasmine-webkit-specrunner/Runner.cpp +++ b/ext/jasmine-webkit-specrunner/Runner.cpp @@ -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; diff --git a/ext/jasmine-webkit-specrunner/jhw-test b/ext/jasmine-webkit-specrunner/jhw-test index 347fe5a..763649b 100755 Binary files a/ext/jasmine-webkit-specrunner/jhw-test and b/ext/jasmine-webkit-specrunner/jhw-test differ diff --git a/lib/qt/qmake.rb b/lib/qt/qmake.rb index 0c684e5..a0012f0 100644 --- a/lib/qt/qmake.rb +++ b/lib/qt/qmake.rb @@ -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 diff --git a/spec/lib/qt/qmake_spec.rb b/spec/lib/qt/qmake_spec.rb index 4cc7016..45b61c4 100644 --- a/spec/lib/qt/qmake_spec.rb +++ b/spec/lib/qt/qmake_spec.rb @@ -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