slather 2.1.0 → 2.2.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +30 -0
- data/README.md +1 -1
- data/lib/slather/command/coverage_command.rb +10 -4
- data/lib/slather/profdata_coverage_file.rb +32 -5
- data/lib/slather/project.rb +133 -45
- data/lib/slather/version.rb +1 -1
- data/spec/fixtures/fixtures.xcodeproj/project.pbxproj +106 -4
- data/spec/fixtures/fixtures.xcodeproj/xcshareddata/xcschemes/fixturesTwo.xcscheme +80 -0
- data/spec/fixtures/fixtures.xcworkspace/xcshareddata/xcschemes/fixturesTestsWorkspace.xcscheme +99 -0
- data/spec/fixtures/fixturesTests/fixturesTests.m +8 -0
- data/spec/fixtures/fixturesTwo/fixturesTwo.h +15 -0
- data/spec/fixtures/fixturesTwo/fixturesTwo.m +21 -0
- data/spec/fixtures/fixtures_html/Branches.m.html +4 -4
- data/spec/fixtures/fixtures_html/BranchesTests.m.html +4 -4
- data/spec/fixtures/fixtures_html/fixtures.m.html +4 -4
- data/spec/fixtures/fixtures_html/fixturesTests.m.html +78 -38
- data/spec/fixtures/fixtures_html/index.html +8 -8
- data/spec/fixtures/fixtures_html/peekaviewTests.m.html +4 -4
- data/spec/fixtures/gutter.json +1 -1
- data/spec/slather/coverage_service/simple_output_spec.rb +9 -6
- data/spec/slather/profdata_coverage_spec.rb +23 -5
- data/spec/slather/project_spec.rb +53 -7
- data/spec/spec_helper.rb +1 -1
- metadata +10 -2
@@ -71,6 +71,7 @@ describe Slather::Project do
|
|
71
71
|
before(:each) do
|
72
72
|
allow(Dir).to receive(:[]).and_call_original
|
73
73
|
allow(Dir).to receive(:[]).with("#{fixtures_project.build_directory}/**/Coverage.profdata").and_return(["/some/path/Coverage.profdata"])
|
74
|
+
allow(fixtures_project).to receive(:binary_file).and_return(["Fixtures"])
|
74
75
|
allow(fixtures_project).to receive(:profdata_llvm_cov_output).and_return("#{FIXTURES_SWIFT_FILE_PATH}:
|
75
76
|
| 0|
|
76
77
|
| 1|import UIKit
|
@@ -109,6 +110,7 @@ describe Slather::Project do
|
|
109
110
|
allow(fixtures_project).to receive(:input_format).and_return("profdata")
|
110
111
|
allow(fixtures_project).to receive(:ignore_list).and_return([])
|
111
112
|
allow(Dir).to receive(:[]).with("#{fixtures_project.build_directory}/**/Coverage.profdata").and_return(["/some/path/Coverage.profdata"])
|
113
|
+
allow(fixtures_project).to receive(:binary_file).and_return(["Fixtures"])
|
112
114
|
allow(fixtures_project).to receive(:unsafe_profdata_llvm_cov_output).and_return("#{FIXTURES_SWIFT_FILE_PATH}:
|
113
115
|
1| 8| func application(application: \255, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
|
114
116
|
1| 9| return true
|
@@ -134,11 +136,20 @@ describe Slather::Project do
|
|
134
136
|
allow(Dir).to receive(:[]).with("#{build_directory}/Build/Intermediates/CodeCoverage/FixtureScheme/**/*.xctest").and_return(["#{build_directory}/Build/Intermediates/CodeCoverage/FixtureScheme/FixtureAppTests.xctest"])
|
135
137
|
end
|
136
138
|
|
139
|
+
it "should use binary_file" do
|
140
|
+
fixtures_project.binary_file = ["/path/to/binary"]
|
141
|
+
fixtures_project.send(:configure_binary_file)
|
142
|
+
binary_file_location = fixtures_project.send(:binary_file)
|
143
|
+
expect(binary_file_location.count).to eq(1)
|
144
|
+
expect(binary_file_location.first).to eq("/path/to/binary")
|
145
|
+
end
|
146
|
+
|
137
147
|
it "should find the product path provided a scheme" do
|
138
148
|
allow(fixtures_project).to receive(:scheme).and_return("fixtures")
|
139
149
|
fixtures_project.send(:configure_binary_file)
|
140
150
|
binary_file_location = fixtures_project.send(:binary_file)
|
141
|
-
expect(binary_file_location).to
|
151
|
+
expect(binary_file_location.count).to eq(1)
|
152
|
+
expect(binary_file_location.first).to end_with("Debug/fixturesTests.xctest/Contents/MacOS/fixturesTests")
|
142
153
|
end
|
143
154
|
|
144
155
|
it "should find the product path provided a workspace and scheme" do
|
@@ -146,14 +157,16 @@ describe Slather::Project do
|
|
146
157
|
allow(fixtures_project).to receive(:scheme).and_return("fixtures")
|
147
158
|
fixtures_project.send(:configure_binary_file)
|
148
159
|
binary_file_location = fixtures_project.send(:binary_file)
|
149
|
-
expect(binary_file_location).to
|
160
|
+
expect(binary_file_location.count).to eq(1)
|
161
|
+
expect(binary_file_location.first).to end_with("Debug/fixturesTests.xctest/Contents/MacOS/fixturesTests")
|
150
162
|
end
|
151
163
|
|
152
164
|
it "should find the product path for a scheme with no buildable products" do
|
153
165
|
allow(fixtures_project).to receive(:scheme).and_return("fixturesTests")
|
154
166
|
fixtures_project.send(:configure_binary_file)
|
155
167
|
binary_file_location = fixtures_project.send(:binary_file)
|
156
|
-
expect(binary_file_location).to
|
168
|
+
expect(binary_file_location.count).to eq(1)
|
169
|
+
expect(binary_file_location.first).to end_with("Debug/fixturesTests.xctest/Contents/MacOS/fixturesTests")
|
157
170
|
end
|
158
171
|
|
159
172
|
let(:fixture_yaml) do
|
@@ -167,7 +180,7 @@ describe Slather::Project do
|
|
167
180
|
allow(Slather::Project).to receive(:yml).and_return(fixture_yaml)
|
168
181
|
fixtures_project.send(:configure_binary_file)
|
169
182
|
binary_file_location = fixtures_project.send(:binary_file)
|
170
|
-
expect(binary_file_location).to eq("/FixtureScheme/From/Yaml/Contents/MacOS/FixturesFromYaml")
|
183
|
+
expect(binary_file_location).to eq(["/FixtureScheme/From/Yaml/Contents/MacOS/FixturesFromYaml"])
|
171
184
|
end
|
172
185
|
|
173
186
|
let(:other_fixture_yaml) do
|
@@ -182,7 +195,8 @@ describe Slather::Project do
|
|
182
195
|
allow(Dir).to receive(:[]).with("#{build_directory}/Build/Intermediates/CodeCoverage/Products/Debug/fixtureTests.xctest").and_return(["fixtureTests.xctest"])
|
183
196
|
fixtures_project.send(:configure_binary_file)
|
184
197
|
binary_file_location = fixtures_project.send(:binary_file)
|
185
|
-
expect(binary_file_location).to
|
198
|
+
expect(binary_file_location.count).to eq(1)
|
199
|
+
expect(binary_file_location.first).to end_with("/fixturesTests.xctest/Contents/MacOS/fixturesTests")
|
186
200
|
end
|
187
201
|
end
|
188
202
|
|
@@ -445,11 +459,12 @@ describe Slather::Project do
|
|
445
459
|
end
|
446
460
|
|
447
461
|
it "should print out environment info when in verbose_mode" do
|
448
|
-
|
449
462
|
project_root = Pathname("./").realpath
|
450
463
|
|
451
464
|
["\nProcessing coverage file: #{project_root}/spec/DerivedData/libfixtures/Build/Intermediates/CodeCoverage/Coverage.profdata",
|
452
|
-
"Against binary
|
465
|
+
"Against binary files:",
|
466
|
+
"\t#{project_root}/spec/DerivedData/libfixtures/Build/Intermediates/CodeCoverage/Products/Debug/fixturesTests.xctest/Contents/MacOS/fixturesTests",
|
467
|
+
"\n"
|
453
468
|
].each do |line|
|
454
469
|
expect(fixtures_project).to receive(:puts).with(line)
|
455
470
|
end
|
@@ -457,4 +472,35 @@ describe Slather::Project do
|
|
457
472
|
fixtures_project.send(:configure)
|
458
473
|
end
|
459
474
|
end
|
475
|
+
|
476
|
+
describe "#source_files" do
|
477
|
+
|
478
|
+
let(:fixtures_project) do
|
479
|
+
proj = Slather::Project.open(FIXTURES_PROJECT_PATH)
|
480
|
+
proj.build_directory = TEMP_DERIVED_DATA_PATH
|
481
|
+
proj.input_format = "profdata"
|
482
|
+
proj.source_files = ["./**/fixtures{,Two}.m"]
|
483
|
+
proj.binary_basename = ["fixturesTests", "libfixturesTwo"]
|
484
|
+
proj.configure
|
485
|
+
proj
|
486
|
+
end
|
487
|
+
|
488
|
+
it "should find relevant source files" do
|
489
|
+
source_files = fixtures_project.find_source_files
|
490
|
+
expect(source_files.count).to eq(2)
|
491
|
+
expect(source_files.first.to_s).to include("fixtures.m")
|
492
|
+
expect(source_files.last.to_s).to include("fixturesTwo.m")
|
493
|
+
end
|
494
|
+
|
495
|
+
it "should print out the coverage for each file, and then total coverage" do
|
496
|
+
["spec/fixtures/fixtures/fixtures.m: 3 of 6 lines (50.00%)",
|
497
|
+
"spec/fixtures/fixturesTwo/fixturesTwo.m: 6 of 6 lines (100.00%)",
|
498
|
+
"Test Coverage: 75.00%"
|
499
|
+
].each do |line|
|
500
|
+
expect(fixtures_project).to receive(:puts).with(line)
|
501
|
+
end
|
502
|
+
fixtures_project.post
|
503
|
+
end
|
504
|
+
end
|
505
|
+
|
460
506
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -48,7 +48,7 @@ RSpec.configure do |config|
|
|
48
48
|
FixtureHelpers.delete_derived_data
|
49
49
|
FixtureHelpers.delete_temp_gcov_files
|
50
50
|
`xcodebuild -project "#{FIXTURES_PROJECT_PATH}" -scheme fixtures -configuration Debug -derivedDataPath #{TEMP_PROJECT_BUILD_PATH} -enableCodeCoverage YES clean test`
|
51
|
-
`xcodebuild -workspace "#{FIXTURES_WORKSPACE_PATH}" -scheme
|
51
|
+
`xcodebuild -workspace "#{FIXTURES_WORKSPACE_PATH}" -scheme fixturesTestsWorkspace -configuration Debug -derivedDataPath #{TEMP_WORKSPACE_BUILD_PATH} -enableCodeCoverage YES clean test`
|
52
52
|
end
|
53
53
|
|
54
54
|
config.after(:suite) do
|
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: 2.
|
4
|
+
version: 2.2.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: 2016-
|
11
|
+
date: 2016-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -234,7 +234,9 @@ files:
|
|
234
234
|
- spec/fixtures/fixtures.xcodeproj/project.xcworkspace/contents.xcworkspacedata
|
235
235
|
- spec/fixtures/fixtures.xcodeproj/xcshareddata/xcschemes/fixtures.xcscheme
|
236
236
|
- spec/fixtures/fixtures.xcodeproj/xcshareddata/xcschemes/fixturesTests.xcscheme
|
237
|
+
- spec/fixtures/fixtures.xcodeproj/xcshareddata/xcschemes/fixturesTwo.xcscheme
|
237
238
|
- spec/fixtures/fixtures.xcworkspace/contents.xcworkspacedata
|
239
|
+
- spec/fixtures/fixtures.xcworkspace/xcshareddata/xcschemes/fixturesTestsWorkspace.xcscheme
|
238
240
|
- spec/fixtures/fixtures/Fixtures.swift
|
239
241
|
- spec/fixtures/fixtures/Supporting Files/fixtures-Prefix.pch
|
240
242
|
- spec/fixtures/fixtures/fixtures.h
|
@@ -257,6 +259,8 @@ files:
|
|
257
259
|
- spec/fixtures/fixturesTests/Supporting Files/fixturesTests-Info.plist
|
258
260
|
- spec/fixtures/fixturesTests/fixturesTests.m
|
259
261
|
- spec/fixtures/fixturesTests/peekaviewTests.m
|
262
|
+
- spec/fixtures/fixturesTwo/fixturesTwo.h
|
263
|
+
- spec/fixtures/fixturesTwo/fixturesTwo.m
|
260
264
|
- spec/fixtures/fixtures_html/Branches.m.html
|
261
265
|
- spec/fixtures/fixtures_html/BranchesTests.m.html
|
262
266
|
- spec/fixtures/fixtures_html/fixtures.m.html
|
@@ -306,7 +310,9 @@ test_files:
|
|
306
310
|
- spec/fixtures/fixtures.xcodeproj/project.xcworkspace/contents.xcworkspacedata
|
307
311
|
- spec/fixtures/fixtures.xcodeproj/xcshareddata/xcschemes/fixtures.xcscheme
|
308
312
|
- spec/fixtures/fixtures.xcodeproj/xcshareddata/xcschemes/fixturesTests.xcscheme
|
313
|
+
- spec/fixtures/fixtures.xcodeproj/xcshareddata/xcschemes/fixturesTwo.xcscheme
|
309
314
|
- spec/fixtures/fixtures.xcworkspace/contents.xcworkspacedata
|
315
|
+
- spec/fixtures/fixtures.xcworkspace/xcshareddata/xcschemes/fixturesTestsWorkspace.xcscheme
|
310
316
|
- spec/fixtures/fixtures/Fixtures.swift
|
311
317
|
- spec/fixtures/fixtures/Supporting Files/fixtures-Prefix.pch
|
312
318
|
- spec/fixtures/fixtures/fixtures.h
|
@@ -329,6 +335,8 @@ test_files:
|
|
329
335
|
- spec/fixtures/fixturesTests/Supporting Files/fixturesTests-Info.plist
|
330
336
|
- spec/fixtures/fixturesTests/fixturesTests.m
|
331
337
|
- spec/fixtures/fixturesTests/peekaviewTests.m
|
338
|
+
- spec/fixtures/fixturesTwo/fixturesTwo.h
|
339
|
+
- spec/fixtures/fixturesTwo/fixturesTwo.m
|
332
340
|
- spec/fixtures/fixtures_html/Branches.m.html
|
333
341
|
- spec/fixtures/fixtures_html/BranchesTests.m.html
|
334
342
|
- spec/fixtures/fixtures_html/fixtures.m.html
|