ocrunner 0.2.4 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.4
1
+ 0.2.5
data/lib/ocrunner/cli.rb CHANGED
@@ -25,6 +25,7 @@ module OCRunner
25
25
  opt :growl, "Report results using Growl", :type => :boolean, :default => false
26
26
  opt :debug_command, "Print xcodebuild command and exit", :type => :boolean, :default => false
27
27
  opt :verbose, "Display all xcodebuild output after summary", :type => :boolean, :default => false
28
+ opt :loud_compilation, "Always show verbose output when a compilation or linking error occurs", :type => :boolean, :default => true
28
29
  end
29
30
 
30
31
  execute = Proc.new{ OCRunner::TestRunner.new(opts) }
@@ -10,6 +10,15 @@ module OCRunner
10
10
  def initialize(name)
11
11
  @name = name
12
12
  @errors = []
13
+ @passed = true
14
+ end
15
+
16
+ def fail!
17
+ @passed = false
18
+ end
19
+
20
+ def passed?
21
+ @passed
13
22
  end
14
23
  end
15
24
  end
@@ -23,7 +23,7 @@ module OCRunner
23
23
  end
24
24
 
25
25
  def setup
26
- puts "="*80
26
+ puts "-"*80
27
27
  puts
28
28
  end
29
29
 
@@ -49,7 +49,7 @@ module OCRunner
49
49
  def summarize
50
50
 
51
51
  @suites.each do |suite|
52
- suite.cases.reject {|kase| kase.passed}.each do |kase|
52
+ suite.cases.reject {|kase| kase.passed?}.each do |kase|
53
53
  out
54
54
  out ' ' + red("[#{suite.name} #{kase.name}] FAIL")
55
55
  kase.errors.each do |error|
@@ -60,7 +60,7 @@ module OCRunner
60
60
  end
61
61
 
62
62
  @suites.each do |suite|
63
- failed = suite.cases.reject {|c| c.passed}
63
+ failed = suite.cases.reject {|kase| kase.passed?}
64
64
  out "Suite '#{suite.name}': #{suite.cases.size - failed.size} passes and #{failed.size} failures in #{suite.time} seconds."
65
65
  end
66
66
 
@@ -74,7 +74,8 @@ module OCRunner
74
74
  end
75
75
 
76
76
  def display_results
77
- puts @log if @options[:verbose] || compilation_error_occurred
77
+ puts
78
+ puts @log if @options[:verbose] || (compilation_error_occurred && @options[:loud_compilation])
78
79
  puts @output.join("\n")
79
80
  puts
80
81
  end
@@ -104,15 +105,13 @@ module OCRunner
104
105
 
105
106
  # test case passed
106
107
  if line =~ /Test Case .+ passed/
107
- @current_case.passed = true
108
- @current_suite.cases << @current_case
109
108
  @current_case = nil
110
109
  print(green('.'))
111
110
  end
112
111
 
113
112
  # test failure
114
- if line =~ /(.+\.m):(\d+): error: -\[(.+) (.+)\] :(?: (.+):?)? /
115
- @current_case.passed = false
113
+ if line =~ /(.+\.m):(\d+): error: -\[(.+) (.+)\] :(?: (.+):?)?/
114
+ @current_case.fail!
116
115
  @current_case.errors << TestError.new($1, $2, $5)
117
116
  @passed = false
118
117
  print red('.')
@@ -121,14 +120,13 @@ module OCRunner
121
120
  # start test suite
122
121
  if line =~ /Test Suite '([^\/]+)' started/
123
122
  @current_suite = TestSuite.new($1)
123
+ @suites << @current_suite
124
124
  print "#{$1} "
125
125
  end
126
126
 
127
127
  # finish test suite
128
128
  if @current_suite && line =~ /^Executed/ && line =~ /\(([\d\.]+)\) seconds/
129
129
  @current_suite.time = $1
130
- @suites << @current_suite
131
- @current_suite = nil
132
130
  print "\n" # clear console line
133
131
  end
134
132
 
@@ -137,16 +135,29 @@ module OCRunner
137
135
  build_error("Test executable #{clean_path($1)} could not be found")
138
136
  end
139
137
 
138
+ # compilation errors
139
+ if line =~ /(.+\.m):(\d+): error: (.*)/
140
+ compilation_error_occurred!
141
+ build_error($&)
142
+ end
143
+
140
144
  # compilation reference error
141
145
  if line =~ /"(.+)", referenced from:/
142
146
  compilation_error_occurred!
143
147
  build_error($&)
144
148
  end
149
+
150
+ # linking error
145
151
  if line =~ /-\[\w+ \w+\] in .+\.o/
146
152
  compilation_error_occurred!
147
153
  build_error($&)
148
154
  end
149
155
 
156
+ # segfault
157
+ if line =~ /Segmentation fault/
158
+ build_error('Segmentation fault while running tests.')
159
+ end
160
+
150
161
  # no Xcode project found
151
162
  if line =~ /does not contain an Xcode project/
152
163
  build_error('No Xcode project was found.')
data/ocrunner.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ocrunner}
8
- s.version = "0.2.4"
8
+ s.version = "0.2.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jim Benton"]
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 4
9
- version: 0.2.4
8
+ - 5
9
+ version: 0.2.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jim Benton