Skip to content

Commit ae9897a

Browse files
committed
Added spec for Xcode 4.3.2 error/warning format
1 parent 9dbecd9 commit ae9897a

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

lib/xcode_build/translations/building.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def attempt_to_translate(line)
3434
else
3535
notify_build_warning($1, $2, $3, $6)
3636
end
37-
when /^(.*):(\d+):(\d+): (error|warning): (.*)$/
37+
when /^(.*):(\d+):(\d+): (error|warning): (.*)$/ # xcode < 4.3.2
3838
if $4 == 'error'
3939
notify_build_error($1, $2, $3, $5)
4040
else

spec/translations/building_translations_spec.rb

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
translator << "\tCodeSign build/Debug-iphoneos/ExampleProject.app"
127127
end
128128

129-
it "notifies the delegate of errors that occur throughout the build" do
129+
it "notifies the delegate of errors that occur throughout the build on < Xcode 4.3.2" do
130130
delegate.should_receive(:build_error_detected).with(
131131
:file => "/ExampleProject/main.m",
132132
:line => 16,
@@ -135,6 +135,15 @@
135135
)
136136
translator << "/ExampleProject/main.m:16:42: error: expected ';' after expression [1]"
137137
end
138+
it "notifies the delegate of errors that occur throughout the build on >= Xcode 4.3.2" do
139+
delegate.should_receive(:build_error_detected).with(
140+
:file => "/ExampleProject/main.m",
141+
:line => 16,
142+
:char => 42,
143+
:message => "expected ';' after expression [1]"
144+
)
145+
translator << "/ExampleProject/main.m:16:42:something: error: expected ';' after expression [1]"
146+
end
138147

139148
it "notifies the delegate of errors for different build steps" do
140149
delegate.should_receive(:build_error_detected).with(
@@ -173,7 +182,7 @@
173182
translator << "Command /bin/sh failed with exit code 1"
174183
end
175184

176-
it "notifies the delegate of warnings" do
185+
it "notifies the delegate of warnings on < Xcode 4.3.2" do
177186
delegate.should_receive(:build_warning_detected).with(
178187
:file => "/ExampleProject/main.m",
179188
:line => 16,
@@ -184,6 +193,18 @@
184193
translator << "/ExampleProject/main.m:16:42: warning: 'foo:' is deprecated"
185194
translator << "1 warning generated."
186195
end
196+
197+
it "notifies the delegate of warnings on >= Xcode 4.3.2" do
198+
delegate.should_receive(:build_warning_detected).with(
199+
:file => "/ExampleProject/main.m",
200+
:line => 16,
201+
:char => 42,
202+
:message => "'foo:' is deprecated"
203+
)
204+
translator << "CompileC ExampleProject/main.m normal"
205+
translator << "/ExampleProject/main.m:16:42:something: warning: 'foo:' is deprecated"
206+
translator << "1 warning generated."
207+
end
187208

188209
it "treats :build_error_detected as an optional delegate message" do
189210
delegate_should_not_respond_to(:build_error_detected)

0 commit comments

Comments
 (0)