Skip to content

Commit

Permalink
fixing unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
leogdion committed Sep 25, 2019
1 parent 36ff4be commit 5014a03
Show file tree
Hide file tree
Showing 13 changed files with 110 additions and 86 deletions.
1 change: 1 addition & 0 deletions .swift-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5.1
14 changes: 10 additions & 4 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,24 @@ target 'CairoSVG' do

end


target 'Speculid' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!

# Pods for Speculid
pod 'SwiftVer'

target 'SpeculidTests' do
inherit! :search_paths
# Pods for testing
end


end

target 'SpeculidTests' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!

# Pods for Speculid
pod 'SwiftVer'
end

target 'Speculid-Mac-App' do
Expand Down
6 changes: 3 additions & 3 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ DEPENDENCIES:
- SwiftVer

SPEC REPOS:
https://github.com/cocoapods/specs.git:
https://github.com/CocoaPods/Specs.git:
- SwiftFormat
- SwiftLint
- SwiftVer
Expand All @@ -19,6 +19,6 @@ SPEC CHECKSUMS:
SwiftLint: 5553187048b900c91aa03552807681bb6b027846
SwiftVer: 85fca0c0087660e0b07fe021efdd4b794046e465

PODFILE CHECKSUM: 2ecd26879e8bf7a7ac71ae7dbb51d7fe0d3d478d
PODFILE CHECKSUM: 432b032d04411cede9e0269a79b2d07c89f85f01

COCOAPODS: 1.7.3
COCOAPODS: 1.8.0
63 changes: 44 additions & 19 deletions Speculid.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -4780,6 +4780,7 @@
B3136E7A1F90FD2E0002B7AB /* Sources */,
B3136E7B1F90FD2E0002B7AB /* Frameworks */,
B3136E7C1F90FD2E0002B7AB /* Resources */,
AB8615DAE34FEF509F2B61FF /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -4949,27 +4950,33 @@
TargetAttributes = {
B3136E5F1F90FCCF0002B7AB = {
CreatedOnToolsVersion = 9.0;
LastSwiftMigration = 1110;
ProvisioningStyle = Automatic;
TestTargetID = B37C743D1F8C58F300DF505B;
};
B3136E7D1F90FD2E0002B7AB = {
CreatedOnToolsVersion = 9.0;
LastSwiftMigration = 1110;
ProvisioningStyle = Automatic;
};
B3136E8C1F90FD3D0002B7AB = {
CreatedOnToolsVersion = 9.0;
LastSwiftMigration = 1110;
ProvisioningStyle = Automatic;
};
B3242E96213DBE6C0063037C = {
CreatedOnToolsVersion = 10.0;
LastSwiftMigration = 1110;
ProvisioningStyle = Automatic;
};
B326F24E21811B970072D652 = {
CreatedOnToolsVersion = 10.0;
LastSwiftMigration = 1110;
ProvisioningStyle = Automatic;
};
B37C743D1F8C58F300DF505B = {
CreatedOnToolsVersion = 9.0;
LastSwiftMigration = 1110;
ProvisioningStyle = Automatic;
SystemCapabilities = {
com.apple.HardenedRuntime = {
Expand All @@ -4982,7 +4989,7 @@
};
B37C74521F8C590D00DF505B = {
CreatedOnToolsVersion = 9.0;
LastSwiftMigration = 0900;
LastSwiftMigration = 1110;
ProvisioningStyle = Automatic;
SystemCapabilities = {
com.apple.HardenedRuntime = {
Expand All @@ -4992,7 +4999,7 @@
};
B37C74721F8C5ADA00DF505B = {
CreatedOnToolsVersion = 9.0;
LastSwiftMigration = 0900;
LastSwiftMigration = 1110;
ProvisioningStyle = Automatic;
};
B37C74881F8C5B5C00DF505B = {
Expand Down Expand Up @@ -5199,6 +5206,24 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
AB8615DAE34FEF509F2B61FF /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-SpeculidTests/Pods-SpeculidTests-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/SwiftVer/SwiftVer.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftVer.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-SpeculidTests/Pods-SpeculidTests-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
B3136E9C1F9100CB0002B7AB /* Autorevision */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand All @@ -5225,7 +5250,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/SwiftFormat/CommandLineTool/swiftformat\" \"${SRCROOT}/frameworks\" --disable trailingCommas --indent 2 --allman false --removelines enabled --header strip --insertlines disabled --empty void --ranges spaced --trimwhitespace always --linebreaks lf --commas always --comments indent --ifdef indent --hexliterals uppercase --semicolons inline";
shellScript = "\"${PODS_ROOT}/SwiftFormat/CommandLineTool/swiftformat\" \"${SRCROOT}/frameworks\" --disable trailingCommas --indent 2 --allman false --removelines enabled --header strip --insertlines disabled --empty void --ranges spaced --trimwhitespace always --linebreaks lf --commas always --comments indent --ifdef indent --hexliterals uppercase --semicolons inline\n";
};
B318906C1F91A02000D0EFA0 /* swiftlint */ = {
isa = PBXShellScriptBuildPhase;
Expand Down Expand Up @@ -5601,7 +5626,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.brightdigit.Speculid-Mac-AppUITests";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TEST_TARGET_NAME = "Speculid-Mac-App";
};
name = Debug;
Expand All @@ -5620,7 +5645,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.brightdigit.Speculid-Mac-AppUITests";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TEST_TARGET_NAME = "Speculid-Mac-App";
};
name = Release;
Expand All @@ -5639,7 +5664,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.brightdigit.SpeculidTests;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -5657,7 +5682,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.brightdigit.SpeculidTests;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -5675,7 +5700,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.brightdigit.CairoSVGTests;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -5693,7 +5718,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.brightdigit.CairoSVGTests;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -5707,7 +5732,7 @@
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_NAME = speculid;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -5720,7 +5745,7 @@
INSTALL_PATH = "";
MTL_FAST_MATH = YES;
PRODUCT_NAME = speculid;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down Expand Up @@ -5749,7 +5774,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand Down Expand Up @@ -5777,7 +5802,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down Expand Up @@ -5920,7 +5945,7 @@
PRODUCT_MODULE_NAME = "$(TARGET_NAME:c99extidentifier)";
PRODUCT_NAME = "$(PROJECT_NAME:c99extidentifier)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -5941,7 +5966,7 @@
PRODUCT_MODULE_NAME = "$(TARGET_NAME:c99extidentifier)";
PRODUCT_NAME = "$(PROJECT_NAME:c99extidentifier)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -5963,7 +5988,7 @@
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -5984,7 +6009,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -6007,7 +6032,7 @@
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)Kit";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand All @@ -6031,7 +6056,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.brightdigit.Speculid-Mac-Framework";
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)Kit";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
</CommandLineArgument>
<CommandLineArgument
argument = "--process &quot;${SRCROOT}/examples/Assets/AppIcon.speculid&quot;"
isEnabled = "NO">
isEnabled = "YES">
</CommandLineArgument>
<CommandLineArgument
argument = "ASBfdsadf"
Expand All @@ -138,7 +138,7 @@
</CommandLineArgument>
<CommandLineArgument
argument = "--version"
isEnabled = "YES">
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "--install"
Expand Down
3 changes: 0 additions & 3 deletions Speculid.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

20 changes: 10 additions & 10 deletions frameworks/speculid/Controllers/Application.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ open class Application: NSApplication, ApplicationProtocol {
return try SpeculidDocument(url: url, decoder: jsonDecoder, configuration: configuration)
}

open static var current: ApplicationProtocol! {
public static var current: ApplicationProtocol! {
return NSApplication.shared as? ApplicationProtocol
}

open static let unknownCommandMessagePrefix = "Unknown Command Arguments"
public static let unknownCommandMessagePrefix = "Unknown Command Arguments"

public static func unknownCommandMessage(fromArguments arguments: [String]) -> String {
return "\(unknownCommandMessagePrefix): \(arguments.joined(separator: " "))"
}

open static let helpText: String! = {
public static let helpText: String! = {
guard let url = Application.bundle.url(forResource: "help", withExtension: "txt") else {
return nil
}
Expand Down Expand Up @@ -66,13 +66,13 @@ open class Application: NSApplication, ApplicationProtocol {
open private(set) var configuration: SpeculidConfigurationProtocol!
open private(set) var builder: SpeculidBuilderProtocol!

open let statusItemProvider: StatusItemProviderProtocol
open let remoteObjectInterfaceProvider: RemoteObjectInterfaceProviderProtocol
open let installerObjectInterfaceProvider: InstallerObjectInterfaceProviderProtocol
open let regularExpressionBuilder: RegularExpressionSetBuilderProtocol
open let configurationBuilder: SpeculidConfigurationBuilderProtocol
open let jsonDecoder: JSONDecoder
open let imageSpecificationBuilder: SpeculidImageSpecificationBuilderProtocol
public let statusItemProvider: StatusItemProviderProtocol
public let remoteObjectInterfaceProvider: RemoteObjectInterfaceProviderProtocol
public let installerObjectInterfaceProvider: InstallerObjectInterfaceProviderProtocol
public let regularExpressionBuilder: RegularExpressionSetBuilderProtocol
public let configurationBuilder: SpeculidConfigurationBuilderProtocol
public let jsonDecoder: JSONDecoder
public let imageSpecificationBuilder: SpeculidImageSpecificationBuilderProtocol
open var commandLineRunner: CommandLineRunnerProtocol

public override init() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public struct SpeculidApplicationModeParser: SpeculidApplicationModeParserProtoc
if commandLine.arguments.first == Bundle.main.executablePath {
indicies.append(commandLine.arguments.startIndex)
}
if let index = commandLine.arguments.index(of: "-NSDocumentRevisionsDebugMode") {
if let index = commandLine.arguments.firstIndex(of: "-NSDocumentRevisionsDebugMode") {
indicies.append(index)
indicies.append(index.advanced(by: 1))
}
Expand Down Expand Up @@ -39,10 +39,10 @@ public struct SpeculidApplicationModeParser: SpeculidApplicationModeParserProtoc
}
}
}

@available(swift, obsoleted: 4.2)
extension Array where Element: Equatable {
func firstIndex(of element: Element) -> Index? {
return index(of: element)
}
}
//
// @available(swift, obsoleted: 4.2)
// extension Array where Element: Equatable {
// func firstIndex(of element: Element) -> Index? {
// return firstIndex(of: element)
// }
// }
2 changes: 1 addition & 1 deletion frameworks/speculid/Controllers/VersionMenuItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class VersionMenuItem: NSMenuItem {
public static func buildNumbers(fromResource resource: String?, withExtension extension: String?) -> Set<Int>? {
if let url = Application.bundle.url(forResource: resource, withExtension: `extension`) {
if let text = try? String(contentsOf: url) {
return Set(text.components(separatedBy: CharacterSet.newlines).flatMap { Int($0) })
return Set(text.components(separatedBy: CharacterSet.newlines).compactMap { Int($0) })
}
}
return nil
Expand Down
Loading

0 comments on commit 5014a03

Please sign in to comment.