xcoder 0.1.4 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -72,4 +72,145 @@ describe Xcode::Configuration do
72
72
 
73
73
  end
74
74
 
75
+ describe "String Properties" do
76
+
77
+ let(:string_properties) do
78
+ [ :product_name,
79
+ :prefix_header,
80
+ :info_plist_location,
81
+ :wrapper_extension,
82
+ :sdkroot,
83
+ :c_language_standard,
84
+ :gcc_version,
85
+ :code_sign_identity,
86
+ :iphoneos_deployment_target ]
87
+ end
88
+
89
+ it "should be able to correctly get the property" do
90
+
91
+ string_properties.each do |property|
92
+ subject.send(property).should be_kind_of(String), "#{property} failed to return a String"
93
+ end
94
+
95
+ end
96
+
97
+ it "should be able to correctly set the property" do
98
+
99
+ string_properties.each do |property|
100
+ subject.send("#{property}=","new value")
101
+ subject.send(property).should eq("new value"), "#{property} failed to be set correctly"
102
+ end
103
+
104
+ end
105
+
106
+ end
107
+
108
+ describe "Boolean Properties" do
109
+
110
+ let(:boolean_properties) do
111
+ [ :precompile_prefix_headers,
112
+ :always_search_user_paths,
113
+ :warn_about_missing_prototypes,
114
+ :warn_about_return_type,
115
+ :validate_product,
116
+ :copy_phase_strip ]
117
+ end
118
+
119
+ it "should be able to set to false with NO" do
120
+
121
+ boolean_properties.each do |property|
122
+ subject.send("#{property}=","NO")
123
+ subject.send(property).should be_false, "#{property} failed to be set correctly to false"
124
+ end
125
+
126
+ end
127
+
128
+ it "should be able to set to false with false" do
129
+
130
+ boolean_properties.each do |property|
131
+ subject.send("#{property}=",false)
132
+ subject.send(property).should be_false, "#{property} failed to be set correctly to false"
133
+ end
134
+
135
+ end
136
+
137
+ it "should be able to true with YES" do
138
+
139
+ boolean_properties.each do |property|
140
+ subject.send("#{property}=","YES")
141
+ subject.send(property).should be_true, "#{property} failed to be set correctly to true"
142
+ end
143
+
144
+ end
145
+
146
+ it "should be able to set set to true with true" do
147
+
148
+ boolean_properties.each do |property|
149
+ subject.send("#{property}=",true)
150
+ subject.send(property).should be_true, "#{property} failed to be set correctly to true"
151
+ end
152
+
153
+ end
154
+
155
+ end
156
+
157
+ describe "Space Delimited String Properties" do
158
+
159
+ let(:space_delimited_string_properties) do
160
+ [ :architectures,
161
+ :supported_platforms ]
162
+ end
163
+
164
+ it "should be able to correctly get the property" do
165
+
166
+ space_delimited_string_properties.each do |property|
167
+ subject.send(property).should be_kind_of(Array), "#{property} failed to return an Array"
168
+ end
169
+
170
+ end
171
+
172
+ it "should be able to correctly set the property with a string with spaces" do
173
+
174
+ space_delimited_string_properties.each do |property|
175
+ subject.send("#{property}=","new value")
176
+ subject.send(property).should eq([ "new", "value" ]), "#{property} failed to be set correctly"
177
+ end
178
+
179
+ end
180
+
181
+ it "should be able to correctly set the property with an array" do
182
+
183
+ space_delimited_string_properties.each do |property|
184
+ subject.send("#{property}=",["more", "value"])
185
+ subject.send(property).should eq([ "more", "value" ]), "#{property} failed to be set correctly"
186
+ end
187
+
188
+ end
189
+
190
+ end
191
+
192
+ describe "Targeted Device Family Properties" do
193
+
194
+ let(:targeted_device_family_properties) { [ :targeted_device_family ] }
195
+
196
+ it "should be able to correctly get the property" do
197
+
198
+ targeted_device_family_properties.each do |property|
199
+ subject.send(property).should == [ ]
200
+ end
201
+
202
+ end
203
+
204
+ it "should be able to correctly set the property with device names" do
205
+
206
+ targeted_device_family_properties.each do |property|
207
+ subject.send("#{property}=",[ 'IPHONE', :ipad ])
208
+ subject.get("TARGETED_DEVICE_FAMILY").should == "1,2"
209
+ subject.send(property).should == [ :iphone, :ipad ]
210
+ end
211
+
212
+ end
213
+
214
+ end
215
+
75
216
  end
@@ -5,6 +5,8 @@ describe Xcode::Test::OCUnitReportParser do
5
5
 
6
6
  def example_report
7
7
  t = Xcode::Test::OCUnitReportParser.new
8
+ yield(t) if block_given?
9
+
8
10
  t << "Run test suite AnExampleTestSuite"
9
11
  t << "Test Suite 'AnExampleTestSuite' started at 2012-02-10 00:37:04 +0000"
10
12
 
@@ -16,19 +18,53 @@ describe Xcode::Test::OCUnitReportParser do
16
18
  t << "Test Case '-[AnExampleTestSuite anExampleTest2]' started."
17
19
  t << "Test Case '-[AnExampleTestSuite anExampleTest2]' passed (0.003 seconds)."
18
20
 
19
- yield(t) if block_given?
20
-
21
21
  t << "Test Suite 'AnExampleTestSuite' finished at 2012-02-10 00:37:04 +0000."
22
22
  t << "Executed 1 test, with 0 failures (0 unexpected) in 0.000 (0.000) seconds"
23
23
 
24
24
  t
25
25
  end
26
26
 
27
- def example_failing_report
28
- example_report do |t|
29
- t << "Test Case '-[AnExampleTestSuite aFailingTest]' started."
30
- t << "Test Case '-[AnExampleTestSuite aFailingTest]' failed (2 seconds)."
27
+ def example_failing_report
28
+ t = Xcode::Test::OCUnitReportParser.new
29
+ t << "Run test suite AnExampleTestSuite"
30
+ t << "Test Suite 'AnExampleTestSuite' started at 2012-02-10 00:37:04 +0000"
31
+ t << "Test Case '-[AnExampleTestSuite aFailingTest]' started."
32
+ yield(t) if block_given?
33
+ t << "Test Case '-[AnExampleTestSuite aFailingTest]' failed (2 seconds)."
34
+ t << "Test Suite 'AnExampleTestSuite' finished at 2012-02-10 00:37:04 +0000."
35
+ t << "Executed 1 test, with 0 failures (0 unexpected) in 0.000 (0.000) seconds"
36
+ t
37
+ end
38
+
39
+ it "should capture output for a test case" do
40
+ t = example_failing_report do |parser|
41
+ parser << '2012-02-17 15:03:06.521 otest[24979:7803] line1'
42
+ parser << '2012-02-17 15:03:06.521 otest[24979:7803] line2'
43
+ parser << '2012-02-17 15:03:06.521 otest[24979:7803] line3'
44
+ parser << '2012-02-17 15:03:06.521 otest[24979:7803] line4'
45
+ parser << '/Some/Path/To/Test.m:1234: error: -[AnExampleTestSuite aFailingTest] : This is an error message'
46
+ end
47
+
48
+ failure = t.reports.first.tests[0]
49
+ failure.passed?.should==false
50
+ failure.errors.count.should==1
51
+ failure.errors[0][:data].count.should==4
52
+ failure.errors[0][:data][0].should=~/line1/
53
+ failure.errors[0][:data][1].should=~/line2/
54
+ failure.errors[0][:data][2].should=~/line3/
55
+ failure.errors[0][:data][3].should=~/line4/
56
+ end
57
+
58
+ it "should capture errors reported during a test" do
59
+ t = example_failing_report do |parser|
60
+ parser << '/Some/Path/To/Test.m:1234: error: -[AnExampleTestSuite aFailingTest] : This is an error message'
31
61
  end
62
+
63
+ failure = t.reports.first.tests[0]
64
+ failure.passed?.should==false
65
+ failure.errors.count.should==1
66
+ failure.errors[0][:message].should=='This is an error message'
67
+ failure.errors[0][:location].should=='/Some/Path/To/Test.m:1234'
32
68
  end
33
69
 
34
70
  it "should create a test case" do
@@ -39,14 +75,14 @@ describe Xcode::Test::OCUnitReportParser do
39
75
  t.reports.first.end_time.should==Time.parse("2012-02-10 00:37:04 +0000")
40
76
  end
41
77
 
42
- it "should set the exist status to 0" do
78
+ it "should detect a passing report" do
43
79
  t = example_report
44
- t.exit_code.should==0
80
+ t.failed?.should==false
45
81
  end
46
82
 
47
- it "should set the exit status to non 0" do
83
+ it "should detect a failing report" do
48
84
  t = example_failing_report
49
- t.exit_code.should_not==0
85
+ t.failed?.should==true
50
86
  end
51
87
 
52
88
  it "should record a failure" do
@@ -67,19 +103,45 @@ describe Xcode::Test::OCUnitReportParser do
67
103
  t.reports.first.tests[1].time.should==0.003
68
104
  t.reports.first.tests[1].passed?.should==true
69
105
  end
106
+
107
+ it "should capture failed build" do
108
+ t = Xcode::Test::OCUnitReportParser.new
109
+ t << "Run test suite AnExampleTestSuite"
110
+ t << "Test Suite 'AnExampleTestSuite' started at 2012-02-10 00:37:04 +0000"
111
+ t << "Run test case anExampleTest1"
112
+ t << "Test Case '-[AnExampleTestSuite anExampleTest1]' started."
113
+ t << "/Path/To/Project/Tests/YPKeywordSuggestHandlerTest.m:45: error: -[AnExampleTestSuite anExampleTest1] : 'An example test spec' [FAILED], mock received unexpected message -setSuspended: 1 "
114
+ t << "/Developer/Tools/RunPlatformUnitTests.include: line 415: 32225 Bus error: 10 \"${THIN_TEST_RIG}\" \"${OTHER_TEST_FLAGS}\" \"${TEST_BUNDLE_PATH}\""
115
+ t << "/Developer/Tools/RunPlatformUnitTests.include:451: error: Test rig '/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/Developer/usr/bin/otest' exited abnormally with code 138 (it may have crashed)."
116
+
117
+ t.flush
118
+ t.failed?.should==true
119
+ t.finished?.should==true
120
+ failure = t.reports.first.tests[0]
121
+ failure.passed?.should==false
122
+ failure.data.count.should==2
123
+ failure.data[0].should=~/32225 Bus error: 10/
124
+ failure.data[1].should=~/Test rig/
125
+ end
70
126
 
71
- it "should write out reports in junit format" do
72
- report_dir = "#{File.dirname(__FILE__)}/test-reports"
73
- FileUtils.rm_rf report_dir
127
+ context "Junit output" do
74
128
 
75
- t = example_report
76
- t.write(report_dir, :junit)
129
+ it "should write out reports in junit format" do
130
+ report_dir = "#{File.dirname(__FILE__)}/test-reports"
131
+ FileUtils.rm_rf report_dir
77
132
 
78
- files = Dir["#{report_dir}/*.xml"]
79
- files.count.should==1
80
- files.first.should=~/TEST-AnExampleTestSuite.xml$/
133
+ t = example_report do |t|
134
+ t.formatters = []
135
+ t.add_formatter :junit, report_dir
136
+ end
137
+
138
+ files = Dir["#{report_dir}/*.xml"]
139
+ files.count.should==1
140
+ files.first.should=~/TEST-AnExampleTestSuite.xml$/
141
+
142
+ # FIXME: parse the report
143
+ end
81
144
 
82
- # FIXME: parse the report
83
145
  end
84
146
 
85
147
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xcoder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-02-15 00:00:00.000000000Z
13
+ date: 2012-02-20 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: json
17
- requirement: &70096937211600 !ruby/object:Gem::Requirement
17
+ requirement: &70283097046240 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70096937211600
25
+ version_requirements: *70283097046240
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: plist
28
- requirement: &70096937211180 !ruby/object:Gem::Requirement
28
+ requirement: &70283097045820 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *70096937211180
36
+ version_requirements: *70283097045820
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: nokogiri
39
- requirement: &70096937210760 !ruby/object:Gem::Requirement
39
+ requirement: &70283097045400 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: '0'
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *70096937210760
47
+ version_requirements: *70283097045400
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: builder
50
- requirement: &70096937210340 !ruby/object:Gem::Requirement
50
+ requirement: &70283097044980 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: '0'
56
56
  type: :runtime
57
57
  prerelease: false
58
- version_requirements: *70096937210340
58
+ version_requirements: *70283097044980
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: rest-client
61
- requirement: &70096937209920 !ruby/object:Gem::Requirement
61
+ requirement: &70283097044560 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ! '>='
@@ -66,7 +66,7 @@ dependencies:
66
66
  version: '0'
67
67
  type: :runtime
68
68
  prerelease: false
69
- version_requirements: *70096937209920
69
+ version_requirements: *70283097044560
70
70
  description: Provides a ruby based object-model for parsing project structures and
71
71
  invoking builds
72
72
  email:
@@ -90,6 +90,11 @@ files:
90
90
  - lib/xcode/buildfile.rb
91
91
  - lib/xcode/configuration.rb
92
92
  - lib/xcode/configuration_list.rb
93
+ - lib/xcode/configurations/array_property.rb
94
+ - lib/xcode/configurations/boolean_property.rb
95
+ - lib/xcode/configurations/space_delimited_string_property.rb
96
+ - lib/xcode/configurations/string_property.rb
97
+ - lib/xcode/configurations/targeted_device_family_property.rb
93
98
  - lib/xcode/core_ext/array.rb
94
99
  - lib/xcode/core_ext/boolean.rb
95
100
  - lib/xcode/core_ext/fixnum.rb
@@ -109,6 +114,7 @@ files:
109
114
  - lib/xcode/simple_identifier_generator.rb
110
115
  - lib/xcode/target.rb
111
116
  - lib/xcode/test/formatters/junit_formatter.rb
117
+ - lib/xcode/test/formatters/stdout_formatter.rb
112
118
  - lib/xcode/test/ocunit_report_parser.rb
113
119
  - lib/xcode/test/suite_result.rb
114
120
  - lib/xcode/test/test_result.rb