slather 1.6.0 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +1 -1
- data/README.md +17 -7
- data/Rakefile +0 -13
- data/lib/slather/coverage_file.rb +11 -3
- data/lib/slather/coverage_service/coveralls.rb +1 -1
- data/lib/slather/version.rb +1 -1
- data/slather.gemspec +1 -0
- data/spec/fixtures/cobertura.xml +14 -2
- data/spec/fixtures/fixtures.xcodeproj/project.pbxproj +24 -0
- data/spec/fixtures/fixtures/fixtures_cpp.cpp +9 -0
- data/spec/fixtures/fixtures/fixtures_cpp.h +6 -0
- data/spec/fixtures/fixtures/fixtures_m.h +5 -0
- data/spec/fixtures/fixtures/fixtures_m.m +5 -0
- data/spec/fixtures/fixtures/fixtures_mm.h +5 -0
- data/spec/fixtures/fixtures/fixtures_mm.mm +5 -0
- data/spec/slather/coverage_file_spec.rb +17 -13
- data/spec/slather/coverage_service/cobertura_xml_spec.rb +11 -10
- data/spec/slather/coverage_service/simple_output_spec.rb +3 -0
- data/spec/spec_helper.rb +5 -0
- metadata +28 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c91239cfd731d05a9cabda1b4adde015ca6958d1
|
4
|
+
data.tar.gz: dd0069a75ff0a34ca9aa96f2e782ec11927f9431
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f300927fd46eb4d5aa429ae14dea9859b8121f0ddde63b6d3e5a7f81863392c8c98b52c4c0ff721920cd18c3a3093a3802c7d3b82e18f8e026d2a9ac624d6a0
|
7
|
+
data.tar.gz: 722b6f3d23a86bcdaab1df525feb28694eba4983e753fca64b93d0789225e279751d4b1672094a8ca7c0ef3a01309e7b29117e9a40d43b1c66823c16454a80c0
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -12,11 +12,11 @@ Generate test coverage reports for Xcode projects & hook it into CI.
|
|
12
12
|
|
13
13
|
| Project | Coverage |
|
14
14
|
| ------- |:--------:|
|
15
|
-
| [Parsimmon](https://github.com/ayanonagon/Parsimmon) | [![Parsimmon Coverage](https://coveralls.io/repos/ayanonagon/Parsimmon/badge.
|
16
|
-
| [VENCore](https://github.com/venmo/VENCore) | [![VENCore Coverage](https://coveralls.io/repos/venmo/VENCore/badge.
|
17
|
-
| [CGFloatType](https://github.com/kylef/CGFloatType) | [![CGFloatType Coverage](https://coveralls.io/repos/kylef/CGFloatType/badge.
|
18
|
-
| [DAZABTest](https://github.com/dasmer/DAZABTest) | [![DAZABTest Coverage](https://coveralls.io/repos/dasmer/DAZABTest/badge.
|
19
|
-
| [TBStateMachine](https://github.com/tarbrain/TBStateMachine) | [![TBStateMachine Coverage](https://coveralls.io/repos/tarbrain/TBStateMachine/badge.
|
15
|
+
| [Parsimmon](https://github.com/ayanonagon/Parsimmon) | [![Parsimmon Coverage](https://coveralls.io/repos/ayanonagon/Parsimmon/badge.svg?branch=master)](https://coveralls.io/r/ayanonagon/Parsimmon?branch=master) |
|
16
|
+
| [VENCore](https://github.com/venmo/VENCore) | [![VENCore Coverage](https://coveralls.io/repos/venmo/VENCore/badge.svg?branch=master)](https://coveralls.io/r/venmo/VENCore?branch=master) |
|
17
|
+
| [CGFloatType](https://github.com/kylef/CGFloatType) | [![CGFloatType Coverage](https://coveralls.io/repos/kylef/CGFloatType/badge.svg?branch=master)](https://coveralls.io/r/kylef/CGFloatType?branch=master) |
|
18
|
+
| [DAZABTest](https://github.com/dasmer/DAZABTest) | [![DAZABTest Coverage](https://coveralls.io/repos/dasmer/DAZABTest/badge.svg?branch=master)](https://coveralls.io/r/dasmer/DAZABTest?branch=master) |
|
19
|
+
| [TBStateMachine](https://github.com/tarbrain/TBStateMachine) | [![TBStateMachine Coverage](https://coveralls.io/repos/tarbrain/TBStateMachine/badge.svg?branch=master)](https://coveralls.io/r/tarbrain/TBStateMachine?branch=master) |
|
20
20
|
|
21
21
|
## Installation
|
22
22
|
|
@@ -51,7 +51,7 @@ $ slather coverage -s path/to/project.xcodeproj
|
|
51
51
|
|
52
52
|
### Coveralls
|
53
53
|
|
54
|
-
Login to [Coveralls](https://coveralls.io/) and enable your repository. Right now, `slather`
|
54
|
+
Login to [Coveralls](https://coveralls.io/) and enable your repository. Right now, `slather` supports Coveralls via [Travis CI](https://travis-ci.org) and [CircleCI](https://circleci.com).
|
55
55
|
|
56
56
|
Make a `.slather.yml` file:
|
57
57
|
|
@@ -65,7 +65,7 @@ ignore:
|
|
65
65
|
- ProjectTestsGroup/*
|
66
66
|
```
|
67
67
|
|
68
|
-
And then in your `.travis.yml`, call `slather` after a
|
68
|
+
And then in your `.travis.yml` or `circle.yml`, call `slather` after a successful build:
|
69
69
|
|
70
70
|
```yml
|
71
71
|
# .travis.yml
|
@@ -75,6 +75,15 @@ install: bundle install --without=documentation --path ../travis_bundle_dir
|
|
75
75
|
after_success: slather
|
76
76
|
```
|
77
77
|
|
78
|
+
```yml
|
79
|
+
# circle.yml
|
80
|
+
|
81
|
+
test:
|
82
|
+
post:
|
83
|
+
- bundle exec slather
|
84
|
+
|
85
|
+
```
|
86
|
+
|
78
87
|
#### Travis CI Pro
|
79
88
|
|
80
89
|
To use Coveralls with Travis CI Pro (for private repos), add following lines along with other settings to `.slather.yml`:
|
@@ -142,3 +151,4 @@ Please make sure to follow our general coding style and add test coverage for ne
|
|
142
151
|
|
143
152
|
* [@tpoulos](https://github.com/tpoulos), the perfect logo.
|
144
153
|
* [@ayanonagon](https://github.com/ayanonagon) and [@kylef](https://github.com/kylef), feedback and testing.
|
154
|
+
* [@jhersh](https://github.com/jhersh), CircleCI support.
|
data/Rakefile
CHANGED
@@ -1,14 +1 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
|
-
|
3
|
-
desc "Generate the test fixtures"
|
4
|
-
task :generate_fixtures do
|
5
|
-
sh "xcodebuild -project spec/fixtures/fixtures.xcodeproj/ -scheme fixtures -configuration Debug test"
|
6
|
-
end
|
7
|
-
|
8
|
-
desc "Run all the specs"
|
9
|
-
task :specs do
|
10
|
-
sh "bundle exec rspec"
|
11
|
-
end
|
12
|
-
|
13
|
-
task :default => [:generate_fixtures, :specs]
|
14
|
-
|
@@ -14,10 +14,14 @@ module Slather
|
|
14
14
|
# TODO: Handle Swift
|
15
15
|
path = nil
|
16
16
|
if project.source_directory
|
17
|
-
path = Dir["#{project.source_directory}/**/#{base_filename}.
|
17
|
+
path = Dir["#{project.source_directory}/**/#{base_filename}.{#{supported_file_extensions.join(",")}}"].first
|
18
18
|
path &&= Pathname(path)
|
19
19
|
else
|
20
|
-
pbx_file = project.files.detect { |pbx_file|
|
20
|
+
pbx_file = project.files.detect { |pbx_file|
|
21
|
+
current_base_filename = pbx_file.real_path.basename
|
22
|
+
ext_name = File.extname(current_base_filename.to_s)[1..-1]
|
23
|
+
current_base_filename.sub_ext("") == base_filename && supported_file_extensions.include?(ext_name)
|
24
|
+
}
|
21
25
|
path = pbx_file && pbx_file.real_path
|
22
26
|
end
|
23
27
|
path
|
@@ -112,7 +116,7 @@ module Slather
|
|
112
116
|
def branch_coverage_data
|
113
117
|
@branch_coverage_data ||= begin
|
114
118
|
branch_coverage_data = Hash.new
|
115
|
-
|
119
|
+
|
116
120
|
gcov_data.scan(/(^(\s+(-|#+|[0-9]+):\s+[1-9]+:(.*)$\r?\n)(^branch\s+[0-9]+\s+[a-zA-Z0-9]+\s+[a-zA-Z0-9]+$\r?\n)+)+/) do |data|
|
117
121
|
lines = data[0].split("\n")
|
118
122
|
line_number = lines[0].split(':')[1].strip.to_i
|
@@ -183,5 +187,9 @@ module Slather
|
|
183
187
|
end
|
184
188
|
end
|
185
189
|
|
190
|
+
def supported_file_extensions
|
191
|
+
["cpp", "mm", "m"]
|
192
|
+
end
|
193
|
+
private :supported_file_extensions
|
186
194
|
end
|
187
195
|
end
|
@@ -27,7 +27,7 @@ module Slather
|
|
27
27
|
:head => {
|
28
28
|
:id => (ENV['CIRCLE_SHA1'] || ""),
|
29
29
|
:author_name => (ENV['CIRCLE_USERNAME'] || ""),
|
30
|
-
:message => (`git log --format=%
|
30
|
+
:message => (`git log --format=%s -n 1 HEAD`.chomp || "")
|
31
31
|
},
|
32
32
|
:branch => (ENV['CIRCLE_BRANCH'] || "")
|
33
33
|
}
|
data/lib/slather/version.rb
CHANGED
data/slather.gemspec
CHANGED
@@ -24,6 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_development_dependency "pry", "~> 0.9"
|
25
25
|
spec.add_development_dependency "cocoapods", "~> 0.36.0"
|
26
26
|
spec.add_development_dependency "json_spec", "~> 1.1.4"
|
27
|
+
spec.add_development_dependency "equivalent-xml", "~> 0.5.1"
|
27
28
|
|
28
29
|
spec.add_dependency "clamp", "~> 0.6"
|
29
30
|
spec.add_dependency "xcodeproj", "~> 0.23.0"
|
data/spec/fixtures/cobertura.xml
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
<?xml version="1.0"?>
|
2
2
|
<!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd">
|
3
|
-
<coverage line-rate="0.6603773584905660" branch-rate="0.1190476190476190" lines-covered="35" lines-valid="53" branches-covered="5" branches-valid="42" complexity="0.0" timestamp="" version="">
|
3
|
+
<coverage line-rate="0.6603773584905660" branch-rate="0.1190476190476190" lines-covered="35" lines-valid="53" branches-covered="5" branches-valid="42" complexity="0.0" timestamp="1428118535" version="Slather 1.6.0">
|
4
4
|
<sources>
|
5
|
-
<source
|
5
|
+
<source>/Users/marklarsen/programming/slather</source>
|
6
6
|
</sources>
|
7
7
|
<packages>
|
8
8
|
<package name="spec.fixtures.fixtures.more_files" line-rate="0.3846153846153846" branch-rate="0.3333333333333333" complexity="0.0">
|
@@ -80,6 +80,18 @@
|
|
80
80
|
<line number="21" branch="false" hits="0"/>
|
81
81
|
</lines>
|
82
82
|
</class>
|
83
|
+
<class name="fixtures_cpp.cpp" filename="spec/fixtures/fixtures/fixtures_cpp.cpp" line-rate="1.0000000000000000" branch-rate="1.0000000000000000" complexity="0.0">
|
84
|
+
<methods/>
|
85
|
+
<lines/>
|
86
|
+
</class>
|
87
|
+
<class name="fixtures_m" filename="spec/fixtures/fixtures/fixtures_m.m" line-rate="1.0000000000000000" branch-rate="1.0000000000000000" complexity="0.0">
|
88
|
+
<methods/>
|
89
|
+
<lines/>
|
90
|
+
</class>
|
91
|
+
<class name="fixtures_mm.mm" filename="spec/fixtures/fixtures/fixtures_mm.mm" line-rate="1.0000000000000000" branch-rate="1.0000000000000000" complexity="0.0">
|
92
|
+
<methods/>
|
93
|
+
<lines/>
|
94
|
+
</class>
|
83
95
|
</classes>
|
84
96
|
</package>
|
85
97
|
<package name="spec.fixtures.fixturesTests" line-rate="1.0000000000000000" branch-rate="0.0333333333333333" complexity="0.0">
|
@@ -12,6 +12,12 @@
|
|
12
12
|
155BBCA819E9CCC500BACB13 /* BranchesTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 155BBCA719E9CCC500BACB13 /* BranchesTests.m */; };
|
13
13
|
155D8AFE19FED984004666BA /* Empty.h in Headers */ = {isa = PBXBuildFile; fileRef = 155D8AFC19FED984004666BA /* Empty.h */; };
|
14
14
|
155D8AFF19FED984004666BA /* Empty.m in Sources */ = {isa = PBXBuildFile; fileRef = 155D8AFD19FED984004666BA /* Empty.m */; };
|
15
|
+
8C0F0B401ACF43A300793B7D /* fixtures_m.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C0F0B3E1ACF43A300793B7D /* fixtures_m.h */; };
|
16
|
+
8C0F0B411ACF43A300793B7D /* fixtures_m.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C0F0B3F1ACF43A300793B7D /* fixtures_m.m */; };
|
17
|
+
8C0F0B441ACF44E000793B7D /* fixtures_cpp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8C0F0B421ACF44E000793B7D /* fixtures_cpp.cpp */; };
|
18
|
+
8C0F0B451ACF44E000793B7D /* fixtures_cpp.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C0F0B431ACF44E000793B7D /* fixtures_cpp.h */; };
|
19
|
+
8C0F0B481ACF44F200793B7D /* fixtures_mm.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C0F0B461ACF44F200793B7D /* fixtures_mm.h */; };
|
20
|
+
8C0F0B491ACF44F200793B7D /* fixtures_mm.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8C0F0B471ACF44F200793B7D /* fixtures_mm.mm */; };
|
15
21
|
8C52AEF7195AAE32008A882A /* peekaview.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C52AEF5195AAE32008A882A /* peekaview.h */; };
|
16
22
|
8C52AEF8195AAE33008A882A /* peekaview.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C52AEF6195AAE32008A882A /* peekaview.m */; };
|
17
23
|
8C52AEFA195AAE70008A882A /* peekaviewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C52AEF9195AAE70008A882A /* peekaviewTests.m */; };
|
@@ -40,6 +46,12 @@
|
|
40
46
|
155BBCA719E9CCC500BACB13 /* BranchesTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BranchesTests.m; sourceTree = "<group>"; };
|
41
47
|
155D8AFC19FED984004666BA /* Empty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Empty.h; sourceTree = "<group>"; };
|
42
48
|
155D8AFD19FED984004666BA /* Empty.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Empty.m; sourceTree = "<group>"; };
|
49
|
+
8C0F0B3E1ACF43A300793B7D /* fixtures_m.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fixtures_m.h; sourceTree = "<group>"; };
|
50
|
+
8C0F0B3F1ACF43A300793B7D /* fixtures_m.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = fixtures_m.m; sourceTree = "<group>"; };
|
51
|
+
8C0F0B421ACF44E000793B7D /* fixtures_cpp.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = fixtures_cpp.cpp; sourceTree = "<group>"; };
|
52
|
+
8C0F0B431ACF44E000793B7D /* fixtures_cpp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fixtures_cpp.h; sourceTree = "<group>"; };
|
53
|
+
8C0F0B461ACF44F200793B7D /* fixtures_mm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fixtures_mm.h; sourceTree = "<group>"; };
|
54
|
+
8C0F0B471ACF44F200793B7D /* fixtures_mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = fixtures_mm.mm; sourceTree = "<group>"; };
|
43
55
|
8C52AEF5195AAE32008A882A /* peekaview.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = peekaview.h; sourceTree = "<group>"; };
|
44
56
|
8C52AEF6195AAE32008A882A /* peekaview.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = peekaview.m; sourceTree = "<group>"; };
|
45
57
|
8C52AEF9195AAE70008A882A /* peekaviewTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = peekaviewTests.m; sourceTree = "<group>"; };
|
@@ -138,7 +150,13 @@
|
|
138
150
|
8C52AEF4195AAE16008A882A /* more_files */,
|
139
151
|
8C9A2039195965F10013B6B3 /* fixtures.h */,
|
140
152
|
8C9A203A195965F10013B6B3 /* fixtures.m */,
|
153
|
+
8C0F0B3E1ACF43A300793B7D /* fixtures_m.h */,
|
154
|
+
8C0F0B3F1ACF43A300793B7D /* fixtures_m.m */,
|
141
155
|
8C9A2037195965F10013B6B3 /* Supporting Files */,
|
156
|
+
8C0F0B421ACF44E000793B7D /* fixtures_cpp.cpp */,
|
157
|
+
8C0F0B431ACF44E000793B7D /* fixtures_cpp.h */,
|
158
|
+
8C0F0B461ACF44F200793B7D /* fixtures_mm.h */,
|
159
|
+
8C0F0B471ACF44F200793B7D /* fixtures_mm.mm */,
|
142
160
|
);
|
143
161
|
path = fixtures;
|
144
162
|
sourceTree = "<group>";
|
@@ -178,8 +196,11 @@
|
|
178
196
|
isa = PBXHeadersBuildPhase;
|
179
197
|
buildActionMask = 2147483647;
|
180
198
|
files = (
|
199
|
+
8C0F0B481ACF44F200793B7D /* fixtures_mm.h in Headers */,
|
200
|
+
8C0F0B401ACF43A300793B7D /* fixtures_m.h in Headers */,
|
181
201
|
155D8AFE19FED984004666BA /* Empty.h in Headers */,
|
182
202
|
155BBCA519E9CB6700BACB13 /* Branches.h in Headers */,
|
203
|
+
8C0F0B451ACF44E000793B7D /* fixtures_cpp.h in Headers */,
|
183
204
|
8C52AEF7195AAE32008A882A /* peekaview.h in Headers */,
|
184
205
|
);
|
185
206
|
runOnlyForDeploymentPostprocessing = 0;
|
@@ -267,7 +288,10 @@
|
|
267
288
|
files = (
|
268
289
|
8C9A203B195965F10013B6B3 /* fixtures.m in Sources */,
|
269
290
|
155D8AFF19FED984004666BA /* Empty.m in Sources */,
|
291
|
+
8C0F0B411ACF43A300793B7D /* fixtures_m.m in Sources */,
|
292
|
+
8C0F0B441ACF44E000793B7D /* fixtures_cpp.cpp in Sources */,
|
270
293
|
155BBCA619E9CB6700BACB13 /* Branches.m in Sources */,
|
294
|
+
8C0F0B491ACF44F200793B7D /* fixtures_mm.mm in Sources */,
|
271
295
|
8C52AEF8195AAE33008A882A /* peekaview.m in Sources */,
|
272
296
|
);
|
273
297
|
runOnlyForDeploymentPostprocessing = 0;
|
@@ -18,10 +18,6 @@ describe Slather::CoverageFile do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
describe "#source_file_pathname" do
|
21
|
-
it "should return the path to the coverage files's source implementation file" do
|
22
|
-
expect(coverage_file.source_file_pathname).to eq(fixtures_project["fixtures/fixtures.m"].real_path)
|
23
|
-
end
|
24
|
-
|
25
21
|
it "should look in the source_directory if it has been set on the project" do
|
26
22
|
coverage_file = Slather::CoverageFile.new(fixtures_project, "fixtures.m")
|
27
23
|
fixtures_project.source_directory = Pathname(File.join(File.dirname(__FILE__), '../fixtures/')).realpath.to_s
|
@@ -38,6 +34,14 @@ describe Slather::CoverageFile do
|
|
38
34
|
whoami_file = Slather::CoverageFile.new(fixtures_project, "/some/path/whoami.gcno")
|
39
35
|
expect(whoami_file.source_file_pathname).to be_nil
|
40
36
|
end
|
37
|
+
|
38
|
+
["cpp", "mm", "m"].each do |file_ext|
|
39
|
+
it "should work for #{file_ext} files" do
|
40
|
+
file_name = "fixtures_#{file_ext}.#{file_ext}"
|
41
|
+
coverage_file = fixtures_project.send(:coverage_files).detect { |cf| cf.source_file_pathname.basename.to_s == file_name }
|
42
|
+
expect(coverage_file.source_file_pathname).to eq(fixtures_project["fixtures/#{file_name}"].real_path)
|
43
|
+
end
|
44
|
+
end
|
41
45
|
end
|
42
46
|
|
43
47
|
describe "#source_file" do
|
@@ -78,7 +82,7 @@ OBJC
|
|
78
82
|
expect(coverage_file.source_data).to eq(expected)
|
79
83
|
end
|
80
84
|
end
|
81
|
-
|
85
|
+
|
82
86
|
describe "source_file_basename" do
|
83
87
|
it "returns the base name of the source file" do
|
84
88
|
expect(coverage_file.source_file_basename).to eq("fixtures")
|
@@ -143,7 +147,7 @@ OBJC
|
|
143
147
|
it "should return the correct percentage of lines that are tested" do
|
144
148
|
expect(line_coverage_file.percentage_lines_tested).to eq(50)
|
145
149
|
end
|
146
|
-
|
150
|
+
|
147
151
|
it "should return 100 if no testable lines" do
|
148
152
|
line_coverage_file.stub(:num_lines_testable).and_return(0)
|
149
153
|
expect(line_coverage_file.percentage_lines_tested).to eq(100)
|
@@ -215,7 +219,7 @@ OBJC
|
|
215
219
|
expect(data[3]).to eq(0)
|
216
220
|
end
|
217
221
|
end
|
218
|
-
|
222
|
+
|
219
223
|
describe "num_branch_hits_for_statement_on_line" do
|
220
224
|
it "returns the number of branches executed below the statement at a given line number" do
|
221
225
|
expect(branch_coverage_file.num_branch_hits_for_statement_on_line(15)).to eq(2)
|
@@ -224,7 +228,7 @@ OBJC
|
|
224
228
|
expect(branch_coverage_file.num_branch_hits_for_statement_on_line(29)).to eq(0)
|
225
229
|
end
|
226
230
|
end
|
227
|
-
|
231
|
+
|
228
232
|
describe "rate_branch_coverage_for_statement_on_line" do
|
229
233
|
it "returns the ratio between number of executed and number of total branches at a given line number" do
|
230
234
|
expect(branch_coverage_file.rate_branch_coverage_for_statement_on_line(15)).to eq(1.0)
|
@@ -237,7 +241,7 @@ OBJC
|
|
237
241
|
expect(branch_coverage_file.rate_branch_coverage_for_statement_on_line(1)).to eq(0.0)
|
238
242
|
end
|
239
243
|
end
|
240
|
-
|
244
|
+
|
241
245
|
describe "percentage_branch_coverage_for_statement_on_line" do
|
242
246
|
it "returns the average hit percentage of all branches below the statement at a given line number" do
|
243
247
|
expect(branch_coverage_file.percentage_branch_coverage_for_statement_on_line(15)).to eq(100)
|
@@ -246,7 +250,7 @@ OBJC
|
|
246
250
|
expect(branch_coverage_file.percentage_branch_coverage_for_statement_on_line(29)).to eq(0)
|
247
251
|
end
|
248
252
|
end
|
249
|
-
|
253
|
+
|
250
254
|
describe "num_branches_testable" do
|
251
255
|
it "returns the number of testable branches inside the class" do
|
252
256
|
expect(branch_coverage_file.num_branches_testable).to eq(10)
|
@@ -298,19 +302,19 @@ OBJC
|
|
298
302
|
expect(empty_file.num_branch_hits_for_statement_on_line(1)).to eq(0)
|
299
303
|
end
|
300
304
|
end
|
301
|
-
|
305
|
+
|
302
306
|
describe "rate_branch_coverage_for_statement_on_line" do
|
303
307
|
it "returns 0.0 when no data is available" do
|
304
308
|
expect(empty_file.rate_branch_coverage_for_statement_on_line(1)).to eq(0.0)
|
305
309
|
end
|
306
310
|
end
|
307
|
-
|
311
|
+
|
308
312
|
describe "percentage_branch_coverage_for_statement_on_line" do
|
309
313
|
it "returns 0 when no data is available" do
|
310
314
|
expect(empty_file.percentage_branch_coverage_for_statement_on_line(1)).to eq(0)
|
311
315
|
end
|
312
316
|
end
|
313
|
-
|
317
|
+
|
314
318
|
describe "num_branches_testable" do
|
315
319
|
it "returns 0 when no data is available" do
|
316
320
|
expect(empty_file.num_branches_testable).to eq(0)
|
@@ -17,7 +17,7 @@ describe Slather::CoverageService::CoberturaXmlOutput do
|
|
17
17
|
describe '#post' do
|
18
18
|
it "should create an XML report spanning all coverage files" do
|
19
19
|
fixtures_project.post
|
20
|
-
|
20
|
+
|
21
21
|
file = File.open(FIXTURES_XML_PATH)
|
22
22
|
fixture_xml_doc = Nokogiri::XML(file)
|
23
23
|
file.close
|
@@ -25,20 +25,21 @@ describe Slather::CoverageService::CoberturaXmlOutput do
|
|
25
25
|
file = File.open('cobertura.xml')
|
26
26
|
current_xml_doc = Nokogiri::XML(file)
|
27
27
|
file.close
|
28
|
-
|
29
|
-
current_xml_doc.
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
28
|
+
|
29
|
+
[current_xml_doc, fixture_xml_doc].each do |xml_doc|
|
30
|
+
xml_doc.root['timestamp'] = ''
|
31
|
+
xml_doc.root['version'] = ''
|
32
|
+
source_node = xml_doc.at_css "source"
|
33
|
+
source_node.content = ''
|
34
|
+
end
|
35
|
+
|
36
|
+
EquivalentXml.equivalent?(current_xml_doc, fixture_xml_doc).should be_truthy
|
36
37
|
end
|
37
38
|
|
38
39
|
it "should create an XML report in the given output directory" do
|
39
40
|
fixtures_project.output_directory = "./output"
|
40
41
|
fixtures_project.post
|
41
|
-
|
42
|
+
|
42
43
|
filepath = "#{fixtures_project.output_directory}/cobertura.xml"
|
43
44
|
expect(File.exists?(filepath)).to be_truthy
|
44
45
|
|
@@ -17,6 +17,9 @@ describe Slather::CoverageService::SimpleOutput do
|
|
17
17
|
it "should print out the coverage for each file, and then total coverage" do
|
18
18
|
["spec/fixtures/fixtures/fixtures.m: 2 of 4 lines (50.00%)",
|
19
19
|
"spec/fixtures/fixtures/more_files/peekaview.m: 0 of 6 lines (0.00%)",
|
20
|
+
"spec/fixtures/fixtures/fixtures_cpp.cpp: 0 of 0 lines (100.00%)",
|
21
|
+
"spec/fixtures/fixtures/fixtures_mm.mm: 0 of 0 lines (100.00%)",
|
22
|
+
"spec/fixtures/fixtures/fixtures_m.m: 0 of 0 lines (100.00%)",
|
20
23
|
"spec/fixtures/fixtures/more_files/Branches.m: 10 of 20 lines (50.00%)",
|
21
24
|
"spec/fixtures/fixtures/more_files/Empty.m: 0 of 0 lines (100.00%)",
|
22
25
|
"spec/fixtures/fixturesTests/fixturesTests.m: 7 of 7 lines (100.00%)",
|
data/spec/spec_helper.rb
CHANGED
@@ -4,6 +4,7 @@ Coveralls.wear!
|
|
4
4
|
require 'slather'
|
5
5
|
require 'pry'
|
6
6
|
require 'json_spec'
|
7
|
+
require 'equivalent-xml'
|
7
8
|
|
8
9
|
|
9
10
|
FIXTURES_XML_PATH = File.join(File.dirname(__FILE__), 'fixtures/cobertura.xml')
|
@@ -11,6 +12,10 @@ FIXTURES_JSON_PATH = File.join(File.dirname(__FILE__), 'fixtures/gutter.json')
|
|
11
12
|
FIXTURES_PROJECT_PATH = File.join(File.dirname(__FILE__), 'fixtures/fixtures.xcodeproj')
|
12
13
|
|
13
14
|
RSpec.configure do |config|
|
15
|
+
config.before(:suite) do
|
16
|
+
`xcodebuild -project #{FIXTURES_PROJECT_PATH} -scheme fixtures -configuration Debug test`
|
17
|
+
end
|
18
|
+
|
14
19
|
config.after(:suite) do
|
15
20
|
FileUtils.rm_rf(Dir[File.expand_path('~') + "/Library/Developer/Xcode/DerivedData/fixture*"].first)
|
16
21
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slather
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Larsen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: 1.1.4
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: equivalent-xml
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 0.5.1
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 0.5.1
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: clamp
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -186,6 +200,12 @@ files:
|
|
186
200
|
- spec/fixtures/fixtures/Supporting Files/fixtures-Prefix.pch
|
187
201
|
- spec/fixtures/fixtures/fixtures.h
|
188
202
|
- spec/fixtures/fixtures/fixtures.m
|
203
|
+
- spec/fixtures/fixtures/fixtures_cpp.cpp
|
204
|
+
- spec/fixtures/fixtures/fixtures_cpp.h
|
205
|
+
- spec/fixtures/fixtures/fixtures_m.h
|
206
|
+
- spec/fixtures/fixtures/fixtures_m.m
|
207
|
+
- spec/fixtures/fixtures/fixtures_mm.h
|
208
|
+
- spec/fixtures/fixtures/fixtures_mm.mm
|
189
209
|
- spec/fixtures/fixtures/more_files/Branches.h
|
190
210
|
- spec/fixtures/fixtures/more_files/Branches.m
|
191
211
|
- spec/fixtures/fixtures/more_files/Empty.h
|
@@ -239,6 +259,12 @@ test_files:
|
|
239
259
|
- spec/fixtures/fixtures/Supporting Files/fixtures-Prefix.pch
|
240
260
|
- spec/fixtures/fixtures/fixtures.h
|
241
261
|
- spec/fixtures/fixtures/fixtures.m
|
262
|
+
- spec/fixtures/fixtures/fixtures_cpp.cpp
|
263
|
+
- spec/fixtures/fixtures/fixtures_cpp.h
|
264
|
+
- spec/fixtures/fixtures/fixtures_m.h
|
265
|
+
- spec/fixtures/fixtures/fixtures_m.m
|
266
|
+
- spec/fixtures/fixtures/fixtures_mm.h
|
267
|
+
- spec/fixtures/fixtures/fixtures_mm.mm
|
242
268
|
- spec/fixtures/fixtures/more_files/Branches.h
|
243
269
|
- spec/fixtures/fixtures/more_files/Branches.m
|
244
270
|
- spec/fixtures/fixtures/more_files/Empty.h
|