From ae9897a92eddfe926ab27393c91c077ae47e256e Mon Sep 17 00:00:00 2001 From: Luke Redpath Date: Thu, 29 Mar 2012 16:20:06 +0100 Subject: [PATCH] Added spec for Xcode 4.3.2 error/warning format --- lib/xcode_build/translations/building.rb | 2 +- .../building_translations_spec.rb | 25 +++++++++++++++++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/lib/xcode_build/translations/building.rb b/lib/xcode_build/translations/building.rb index ea6866e..b66f355 100644 --- a/lib/xcode_build/translations/building.rb +++ b/lib/xcode_build/translations/building.rb @@ -34,7 +34,7 @@ def attempt_to_translate(line) else notify_build_warning($1, $2, $3, $6) end - when /^(.*):(\d+):(\d+): (error|warning): (.*)$/ + when /^(.*):(\d+):(\d+): (error|warning): (.*)$/ # xcode < 4.3.2 if $4 == 'error' notify_build_error($1, $2, $3, $5) else diff --git a/spec/translations/building_translations_spec.rb b/spec/translations/building_translations_spec.rb index 9b6e2f6..1fd31b1 100644 --- a/spec/translations/building_translations_spec.rb +++ b/spec/translations/building_translations_spec.rb @@ -126,7 +126,7 @@ translator << "\tCodeSign build/Debug-iphoneos/ExampleProject.app" end - it "notifies the delegate of errors that occur throughout the build" do + it "notifies the delegate of errors that occur throughout the build on < Xcode 4.3.2" do delegate.should_receive(:build_error_detected).with( :file => "/ExampleProject/main.m", :line => 16, @@ -135,6 +135,15 @@ ) translator << "/ExampleProject/main.m:16:42: error: expected ';' after expression [1]" end + it "notifies the delegate of errors that occur throughout the build on >= Xcode 4.3.2" do + delegate.should_receive(:build_error_detected).with( + :file => "/ExampleProject/main.m", + :line => 16, + :char => 42, + :message => "expected ';' after expression [1]" + ) + translator << "/ExampleProject/main.m:16:42:something: error: expected ';' after expression [1]" + end it "notifies the delegate of errors for different build steps" do delegate.should_receive(:build_error_detected).with( @@ -173,7 +182,7 @@ translator << "Command /bin/sh failed with exit code 1" end - it "notifies the delegate of warnings" do + it "notifies the delegate of warnings on < Xcode 4.3.2" do delegate.should_receive(:build_warning_detected).with( :file => "/ExampleProject/main.m", :line => 16, @@ -184,6 +193,18 @@ translator << "/ExampleProject/main.m:16:42: warning: 'foo:' is deprecated" translator << "1 warning generated." end + + it "notifies the delegate of warnings on >= Xcode 4.3.2" do + delegate.should_receive(:build_warning_detected).with( + :file => "/ExampleProject/main.m", + :line => 16, + :char => 42, + :message => "'foo:' is deprecated" + ) + translator << "CompileC ExampleProject/main.m normal" + translator << "/ExampleProject/main.m:16:42:something: warning: 'foo:' is deprecated" + translator << "1 warning generated." + end it "treats :build_error_detected as an optional delegate message" do delegate_should_not_respond_to(:build_error_detected)