Browse Source

Add macOS tests

Evgenii Neumerzhitckii 9 years ago
parent
commit
a548d12ed0

+ 120 - 1
KeychainSwift.xcodeproj/project.pbxproj

@@ -18,6 +18,11 @@
 		23E7856A1BDA415000B7564A /* TegKeychainConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7ED6C98F1B1C128100FE8090 /* TegKeychainConstants.swift */; };
 		2B7E7C4D1B81A3EC00D1C3B9 /* KeychainSwiftPrefixedTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B7E7C4C1B81A3EC00D1C3B9 /* KeychainSwiftPrefixedTests.swift */; };
 		7E282DD71CED212500B55133 /* SynchronizableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E282DD61CED212500B55133 /* SynchronizableTests.swift */; };
+		7E3A6B631D3F62C2007C5B1F /* macOS_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E3A6B621D3F62C2007C5B1F /* macOS_Tests.swift */; };
+		7E3A6B681D3F62CC007C5B1F /* KeychainSwift.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7ED6C98D1B1C128100FE8090 /* KeychainSwift.swift */; };
+		7E3A6B691D3F62CC007C5B1F /* KeychainSwiftAccessOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7ED6C98E1B1C128100FE8090 /* KeychainSwiftAccessOptions.swift */; };
+		7E3A6B6A1D3F62CC007C5B1F /* TegKeychainConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7ED6C98F1B1C128100FE8090 /* TegKeychainConstants.swift */; };
+		7E3A6B6D1D3F6431007C5B1F /* ClearTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E3A6B6C1D3F6431007C5B1F /* ClearTests.swift */; };
 		7E87495F1BDB83D00045CF75 /* AccessGroupTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E87495E1BDB83D00045CF75 /* AccessGroupTests.swift */; };
 		7ED6C9721B1C118F00FE8090 /* KeychainSwift.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ED6C9711B1C118F00FE8090 /* KeychainSwift.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		7ED6C9781B1C118F00FE8090 /* KeychainSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7ED6C96C1B1C118F00FE8090 /* KeychainSwift.framework */; };
@@ -74,6 +79,10 @@
 		23E785601BDA410C00B7564A /* KeychainSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = KeychainSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; };
 		2B7E7C4C1B81A3EC00D1C3B9 /* KeychainSwiftPrefixedTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeychainSwiftPrefixedTests.swift; sourceTree = "<group>"; };
 		7E282DD61CED212500B55133 /* SynchronizableTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SynchronizableTests.swift; sourceTree = "<group>"; };
+		7E3A6B601D3F62C2007C5B1F /* macOS Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "macOS Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
+		7E3A6B621D3F62C2007C5B1F /* macOS_Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = macOS_Tests.swift; sourceTree = "<group>"; };
+		7E3A6B641D3F62C2007C5B1F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+		7E3A6B6C1D3F6431007C5B1F /* ClearTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ClearTests.swift; sourceTree = "<group>"; };
 		7E87495E1BDB83D00045CF75 /* AccessGroupTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AccessGroupTests.swift; sourceTree = "<group>"; };
 		7ED6C96C1B1C118F00FE8090 /* KeychainSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = KeychainSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; };
 		7ED6C9701B1C118F00FE8090 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@@ -120,6 +129,13 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
+		7E3A6B5D1D3F62C2007C5B1F /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
 		7ED6C9681B1C118F00FE8090 /* Frameworks */ = {
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
@@ -146,6 +162,15 @@
 /* End PBXFrameworksBuildPhase section */
 
 /* Begin PBXGroup section */
+		7E3A6B611D3F62C2007C5B1F /* macOS Tests */ = {
+			isa = PBXGroup;
+			children = (
+				7E3A6B621D3F62C2007C5B1F /* macOS_Tests.swift */,
+				7E3A6B641D3F62C2007C5B1F /* Info.plist */,
+			);
+			path = "macOS Tests";
+			sourceTree = "<group>";
+		};
 		7ED6C9621B1C118F00FE8090 = {
 			isa = PBXGroup;
 			children = (
@@ -155,6 +180,7 @@
 				7ED6C98A1B1C126D00FE8090 /* graphics */,
 				7ED6C9C81B1C16EE00FE8090 /* Distrib */,
 				7ED6C9C51B1C16BC00FE8090 /* scripts */,
+				7E3A6B611D3F62C2007C5B1F /* macOS Tests */,
 				7ED6C96D1B1C118F00FE8090 /* Products */,
 				7ED6C9881B1C125000FE8090 /* README.md */,
 			);
@@ -169,6 +195,7 @@
 				232B4C7A1BC29950001F2B7A /* KeychainSwift.framework */,
 				232B4C8A1BC29984001F2B7A /* KeychainSwift.framework */,
 				23E785601BDA410C00B7564A /* KeychainSwift.framework */,
+				7E3A6B601D3F62C2007C5B1F /* macOS Tests.xctest */,
 			);
 			name = Products;
 			sourceTree = "<group>";
@@ -197,6 +224,7 @@
 			isa = PBXGroup;
 			children = (
 				7E87495E1BDB83D00045CF75 /* AccessGroupTests.swift */,
+				7E3A6B6C1D3F6431007C5B1F /* ClearTests.swift */,
 				7ED6C9941B1C12A200FE8090 /* KeychainSwiftTests.swift */,
 				2B7E7C4C1B81A3EC00D1C3B9 /* KeychainSwiftPrefixedTests.swift */,
 				7ED6C9931B1C12A200FE8090 /* KeychainSwiftTests-Bridging-Header.h */,
@@ -365,6 +393,23 @@
 			productReference = 23E785601BDA410C00B7564A /* KeychainSwift.framework */;
 			productType = "com.apple.product-type.framework";
 		};
+		7E3A6B5F1D3F62C2007C5B1F /* macOS Tests */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 7E3A6B671D3F62C2007C5B1F /* Build configuration list for PBXNativeTarget "macOS Tests" */;
+			buildPhases = (
+				7E3A6B5C1D3F62C2007C5B1F /* Sources */,
+				7E3A6B5D1D3F62C2007C5B1F /* Frameworks */,
+				7E3A6B5E1D3F62C2007C5B1F /* Resources */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "macOS Tests";
+			productName = "macOS Tests";
+			productReference = 7E3A6B601D3F62C2007C5B1F /* macOS Tests.xctest */;
+			productType = "com.apple.product-type.bundle.ui-testing";
+		};
 		7ED6C96B1B1C118F00FE8090 /* KeychainSwift */ = {
 			isa = PBXNativeTarget;
 			buildConfigurationList = 7ED6C9821B1C118F00FE8090 /* Build configuration list for PBXNativeTarget "KeychainSwift" */;
@@ -426,7 +471,7 @@
 		7ED6C9631B1C118F00FE8090 /* Project object */ = {
 			isa = PBXProject;
 			attributes = {
-				LastSwiftUpdateCheck = 0700;
+				LastSwiftUpdateCheck = 0800;
 				LastUpgradeCheck = 0800;
 				ORGANIZATIONNAME = Marketplacer;
 				TargetAttributes = {
@@ -439,6 +484,12 @@
 					23E7855F1BDA410C00B7564A = {
 						CreatedOnToolsVersion = 7.1;
 					};
+					7E3A6B5F1D3F62C2007C5B1F = {
+						CreatedOnToolsVersion = 8.0;
+						DevelopmentTeam = BS677JRE62;
+						DevelopmentTeamName = "Evgenii Neumerzhitckii";
+						ProvisioningStyle = Automatic;
+					};
 					7ED51A751B7734AF005B39C2 = {
 						CreatedOnToolsVersion = 7.0;
 					};
@@ -448,6 +499,7 @@
 					};
 					7ED6C9761B1C118F00FE8090 = {
 						CreatedOnToolsVersion = 6.4;
+						ProvisioningStyle = Manual;
 					};
 					7ED6C99C1B1C133500FE8090 = {
 						CreatedOnToolsVersion = 6.4;
@@ -475,6 +527,7 @@
 				7ED6C9761B1C118F00FE8090 /* KeychainSwiftTests */,
 				7ED6C99C1B1C133500FE8090 /* Demo */,
 				7ED51A751B7734AF005B39C2 /* ConcatenateSwiftFiles */,
+				7E3A6B5F1D3F62C2007C5B1F /* macOS Tests */,
 			);
 		};
 /* End PBXProject section */
@@ -501,6 +554,13 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
+		7E3A6B5E1D3F62C2007C5B1F /* Resources */ = {
+			isa = PBXResourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
 		7ED6C96A1B1C118F00FE8090 /* Resources */ = {
 			isa = PBXResourcesBuildPhase;
 			buildActionMask = 2147483647;
@@ -558,6 +618,17 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
+		7E3A6B5C1D3F62C2007C5B1F /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				7E3A6B631D3F62C2007C5B1F /* macOS_Tests.swift in Sources */,
+				7E3A6B691D3F62CC007C5B1F /* KeychainSwiftAccessOptions.swift in Sources */,
+				7E3A6B6A1D3F62CC007C5B1F /* TegKeychainConstants.swift in Sources */,
+				7E3A6B681D3F62CC007C5B1F /* KeychainSwift.swift in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
 		7ED6C9671B1C118F00FE8090 /* Sources */ = {
 			isa = PBXSourcesBuildPhase;
 			buildActionMask = 2147483647;
@@ -577,6 +648,7 @@
 				7E282DD71CED212500B55133 /* SynchronizableTests.swift in Sources */,
 				7ED6C9961B1C12B100FE8090 /* KeychainSwift.swift in Sources */,
 				7E87495F1BDB83D00045CF75 /* AccessGroupTests.swift in Sources */,
+				7E3A6B6D1D3F6431007C5B1F /* ClearTests.swift in Sources */,
 				7ED6C9981B1C12B500FE8090 /* TegKeychainConstants.swift in Sources */,
 				7ED6C9951B1C12A200FE8090 /* KeychainSwiftTests.swift in Sources */,
 			);
@@ -760,6 +832,43 @@
 			};
 			name = Release;
 		};
+		7E3A6B651D3F62C2007C5B1F /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				CLANG_ANALYZER_NONNULL = YES;
+				CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
+				CODE_SIGN_IDENTITY = "-";
+				COMBINE_HIDPI_IMAGES = YES;
+				DEBUG_INFORMATION_FORMAT = dwarf;
+				INFOPLIST_FILE = "macOS Tests/Info.plist";
+				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
+				MACOSX_DEPLOYMENT_TARGET = 10.10;
+				PRODUCT_BUNDLE_IDENTIFIER = "com.evgenii.macOS-Tests";
+				PRODUCT_NAME = "$(TARGET_NAME)";
+				SDKROOT = macosx;
+				SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
+				SWIFT_VERSION = 3.0;
+			};
+			name = Debug;
+		};
+		7E3A6B661D3F62C2007C5B1F /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				CLANG_ANALYZER_NONNULL = YES;
+				CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
+				CODE_SIGN_IDENTITY = "-";
+				COMBINE_HIDPI_IMAGES = YES;
+				INFOPLIST_FILE = "macOS Tests/Info.plist";
+				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
+				MACOSX_DEPLOYMENT_TARGET = 10.10;
+				PRODUCT_BUNDLE_IDENTIFIER = "com.evgenii.macOS-Tests";
+				PRODUCT_NAME = "$(TARGET_NAME)";
+				SDKROOT = macosx;
+				SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
+				SWIFT_VERSION = 3.0;
+			};
+			name = Release;
+		};
 		7ED51A761B7734AF005B39C2 /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
@@ -925,6 +1034,7 @@
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SWIFT_OBJC_BRIDGING_HEADER = "KeychainSwiftTests/KeychainSwiftTests-Bridging-Header.h";
 				SWIFT_OPTIMIZATION_LEVEL = "-Onone";
+				SWIFT_VERSION = 3.0;
 			};
 			name = Debug;
 		};
@@ -939,6 +1049,7 @@
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SWIFT_OBJC_BRIDGING_HEADER = "KeychainSwiftTests/KeychainSwiftTests-Bridging-Header.h";
 				SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
+				SWIFT_VERSION = 3.0;
 			};
 			name = Release;
 		};
@@ -1001,6 +1112,14 @@
 			defaultConfigurationIsVisible = 0;
 			defaultConfigurationName = Release;
 		};
+		7E3A6B671D3F62C2007C5B1F /* Build configuration list for PBXNativeTarget "macOS Tests" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				7E3A6B651D3F62C2007C5B1F /* Debug */,
+				7E3A6B661D3F62C2007C5B1F /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+		};
 		7ED51A781B7734AF005B39C2 /* Build configuration list for PBXLegacyTarget "ConcatenateSwiftFiles" */ = {
 			isa = XCConfigurationList;
 			buildConfigurations = (

+ 0 - 24
KeychainSwift.xcodeproj/xcshareddata/xcschemes/Demo.xcscheme

@@ -20,20 +20,6 @@
                ReferencedContainer = "container:KeychainSwift.xcodeproj">
             </BuildableReference>
          </BuildActionEntry>
-         <BuildActionEntry
-            buildForTesting = "YES"
-            buildForRunning = "YES"
-            buildForProfiling = "NO"
-            buildForArchiving = "NO"
-            buildForAnalyzing = "YES">
-            <BuildableReference
-               BuildableIdentifier = "primary"
-               BlueprintIdentifier = "7ED6C9B01B1C133500FE8090"
-               BuildableName = "DemoTests.xctest"
-               BlueprintName = "DemoTests"
-               ReferencedContainer = "container:KeychainSwift.xcodeproj">
-            </BuildableReference>
-         </BuildActionEntry>
       </BuildActionEntries>
    </BuildAction>
    <TestAction
@@ -42,16 +28,6 @@
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
       shouldUseLaunchSchemeArgsEnv = "YES">
       <Testables>
-         <TestableReference
-            skipped = "NO">
-            <BuildableReference
-               BuildableIdentifier = "primary"
-               BlueprintIdentifier = "7ED6C9B01B1C133500FE8090"
-               BuildableName = "DemoTests.xctest"
-               BlueprintName = "DemoTests"
-               ReferencedContainer = "container:KeychainSwift.xcodeproj">
-            </BuildableReference>
-         </TestableReference>
       </Testables>
       <MacroExpansion>
          <BuildableReference

+ 1 - 16
KeychainSwift.xcodeproj/xcshareddata/xcschemes/KeychainSwift.xcscheme

@@ -20,28 +20,13 @@
                ReferencedContainer = "container:KeychainSwift.xcodeproj">
             </BuildableReference>
          </BuildActionEntry>
-         <BuildActionEntry
-            buildForTesting = "NO"
-            buildForRunning = "YES"
-            buildForProfiling = "NO"
-            buildForArchiving = "NO"
-            buildForAnalyzing = "NO">
-            <BuildableReference
-               BuildableIdentifier = "primary"
-               BlueprintIdentifier = "7ED51A751B7734AF005B39C2"
-               BuildableName = "ConcatenateSwiftFiles"
-               BlueprintName = "ConcatenateSwiftFiles"
-               ReferencedContainer = "container:KeychainSwift.xcodeproj">
-            </BuildableReference>
-         </BuildActionEntry>
       </BuildActionEntries>
    </BuildAction>
    <TestAction
       buildConfiguration = "Debug"
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
-      shouldUseLaunchSchemeArgsEnv = "YES"
-      codeCoverageEnabled = "YES">
+      shouldUseLaunchSchemeArgsEnv = "YES">
       <Testables>
          <TestableReference
             skipped = "NO">

+ 0 - 1
KeychainSwiftTests/AccessGroupTests.swift

@@ -1,4 +1,3 @@
-import UIKit
 import XCTest
 
 class AccessGroupTests: XCTestCase {

+ 23 - 0
KeychainSwiftTests/ClearTests.swift

@@ -0,0 +1,23 @@
+import XCTest
+
+class ClearTests: XCTestCase {
+  
+  var obj: KeychainSwift!
+  
+  override func setUp() {
+    super.setUp()
+    
+    obj = KeychainSwift()
+  }
+  
+  func testClear() {
+    obj.set("hello :)", forKey: "key 1")
+    obj.set("hello two", forKey: "key 2")
+    
+    obj.clear()
+    
+    XCTAssert(obj.get("key 1") == nil)
+    XCTAssert(obj.get("key 2") == nil)
+  }
+}
+

+ 0 - 1
KeychainSwiftTests/KeychainSwiftPrefixedTests.swift

@@ -1,4 +1,3 @@
-import UIKit
 import XCTest
 
 class KeychainWithPrefixTests: XCTestCase {

+ 1 - 15
KeychainSwiftTests/KeychainSwiftTests.swift

@@ -1,7 +1,6 @@
-import UIKit
 import XCTest
 
-class keychainTests: XCTestCase {
+class KeychainSwiftTests: XCTestCase {
   
   var obj: KeychainSwift!
   
@@ -104,17 +103,4 @@ class keychainTests: XCTestCase {
     
     XCTAssertEqual("hello two", obj.get("key 2")!)
   }
-
-  // MARK: - Clear
-  // -----------------------
-
-  func testClear() {
-    obj.set("hello :)", forKey: "key 1")
-    obj.set("hello two", forKey: "key 2")
-    
-    obj.clear()
-    
-    XCTAssert(obj.get("key 1") == nil)
-    XCTAssert(obj.get("key 2") == nil)
-  }
 }

+ 0 - 1
KeychainSwiftTests/SynchronizableTests.swift

@@ -1,4 +1,3 @@
-import UIKit
 import XCTest
 
 class SynchronizableTests: XCTestCase {

+ 22 - 0
macOS Tests/Info.plist

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>CFBundleDevelopmentRegion</key>
+	<string>en</string>
+	<key>CFBundleExecutable</key>
+	<string>$(EXECUTABLE_NAME)</string>
+	<key>CFBundleIdentifier</key>
+	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
+	<key>CFBundleInfoDictionaryVersion</key>
+	<string>6.0</string>
+	<key>CFBundleName</key>
+	<string>$(PRODUCT_NAME)</string>
+	<key>CFBundlePackageType</key>
+	<string>BNDL</string>
+	<key>CFBundleShortVersionString</key>
+	<string>1.0</string>
+	<key>CFBundleVersion</key>
+	<string>1</string>
+</dict>
+</plist>

+ 25 - 0
macOS Tests/macOS_Tests.swift

@@ -0,0 +1,25 @@
+//
+//  macOS_Tests.swift
+//  macOS Tests
+//
+//  Created by Evgenii on 20/07/2016.
+//  Copyright © 2016 Marketplacer. All rights reserved.
+//
+
+import XCTest
+
+class macOS_Tests: XCTestCase {
+        
+    override func setUp() {
+        super.setUp()
+    }
+    
+    override func tearDown() {
+        super.tearDown()
+    }
+    
+    func testExample() {
+      XCTAssertTrue(true)
+    }
+    
+}