Skip to content

Commit

Permalink
Added spec for Xcode 4.3.2 error/warning format
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeredpath committed Mar 29, 2012
1 parent 9dbecd9 commit ae9897a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/xcode_build/translations/building.rb
Expand Up @@ -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
Expand Down
25 changes: 23 additions & 2 deletions spec/translations/building_translations_spec.rb
Expand Up @@ -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,
Expand All @@ -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(
Expand Down Expand Up @@ -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,
Expand All @@ -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)
Expand Down

0 comments on commit ae9897a

Please sign in to comment.