slather 2.4.3 → 2.4.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e4792a1ef157980aebe454c8f2f66ba615afce74
4
- data.tar.gz: 20c3278d981f6b6989d59ea446a5e102f2cc1119
3
+ metadata.gz: f140d82b4571c441455df1b9eb9c247f8f52e310
4
+ data.tar.gz: eeaac677b8b341cb92479c16cbdd2bd6254c85de
5
5
  SHA512:
6
- metadata.gz: 76515b90aa82cad8d98ee37d31b8204e28053a987c1207d60a07e3f843bab9579faef26ef9e2ce4129a171a323a86bc98d376fe23ee21b030fc8c367032b39bb
7
- data.tar.gz: 0bf97e2d021ceb10ac033fe93a45c4eed0b17be60c23e05ba6ee0c554c3260da0d21982104be9a58e34486330c7a72b3860a3a0c1264ee13f0ea349353da2bea
6
+ metadata.gz: ebac089dfe9785ab980a86d6f3020a9c700f01edd1d3dcdb170c82faccc553cb5a4d7143a30c6432af7c606de9902fd42737f12233d136240aeb01e0ce415a21
7
+ data.tar.gz: e3a00efe762b6062a33ef42d30cbdadc4b03444f3f36538bc23b98988659587aace4a6d9fa346ab8a7d5367072fded337dd600efff2e28d5181fd98b366ff10c
@@ -1,5 +1,13 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## v2.4.4
4
+
5
+ * Added llvm-cov output format
6
+ [lampietti](https://github.com/sgtsquiggs) [#354](https://github.com/SlatherOrg/slather/pull/354)
7
+
8
+ * Exclude swiftmodule from product search
9
+ [lampietti](https://github.com/lampietti) [#352](https://github.com/SlatherOrg/slather/pull/352)
10
+
3
11
  ## v2.4.3
4
12
 
5
13
  * Initial Xcode 9 support
@@ -11,6 +11,7 @@ require 'slather/coverage_service/gutter_json_output'
11
11
  require 'slather/coverage_service/simple_output'
12
12
  require 'slather/coverage_service/html_output'
13
13
  require 'slather/coverage_service/json_output'
14
+ require 'slather/coverage_service/llvm_cov_output'
14
15
  require 'cfpropertylist'
15
16
 
16
17
  module Slather
@@ -13,6 +13,7 @@ class CoverageCommand < Clamp::Command
13
13
  option ["--simple-output", "-s"], :flag, "Output coverage results to the terminal"
14
14
  option ["--gutter-json", "-g"], :flag, "Output coverage results as Gutter JSON format"
15
15
  option ["--cobertura-xml", "-x"], :flag, "Output coverage results as Cobertura XML format"
16
+ option ["--llvm-cov", "-r"], :flag, "Output coverage as llvm-cov format"
16
17
  option ["--json"], :flag, "Output coverage results as simple JSON"
17
18
  option ["--html"], :flag, "Output coverage results as static html pages"
18
19
  option ["--show"], :flag, "Indicate that the static html pages will open automatically"
@@ -114,6 +115,8 @@ class CoverageCommand < Clamp::Command
114
115
  project.coverage_service = :gutter_json
115
116
  elsif cobertura_xml?
116
117
  project.coverage_service = :cobertura_xml
118
+ elsif llvm_cov?
119
+ project.coverage_service = :llvm_cov
117
120
  elsif html?
118
121
  project.coverage_service = :html
119
122
  project.show_html = show?
@@ -0,0 +1,35 @@
1
+ require 'nokogiri'
2
+ require 'date'
3
+
4
+ module Slather
5
+ module CoverageService
6
+ module LlvmCovOutput
7
+
8
+ def coverage_file_class
9
+ if input_format == "profdata"
10
+ Slather::ProfdataCoverageFile
11
+ else
12
+ raise StandardError, "Only profdata input format supported by llvm-cov show."
13
+ end
14
+ end
15
+ private :coverage_file_class
16
+
17
+ def post
18
+ report = coverage_files.map do |file|
19
+ ["#{file.source_file_pathname.realpath}:", file.source_data, ""]
20
+ end.flatten.join("\n")
21
+
22
+ store_report(report)
23
+ end
24
+
25
+ def store_report(report)
26
+ output_file = 'report.llcov'
27
+ if output_directory
28
+ FileUtils.mkdir_p(output_directory)
29
+ output_file = File.join(output_directory, output_file)
30
+ end
31
+ File.write(output_file, report.to_s)
32
+ end
33
+ end
34
+ end
35
+ end
@@ -352,6 +352,8 @@ module Slather
352
352
  extend(Slather::CoverageService::GutterJsonOutput)
353
353
  when :cobertura_xml
354
354
  extend(Slather::CoverageService::CoberturaXmlOutput)
355
+ when :llvm_cov
356
+ extend(Slather::CoverageService::LlvmCovOutput)
355
357
  when :html
356
358
  extend(Slather::CoverageService::HtmlOutput)
357
359
  when :json
@@ -435,6 +437,7 @@ module Slather
435
437
  File.basename(x, File.extname(x)) <=> File.basename(y, File.extname(y))
436
438
  }.reject { |path|
437
439
  path.end_with? ".dSYM"
440
+ path.end_with? ".swiftmodule"
438
441
  }.first
439
442
 
440
443
  if found_product and File.directory? found_product
@@ -1,3 +1,3 @@
1
1
  module Slather
2
- VERSION = '2.4.3' unless defined?(Slather::VERSION)
2
+ VERSION = '2.4.4' unless defined?(Slather::VERSION)
3
3
  end
@@ -0,0 +1,216 @@
1
+ /Users/mcrenshaw/Projects/slather/spec/fixtures/fixtures/fixtures.m:
2
+ 1| |//
3
+ 2| |// fixtures.m
4
+ 3| |// fixtures
5
+ 4| |//
6
+ 5| |// Created by Mark Larsen on 6/24/14.
7
+ 6| |// Copyright (c) 2014 marklarr 🌟. All rights reserved.
8
+ 7| |//
9
+ 8| |
10
+ 9| |#import "fixtures.h"
11
+ 10| |
12
+ 11| |@implementation fixtures
13
+ 12| |
14
+ 13| |- (void)testedMethod
15
+ 14| 1|{
16
+ 15| 1| NSLog(@"tested");
17
+ 16| 1|}
18
+ 17| |
19
+ 18| |- (void)untestedMethod
20
+ 19| 0|{
21
+ 20| 0| NSLog(@"untested");
22
+ 21| 0|}
23
+ 22| |
24
+ 23| |@end
25
+
26
+ /Users/mcrenshaw/Projects/slather/spec/fixtures/fixtures/more_files/Branches.m:
27
+ 1| |//
28
+ 2| |// Branches.m
29
+ 3| |// fixtures
30
+ 4| |//
31
+ 5| |// Created by Julian Krumow on 11.10.14.
32
+ 6| |// Copyright (c) 2014 marklarr. All rights reserved.
33
+ 7| |//
34
+ 8| |
35
+ 9| |#import "Branches.h"
36
+ 10| |
37
+ 11| |@implementation Branches
38
+ 12| |
39
+ 13| |- (void)branches:(BOOL)goIf skipBranches:(BOOL)skipBranches
40
+ 14| 2|{
41
+ 15| 2| if (goIf) {
42
+ 16| 1| NSLog(@"foo.");
43
+ 17| 1|
44
+ 18| 1| if (!skipBranches) {
45
+ 19| 0| NSLog(@"not skipped.");
46
+ 20| 0| }
47
+ 21| 1| } else {
48
+ 22| 1| NSLog(@"bar.");
49
+ 23| 1| }
50
+ 24| 2|
51
+ 25| 2| int i = 5;
52
+ 26| 2| if (i == 5) {
53
+ 27| 2| return;
54
+ 28| 2| }
55
+ 29| 0| switch (i) {
56
+ 30| 0| case 0:
57
+ 31| 0| NSLog(@"0");
58
+ 32| 0| break;
59
+ 33| 0|
60
+ 34| 0| case 1:
61
+ 35| 0| NSLog(@"1");
62
+ 36| 0| break;
63
+ 37| 0| case 5:
64
+ 38| 0| NSLog(@"5");
65
+ 39| 0| break;
66
+ 40| 0| default:
67
+ 41| 0| break;
68
+ 42| 0| }
69
+ 43| 0|}
70
+ 44| |
71
+ 45| |@end
72
+
73
+ /Users/mcrenshaw/Projects/slather/spec/fixtures/fixturesTests/BranchesTests.m:
74
+ 1| |//
75
+ 2| |// BranchesTests.m
76
+ 3| |// fixtures
77
+ 4| |//
78
+ 5| |// Created by Julian Krumow on 11.10.14.
79
+ 6| |// Copyright (c) 2014 marklarr. All rights reserved.
80
+ 7| |//
81
+ 8| |
82
+ 9| |#import <XCTest/XCTest.h>
83
+ 10| |#import "Branches.h"
84
+ 11| |
85
+ 12| |@interface BranchesTests : XCTestCase
86
+ 13| |
87
+ 14| |@end
88
+ 15| |
89
+ 16| |@implementation BranchesTests
90
+ 17| |
91
+ 18| 2|- (void)setUp {
92
+ 19| 2| [super setUp];
93
+ 20| 2| // Put setup code here. This method is called before the invocation of each test method in the class.
94
+ 21| 2|}
95
+ 22| |
96
+ 23| 2|- (void)tearDown {
97
+ 24| 2| // Put teardown code here. This method is called after the invocation of each test method in the class.
98
+ 25| 2| [super tearDown];
99
+ 26| 2|}
100
+ 27| |
101
+ 28| 1|- (void)testBranchesNoBranches {
102
+ 29| 1| Branches *branches = [[Branches alloc] init];
103
+ 30| 1| [branches branches:NO skipBranches:NO];
104
+ 31| 1|}
105
+ 32| |
106
+ 33| 1|- (void)testBranchesFirstBranchAndSkip {
107
+ 34| 1| Branches *branches = [[Branches alloc] init];
108
+ 35| 1| [branches branches:YES skipBranches:YES];
109
+ 36| 1|}
110
+ 37| |
111
+ 38| |@end
112
+
113
+ /Users/mcrenshaw/Projects/slather/spec/fixtures/fixturesTests/fixturesTests.m:
114
+ 1| |//
115
+ 2| |// fixturesTests.m
116
+ 3| |// fixturesTests
117
+ 4| |//
118
+ 5| |// Created by Mark Larsen on 6/24/14.
119
+ 6| |// Copyright (c) 2014 marklarr. All rights reserved.
120
+ 7| |//
121
+ 8| |
122
+ 9| |#import <XCTest/XCTest.h>
123
+ 10| |#import "fixtures.h"
124
+ 11| |#import "fixturesTwo.h"
125
+ 12| |
126
+ 13| |@interface fixturesTests : XCTestCase
127
+ 14| |
128
+ 15| |@end
129
+ 16| |
130
+ 17| |@implementation fixturesTests
131
+ 18| |
132
+ 19| |- (void)setUp
133
+ 20| 2|{
134
+ 21| 2| [super setUp];
135
+ 22| 2| // Put setup code here. This method is called before the invocation of each test method in the class.
136
+ 23| 2|}
137
+ 24| |
138
+ 25| |- (void)tearDown
139
+ 26| 2|{
140
+ 27| 2| // Put teardown code here. This method is called after the invocation of each test method in the class.
141
+ 28| 2| [super tearDown];
142
+ 29| 2|}
143
+ 30| |
144
+ 31| |- (void)testExample
145
+ 32| 1|{
146
+ 33| 1| fixtures *f = [[fixtures alloc] init];
147
+ 34| 1| [f testedMethod];
148
+ 35| 1|}
149
+ 36| |
150
+ 37| |- (void)testFixturesTwo
151
+ 38| 1|{
152
+ 39| 1| fixturesTwo *f2 = [[fixturesTwo alloc] init];
153
+ 40| 1|
154
+ 41| 1| XCTAssertEqual([f2 doSomething], 11);
155
+ 42| 1|}
156
+ 43| |
157
+ 44| |@end
158
+
159
+ /Users/mcrenshaw/Projects/slather/spec/fixtures/fixturesTests/peekaviewTests💣.m:
160
+ 1| |//
161
+ 2| |// peekaviewTests💣.m
162
+ 3| |// fixtures
163
+ 4| |//
164
+ 5| |// Created by Mark Larsen on 6/25/14.
165
+ 6| |// Copyright (c) 2014 marklarr. All rights reserved.
166
+ 7| |//
167
+ 8| |
168
+ 9| |#import <XCTest/XCTest.h>
169
+ 10| |
170
+ 11| |@interface peekaviewTests : XCTestCase
171
+ 12| |
172
+ 13| |@end
173
+ 14| |
174
+ 15| |@implementation peekaviewTests
175
+ 16| |
176
+ 17| |- (void)setUp
177
+ 18| 1|{
178
+ 19| 1| [super setUp];
179
+ 20| 1| // Put setup code here. This method is called before the invocation of each test method in the class.
180
+ 21| 1|}
181
+ 22| |
182
+ 23| |- (void)tearDown
183
+ 24| 1|{
184
+ 25| 1| // Put teardown code here. This method is called after the invocation of each test method in the class.
185
+ 26| 1| [super tearDown];
186
+ 27| 1|}
187
+ 28| |
188
+ 29| |- (void)testExample
189
+ 30| 1|{
190
+ 31| 1| XCTAssert(YES, @"woot");
191
+ 32| 1|}
192
+ 33| |
193
+ 34| |@end
194
+
195
+ /Users/mcrenshaw/Projects/slather/spec/fixtures/fixturesTwo/fixturesTwo.m:
196
+ 1| |//
197
+ 2| |// fixturesTwo.m
198
+ 3| |// fixturesTwo
199
+ 4| |//
200
+ 5| |// Created by Kent Sutherland on 4/17/16.
201
+ 6| |// Copyright © 2016 marklarr. All rights reserved.
202
+ 7| |//
203
+ 8| |
204
+ 9| |#import "fixturesTwo.h"
205
+ 10| |
206
+ 11| |@implementation fixturesTwo
207
+ 12| |
208
+ 13| |- (NSInteger)doSomething
209
+ 14| 1|{
210
+ 15| 1| NSInteger a = 5;
211
+ 16| 1| NSInteger b = 6;
212
+ 17| 1|
213
+ 18| 1| return a + b;
214
+ 19| 1|}
215
+ 20| |
216
+ 21| |@end
@@ -0,0 +1,46 @@
1
+ require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper')
2
+
3
+ describe Slather::CoverageService::LlvmCovOutput do
4
+
5
+ let(:fixtures_project) do
6
+ proj = Slather::Project.open(FIXTURES_PROJECT_PATH)
7
+ proj.build_directory = TEMP_DERIVED_DATA_PATH
8
+ proj.binary_basename = ["fixturesTests", "libfixturesTwo"]
9
+ proj.input_format = "profdata"
10
+ proj.coverage_service = "llvm_cov"
11
+ proj.configure
12
+ proj
13
+ end
14
+
15
+ describe '#coverage_file_class' do
16
+ it "should return ProfdataCoverageFile" do
17
+ expect(fixtures_project.send(:coverage_file_class)).to eq(Slather::ProfdataCoverageFile)
18
+ end
19
+ end
20
+
21
+ describe '#post' do
22
+ it "should create an llvm-cov report spanning all coverage files" do
23
+ fixtures_project.post
24
+
25
+ output_llcov = File.read('report.llcov')
26
+ fixture_llcov = File.read(FIXTURES_LLCOV_PATH)
27
+
28
+ output_llcov, fixture_llcov = [output_llcov, fixture_llcov].map do |llcov_doc|
29
+ llcov_doc.gsub(/^\/.+:$/, '')
30
+ end
31
+
32
+ expect(output_llcov).to eq(fixture_llcov)
33
+ FileUtils.rm('report.llcov')
34
+ end
35
+
36
+ it "should create an llvm-cov report in the given output directory" do
37
+ fixtures_project.output_directory = "./output"
38
+ fixtures_project.post
39
+
40
+ filepath = "#{fixtures_project.output_directory}/report.llcov"
41
+ expect(File.exists?(filepath)).to be_truthy
42
+
43
+ FileUtils.rm_rf(fixtures_project.output_directory)
44
+ end
45
+ end
46
+ end
@@ -14,6 +14,7 @@ require 'equivalent-xml'
14
14
 
15
15
  FIXTURES_XML_PATH = File.join(File.dirname(__FILE__), 'fixtures/cobertura.xml')
16
16
  FIXTURES_JSON_PATH = File.join(File.dirname(__FILE__), 'fixtures/report.json')
17
+ FIXTURES_LLCOV_PATH = File.join(File.dirname(__FILE__), 'fixtures/report.llcov')
17
18
  FIXTURES_GUTTER_JSON_PATH = File.join(File.dirname(__FILE__), 'fixtures/gutter.json')
18
19
  FIXTURES_HTML_FOLDER_PATH = File.join(File.dirname(__FILE__), 'fixtures/fixtures_html')
19
20
  FIXTURES_PROJECT_PATH = File.join(File.dirname(__FILE__), 'fixtures/fixtures.xcodeproj')
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.3
4
+ version: 2.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Larsen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-19 00:00:00.000000000 Z
11
+ date: 2017-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -253,6 +253,7 @@ files:
253
253
  - lib/slather/coverage_service/hardcover.rb
254
254
  - lib/slather/coverage_service/html_output.rb
255
255
  - lib/slather/coverage_service/json_output.rb
256
+ - lib/slather/coverage_service/llvm_cov_output.rb
256
257
  - lib/slather/coverage_service/simple_output.rb
257
258
  - lib/slather/coveralls_coverage.rb
258
259
  - lib/slather/profdata_coverage_file.rb
@@ -302,6 +303,7 @@ files:
302
303
  - "spec/fixtures/fixtures_html/peekaviewTests\U0001F4A3.m.html"
303
304
  - spec/fixtures/gutter.json
304
305
  - spec/fixtures/report.json
306
+ - spec/fixtures/report.llcov
305
307
  - spec/slather/cocoapods_plugin_spec.rb
306
308
  - spec/slather/coverage_file_spec.rb
307
309
  - spec/slather/coverage_service/cobertura_xml_spec.rb
@@ -310,6 +312,7 @@ files:
310
312
  - spec/slather/coverage_service/hardcover_spec.rb
311
313
  - spec/slather/coverage_service/html_output_spec.rb
312
314
  - spec/slather/coverage_service/json_spec.rb
315
+ - spec/slather/coverage_service/llvm_cov_spec.rb
313
316
  - spec/slather/coverage_service/simple_output_spec.rb
314
317
  - spec/slather/fixtures.gcno
315
318
  - spec/slather/profdata_coverage_spec.rb
@@ -383,6 +386,7 @@ test_files:
383
386
  - "spec/fixtures/fixtures_html/peekaviewTests\U0001F4A3.m.html"
384
387
  - spec/fixtures/gutter.json
385
388
  - spec/fixtures/report.json
389
+ - spec/fixtures/report.llcov
386
390
  - spec/slather/cocoapods_plugin_spec.rb
387
391
  - spec/slather/coverage_file_spec.rb
388
392
  - spec/slather/coverage_service/cobertura_xml_spec.rb
@@ -391,6 +395,7 @@ test_files:
391
395
  - spec/slather/coverage_service/hardcover_spec.rb
392
396
  - spec/slather/coverage_service/html_output_spec.rb
393
397
  - spec/slather/coverage_service/json_spec.rb
398
+ - spec/slather/coverage_service/llvm_cov_spec.rb
394
399
  - spec/slather/coverage_service/simple_output_spec.rb
395
400
  - spec/slather/fixtures.gcno
396
401
  - spec/slather/profdata_coverage_spec.rb