Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use String#scrub when parse. #289

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/xcpretty/parser.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# encoding: utf-8
require 'string/scrub' if RUBY_VERSION.to_f < 2.1

module XCPretty

Expand Down Expand Up @@ -301,6 +302,7 @@ def initialize(formatter)
end

def parse(text)
text = text.scrub('')
update_test_state(text)
update_error_state(text)
update_linker_failure_state(text)
Expand Down
1 change: 1 addition & 0 deletions spec/fixtures/constants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
SAMPLE_EXECUTED_TESTS = "Executed 4 tests, with 0 failures (0 unexpected) in 0.003 (0.004) seconds"
SAMPLE_SPECTA_EXECUTED_TESTS = " Executed 4 tests, with 0 failures (0 unexpected) in 10.192 (10.193) seconds"
SAMPLE_OCUNIT_TEST = "Test Case '-[RACCommandSpec enabled_signal_should_send_YES_while_executing_is_YES]' passed (0.001 seconds)."
SAMPLE_OCUNIT_TEST_WITH_INVALID_BYTE_SEQUENCE = "Test Case '-[RACCommandSpec enabled_signal_should_send_YES\x81_while_executing_is_YES]' passed (0.001 seconds)."
SAMPLE_SPECTA_TEST = " Test Case '-[SKWelcomeActivationViewControllerSpecSpec SKWelcomeActivationViewController_When_a_user_enters_their_details_lets_them_enter_a_valid_manager_code]' passed (0.725 seconds)."
SAMPLE_SLOWISH_TEST = "Test Case '-[RACCommandSpec enabled_signal_should_send_YES_while_executing_is_YES_and_allowsConcurrentExecution_is_YES]' passed (0.026 seconds)."
SAMPLE_SLOW_TEST = "Test Case '-[RACCommandSpec enabled_signal_should_send_YES_while_executing_is_YES_and_allowsConcurrentExecution_is_YES]' passed (0.101 seconds)."
Expand Down
7 changes: 7 additions & 0 deletions spec/xcpretty/parser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,13 @@ module XCPretty
@parser.parse(SAMPLE_OCUNIT_TEST)
end

it "parses passing ocunit tests, but include invalid byte sequence" do
@formatter.should receive(:format_passing_test).with('RACCommandSpec',
'enabled_signal_should_send_YES_while_executing_is_YES',
'0.001')
@parser.parse(SAMPLE_OCUNIT_TEST_WITH_INVALID_BYTE_SEQUENCE)
end

it "parses passing specta tests" do
@formatter.should receive(:format_passing_test).with('SKWelcomeActivationViewControllerSpecSpec',
'SKWelcomeActivationViewController_When_a_user_enters_their_details_lets_them_enter_a_valid_manager_code',
Expand Down
1 change: 1 addition & 0 deletions xcpretty.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Gem::Specification.new do |spec|
spec.require_paths = ["lib"]

spec.add_dependency 'rouge', '~> 2.0.7'
spec.add_dependency 'string-scrub', '~> 0.1.1' if RUBY_VERSION.to_f < 2.1

spec.add_development_dependency "bundler", "~> 1.3"
spec.add_development_dependency "rake"
Expand Down