Skip to content

Commit

Permalink
add Package.swift and other stuff for linux
Browse files Browse the repository at this point in the history
  • Loading branch information
DarthStrom committed Mar 14, 2019
1 parent af1cd08 commit 73b3caa
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Moxie.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@
962BF9131F4E64240095C294 /* Moxie tvOS Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Moxie tvOS Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
962BF9211F5741A50095C294 /* Moxie iOS Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Moxie iOS Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
962BF9301F57A5730095C294 /* Moxie_Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Moxie_Info.plist; path = Moxie.xcodeproj/Moxie_Info.plist; sourceTree = "<group>"; };
9634D6F62239EB9A00092894 /* Package.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Package.swift; sourceTree = "<group>"; };
9634D6F72239EBB600092894 /* LinuxMain.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = LinuxMain.swift; path = Tests/LinuxMain.swift; sourceTree = "<group>"; };
9634D6F82239ECB200092894 /* XCTestManifests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XCTestManifests.swift; sourceTree = "<group>"; };
965F0DF51EE3928E0027E43D /* ExplainTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ExplainTests.swift; path = Tests/MoxieTests/ExplainTests.swift; sourceTree = SOURCE_ROOT; };
965F0DF61EE3928E0027E43D /* MockTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MockTests.swift; path = Tests/MoxieTests/MockTests.swift; sourceTree = SOURCE_ROOT; };
965F0DF71EE3928E0027E43D /* StubbingTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = StubbingTests.swift; path = Tests/MoxieTests/StubbingTests.swift; sourceTree = SOURCE_ROOT; };
Expand Down Expand Up @@ -210,6 +213,7 @@
"___RootGroup_" = {
isa = PBXGroup;
children = (
9634D6F62239EB9A00092894 /* Package.swift */,
962BF9301F57A5730095C294 /* Moxie_Info.plist */,
"_____Configs_" /* Configs */,
"_____Sources_" /* Sources */,
Expand Down Expand Up @@ -267,6 +271,7 @@
965F0DF61EE3928E0027E43D /* MockTests.swift */,
965F0DF71EE3928E0027E43D /* StubbingTests.swift */,
965F0DF81EE3928E0027E43D /* VerificationTests.swift */,
9634D6F82239ECB200092894 /* XCTestManifests.swift */,
);
name = MoxieTests;
path = Tests/MoxieTests;
Expand All @@ -275,6 +280,7 @@
"_______Tests_" /* Tests */ = {
isa = PBXGroup;
children = (
9634D6F72239EBB600092894 /* LinuxMain.swift */,
"_______Group_MoxieTests" /* MoxieTests */,
);
name = Tests;
Expand Down
21 changes: 21 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// swift-tools-version:4.2

import PackageDescription

let package = Package(
name: "Moxie",
products: [
.library(
name: "Moxie",
targets: ["Moxie"]),
],
dependencies: [],
targets: [
.target(
name: "Moxie",
dependencies: []),
.testTarget(
name: "MoxieTests",
dependencies: ["Moxie"]),
]
)
8 changes: 8 additions & 0 deletions Tests/LinuxMain.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import XCTest

import MoxieTests

var tests = [XCTestCaseEntry]()
tests += MoxieTests.__allTests()

XCTMain(tests)
58 changes: 58 additions & 0 deletions Tests/MoxieTests/XCTestManifests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import XCTest

extension ExplainTests {
static let __allTests = [
("testExplainWithAnInvocation", testExplainWithAnInvocation),
("testExplainWithBothStubbingsAndInvocations", testExplainWithBothStubbingsAndInvocations),
("testExplainWithMultipleInvocations", testExplainWithMultipleInvocations),
("testExplainWithMultipleInvocationsWithTheSameParameters", testExplainWithMultipleInvocationsWithTheSameParameters),
("testExplainWithMultipleStubbings", testExplainWithMultipleStubbings),
("testExplainWithNoStubbingsOrInteractions", testExplainWithNoStubbingsOrInteractions),
("testExplainWithOneStubbing", testExplainWithOneStubbing),
]
}

extension MockTests {
static let __allTests = [
("testExplain", testExplain),
("testRecordWithASpecificSetOfParameters", testRecordWithASpecificSetOfParameters),
("testRecordWithNoParameters", testRecordWithNoParameters),
("testStubbingSomething", testStubbingSomething),
("testStubbingWithNoReturnValue", testStubbingWithNoReturnValue),
("testStubbingWithParametersWithAReturnValue", testStubbingWithParametersWithAReturnValue),
("testStubbingWithParametersWithNilReturnValue", testStubbingWithParametersWithNilReturnValue),
("testVerifyReturnsFalseWhenFunctionWasNotCalled", testVerifyReturnsFalseWhenFunctionWasNotCalled),
("testVerifyReturnsTrueWhenCalledWithMatchingParameters", testVerifyReturnsTrueWhenCalledWithMatchingParameters),
("testVerifyReturnsTrueWhenFunctionWasCalled", testVerifyReturnsTrueWhenFunctionWasCalled),
]
}

extension StubbingTests {
static let __allTests = [
("testCanStubAFunction", testCanStubAFunction),
("testLastInWins", testLastInWins),
("testSequentialStubbing", testSequentialStubbing),
]
}

extension VerificationTests {
static let __allTests = [
("testInvocationCountForMultipleCalls", testInvocationCountForMultipleCalls),
("testInvocationCountForOneCall", testInvocationCountForOneCall),
("testInvocationCountForZeroCalls", testInvocationCountForZeroCalls),
("testVerifyIsFalseIfCallCountWasZero", testVerifyIsFalseIfCallCountWasZero),
("testVerifyIsTrueIfCallCountWasMoreThanOne", testVerifyIsTrueIfCallCountWasMoreThanOne),
("testVerifyIsTrueIfCallCountWasOne", testVerifyIsTrueIfCallCountWasOne),
]
}

#if !os(macOS)
public func __allTests() -> [XCTestCaseEntry] {
return [
testCase(ExplainTests.__allTests),
testCase(MockTests.__allTests),
testCase(StubbingTests.__allTests),
testCase(VerificationTests.__allTests),
]
}
#endif

0 comments on commit 73b3caa

Please sign in to comment.