-
Notifications
You must be signed in to change notification settings - Fork 623
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce number of shell commands to get git info and improve reliability
- Loading branch information
1 parent
64030c3
commit 6a53fcc
Showing
4 changed files
with
145 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -749,34 +749,16 @@ class GeneralTests: RulesTests { | |
]) | ||
} | ||
|
||
func testGitHelpersReturnsInfo() { | ||
let projectDirectory = URL(fileURLWithPath: #file) | ||
.deletingLastPathComponent().deletingLastPathComponent() | ||
let dateFormat = DateFormat.custom("yyyy-MM-dd HH:mm:ss ZZZZZ") | ||
|
||
let info = GitHelpers(cwd: projectDirectory) | ||
.fileInfo(URL(fileURLWithPath: #file), follow: false) | ||
|
||
XCTAssertEqual(info?.createdByName, "Nick Lockwood") | ||
XCTAssertEqual(info?.createdByEmail, "[email protected]") | ||
let formattedDate = info?.createdAt?.format(with: dateFormat, | ||
timeZone: .identifier("UTC")) | ||
XCTAssertEqual(formattedDate, "2021-09-28 14:23:05 Z") | ||
} | ||
|
||
func testGitHelpersReturnsFollowInfo() { | ||
let projectDirectory = URL(fileURLWithPath: #file) | ||
.deletingLastPathComponent().deletingLastPathComponent() | ||
let dateFormat = DateFormat.custom("yyyy-MM-dd HH:mm:ss ZZZZZ") | ||
|
||
let info = GitHelpers(cwd: projectDirectory) | ||
.fileInfo(URL(fileURLWithPath: #file), follow: true) | ||
|
||
XCTAssertEqual(info?.createdByName, "Nick Lockwood") | ||
XCTAssertEqual(info?.createdByEmail, "[email protected]") | ||
let formattedDate = info?.createdAt?.format(with: dateFormat, | ||
timeZone: .identifier("UTC")) | ||
XCTAssertEqual(formattedDate, "2016-08-22 19:41:41 Z") | ||
func testGitHelpersReturnsInfo() { | ||
let info = GitHelpers.fileInfo(URL(fileURLWithPath: #file), follow: false) | ||
XCTAssertNotNil(info?.createdByName) | ||
XCTAssertNotNil(info?.createdByEmail) | ||
XCTAssertNotNil(info?.createdAt) | ||
|
||
let followInfo = GitHelpers.fileInfo(URL(fileURLWithPath: #file), follow: true) | ||
XCTAssertNotNil(followInfo?.createdByName) | ||
XCTAssertNotNil(followInfo?.createdByEmail) | ||
XCTAssertNotNil(followInfo?.createdAt) | ||
} | ||
|
||
func testFileHeaderRuleThrowsIfCreationDateUnavailable() { | ||
|