Skip to content

Commit

Permalink
Fix xcode command crash when OTHER_CFLAGS is not specified
Browse files Browse the repository at this point in the history
  • Loading branch information
soutaro committed Jun 2, 2016
1 parent 1413429 commit d5abadd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions frontend/lib/nullarihyon/xcode.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ def run(io)
end

def self.tokenize_command_line(line)
return [] unless line

scanner = StringScanner.new(line)

tokens = []
Expand Down
9 changes: 9 additions & 0 deletions frontend/test/xcode_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ class XcodeTest < MiniTest::Spec
it "returns OTHER_CFLAGS from env" do
assert_equal %w(-iquote /some/directory -isystem /another/directory), xcode.other_cflags
end

it "returns empty array if OTHER_CFLAGS is missing in env" do
env.delete("OTHER_CFLAGS")
assert_equal [], xcode.other_cflags
end
end

describe "#arc_enabled?" do
Expand All @@ -160,6 +165,10 @@ class XcodeTest < MiniTest::Spec
it "splits quoted command line" do
assert_equal ["hello world", "good morning"], Xcode.tokenize_command_line("\"hello world\" 'good morning'")
end

it "returns empty array when nil is given" do
assert_equal [], Xcode.tokenize_command_line(nil)
end
end
end
end

0 comments on commit d5abadd

Please sign in to comment.