restructure test targets

This commit is contained in:
yonaskolb 2019-10-27 23:15:12 +11:00
parent d0d509c1a5
commit 518d8e578b
18 changed files with 52 additions and 9 deletions

View File

@ -35,21 +35,52 @@ let package = Package(
"JSONUtilities",
"XcodeProj",
"PathKit",
"Core",
]),
.target(name: "ProjectSpec", dependencies: [
"JSONUtilities",
"XcodeProj",
"Yams",
"Core",
]),
.target(name: "Core", dependencies: [
"PathKit",
"Yams",
]),
.target(name: "TestSupport", dependencies: [
"XcodeProj",
"Spectre",
"PathKit",
]),
.testTarget(name: "XcodeGenKitTests", dependencies: [
"XcodeGenKit",
"Spectre",
"PathKit",
"TestSupport",
]),
.testTarget(name: "FixtureTests", dependencies: [
"XcodeGenKit",
"Spectre",
"PathKit",
"TestSupport",
]),
.testTarget(name: "CoreTests", dependencies: [
"Core",
"Spectre",
"PathKit",
"TestSupport",
]),
.testTarget(name: "ProjectSpecTests", dependencies: [
"ProjectSpec",
"Spectre",
"PathKit",
"TestSupport",
]),
.testTarget(name: "PerformanceTests", dependencies: [
"XcodeGenKit",
"Spectre",
"PathKit",
"TestSupport",
]),
]
)

View File

@ -1,5 +1,5 @@
import Foundation
import ProjectSpec
import Core
public class CacheFile {

View File

@ -1,7 +1,6 @@
import Foundation
import JSONUtilities
import PathKit
import ProjectSpec
import XcodeProj
import Yams

View File

@ -1,13 +1,12 @@
import Foundation
import PathKit
import ProjectSpec
import Spectre
import XcodeProj
import XCTest
let fixturePath = Path(#file).parent().parent() + "Fixtures"
public let fixturePath = Path(#file).parent().parent().parent() + "Tests/Fixtures"
func doThrowing<T>(file: String = #file, line: Int = #line, _ closure: () throws -> T) throws -> T {
public func doThrowing<T>(file: String = #file, line: Int = #line, _ closure: () throws -> T) throws -> T {
do {
return try closure()
} catch {
@ -15,7 +14,7 @@ func doThrowing<T>(file: String = #file, line: Int = #line, _ closure: () throws
}
}
func expectError<T: Error>(_ expectedError: T, function: String = #function, file: String = #file, line: Int = #line, _ closure: () throws -> Void) throws where T: CustomStringConvertible {
public func expectError<T: Error>(_ expectedError: T, function: String = #function, file: String = #file, line: Int = #line, _ closure: () throws -> Void) throws where T: CustomStringConvertible {
do {
try closure()
} catch let error as T {

View File

@ -2,6 +2,7 @@ import Foundation
import PathKit
import ProjectSpec
import XcodeProj
import Core
struct SourceFile {
let path: Path

View File

@ -7,6 +7,7 @@
// Adapted from https://gist.github.com/efirestone/ce01ae109e08772647eb061b3bb387c3
import XCTest
@testable import Core
@testable import XcodeGenKit
class GlobTests: XCTestCase {

View File

@ -1,6 +1,8 @@
import Spectre
import PathKit
import XCTest
import Core
import TestSupport
class PathExtensionsTests: XCTestCase {

View File

@ -4,14 +4,19 @@ import Spectre
import XcodeGenKit
import XcodeProj
import XCTest
import TestSupport
class ProjectFixtureTests: XCTestCase {
class FixtureTests: XCTestCase {
func testProjectFixture() {
describe {
$0.it("generates fixtures") {
$0.it("generates Test Project") {
try generateXcodeProject(specPath: fixturePath + "TestProject/project.yml")
}
$0.it("generates Carthage Project") {
try generateXcodeProject(specPath: fixturePath + "CarthageProject/project.yml")
}
$0.it("generates SPM Project") {
try generateXcodeProject(specPath: fixturePath + "SPM/project.yml")
}
}

View File

@ -4,6 +4,7 @@ import Spectre
import XcodeGenKit
import XcodeProj
import XCTest
import TestSupport
class ProjectSpecTests: XCTestCase {

View File

@ -2,10 +2,10 @@ import Foundation
import PathKit
import ProjectSpec
import Spectre
import XcodeGenKit
import XcodeProj
import XCTest
import Yams
import TestSupport
class SpecLoadingTests: XCTestCase {

View File

@ -3,6 +3,7 @@ import Spectre
import XCTest
import PathKit
@testable import XcodeGenKit
import TestSupport
class CarthageDependencyResolverTests: XCTestCase {

View File

@ -5,6 +5,7 @@ import XcodeGenKit
import XcodeProj
import XCTest
import Yams
import TestSupport
extension Project {

View File

@ -5,6 +5,7 @@ import XcodeGenKit
import XcodeProj
import XCTest
import Yams
import TestSupport
private let app = Target(
name: "MyApp",

View File

@ -5,6 +5,7 @@ import XcodeGenKit
import XcodeProj
import XCTest
import Yams
import TestSupport
private let app = Target(
name: "MyApp",