Skip to content

Commit 16b2ffd

Browse files
committed
first steps
1 parent b8713ee commit 16b2ffd

8 files changed

Lines changed: 21 additions & 5 deletions

File tree

CodeCoverageCompare/CodeCoverageCompare.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@
257257
isa = XCBuildConfiguration;
258258
buildSettings = {
259259
CODE_SIGN_STYLE = Automatic;
260-
DEVELOPMENT_TEAM = CY96495443;
260+
DEVELOPMENT_TEAM = N4T6W27592;
261261
PRODUCT_NAME = "$(TARGET_NAME)";
262262
SWIFT_VERSION = 5.0;
263263
};
@@ -267,7 +267,7 @@
267267
isa = XCBuildConfiguration;
268268
buildSettings = {
269269
CODE_SIGN_STYLE = Automatic;
270-
DEVELOPMENT_TEAM = CY96495443;
270+
DEVELOPMENT_TEAM = N4T6W27592;
271271
PRODUCT_NAME = "$(TARGET_NAME)";
272272
SWIFT_VERSION = 5.0;
273273
};

CodeCoverageCompare/CodeCoverageCompare/main.swift

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,17 @@
99
import Foundation
1010
import CodeCoverageFramework
1111

12-
let a = "//Users/michael/Documents/git/CodeCoverageCompare/example/coverageA.xml"
13-
let b = "//Users/michael/Documents/git/CodeCoverageCompare/example/coverageB.xml"
12+
let coverage = "//Users/michael.charland/git/CodeCoverageCompare/example/coverage.json"
1413

15-
CodeCoverage.go(fileA: a, fileB: b)
14+
let url = URL(fileURLWithPath: coverage)
15+
do {
16+
let data = try Data(contentsOf: url)
17+
let jsonResult = try JSONSerialization.jsonObject(with: data, options: .mutableLeaves)
18+
if let jsonResult = jsonResult as? Dictionary<String, AnyObject>, let person = jsonResult["person"] as? [Any] {
19+
// do stuff
20+
}
21+
} catch {
22+
// handle error
23+
}
24+
25+
//CodeCoverage.go(fileA: a, fileB: b)

CodeCoverageFramework/CodeCoverageFramework/CoveredLine.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// Copyright © 2019 charland. All rights reserved.
77
//
88

9+
import CSV
910
import Foundation
1011

1112
struct CoveredLine: Equatable {

CodeCoverageFramework/CodeCoverageFramework/Parser.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ class Parser: NSObject, XMLParserDelegate {
1818
init(withFileName name: String) {
1919
super.init()
2020
let url = URL(fileURLWithPath: name)
21+
if !FileManager.default.fileExists(atPath: name) {
22+
fatalError("File \(name) not found")
23+
}
2124
let xmlParser = XMLParser(contentsOf: url)
2225
xmlParser?.delegate = self
2326
xmlParser?.parse()

example/actionA.xccovreport

123 KB
Binary file not shown.

example/actionB.xccovreport

122 KB
Binary file not shown.

example/coverage.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

example/create_compare.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
xcrun xccov diff --json actionA.xccovreport actionB.xccovreport >> coverage.json

0 commit comments

Comments
 (0)