Skip to content

Commit

Permalink
Update LinuxMain for Quick tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fwcd committed Jan 27, 2021
1 parent 04107af commit 5319a08
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 19 deletions.
21 changes: 17 additions & 4 deletions Tests/LinuxMain.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
import XCTest
import Quick

import SwiftGit2Tests
@testable import SwiftGit2Tests

var tests = [XCTestCaseEntry]()
tests += SwiftGit2Tests.allTests()
XCTMain(tests)
QCKMain([
FixturesSpec.self,
SignatureSpec.self,
CommitSpec.self,
TreeEntrySpec.self,
TreeSpec.self,
BlobSpec.self,
TagSpec.self,
OIDSpec.self,
ReferenceSpec.self,
BranchSpec.self,
TagReferenceSpec.self,
RemoteSpec.self,
RepositorySpec.self
])
20 changes: 5 additions & 15 deletions Tests/SwiftGit2Tests/Fixtures/Fixtures.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,16 @@ final class Fixtures {
func setUp() {
try! FileManager.default.createDirectory(at: directoryURL, withIntermediateDirectories: true, attributes: nil)

#if SWIFT_PACKAGE
//let bundle = Bundle.module // crashes Swift 5.3 beta (5.3-DEVELOPMENT-SNAPSHOT-2020-05-11-a)
let bundleURL = Bundle.allBundles.first(where: { $0.bundlePath.hasSuffix(".xctest") })!.bundleURL
let bundle =
Bundle(url: bundleURL.deletingLastPathComponent().appendingPathComponent("SwiftGit2_SwiftGit2Tests.bundle"))!
#else
#if os(OSX)
let platform = "OSX"
#else
let platform = "iOS"
#endif
let bundleIdentifier = String(format: "org.libgit2.SwiftGit2-%@Tests", arguments: [platform])
let bundle = Bundle(identifier: bundleIdentifier)!
#endif
//let bundle = Bundle.module // crashes Swift 5.3 beta (5.3-DEVELOPMENT-SNAPSHOT-2020-05-11-a)
let bundleURL = Bundle.allBundles.first(where: { $0.bundlePath.hasSuffix(".xctest") })!.bundleURL
let bundle =
Bundle(url: bundleURL.deletingLastPathComponent().appendingPathComponent("SwiftGit2_SwiftGit2Tests.bundle"))!

let zipURLs = bundle.urls(forResourcesWithExtension: "zip", subdirectory: nil)!
assert(!zipURLs.isEmpty, "No zip-files for testing found.")
for url in zipURLs {
// Will throw error but everything will be fine. Does not happen when using SwiftPM.
try? Zip.unzipFile(url, destination: directoryURL, overwrite: true, password: nil)
try? Zip.unzipFile(url as URL, destination: directoryURL, overwrite: true, password: nil)
}
}

Expand Down

0 comments on commit 5319a08

Please sign in to comment.