Skip to content

Commit cff2051

Browse files
committed
Merge branch 'master' into feat/supportVisionOS
2 parents f66b39d + c43cd85 commit cff2051

File tree

9 files changed

+625
-782
lines changed

9 files changed

+625
-782
lines changed

.github/actions/test/action.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,6 @@ runs:
2424
run: xcodebuild -version | tee .xcode-version
2525
shell: bash
2626

27-
- id: restore-carthage-cache
28-
name: Restore Carthage cache
29-
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84
30-
with:
31-
path: Carthage
32-
key: carthage-${{ inputs.platform }}-${{ hashFiles('Cartfile.resolved') }}-${{ hashFiles('.xcode-version') }}-v1
33-
34-
- name: Install dependencies
35-
if: steps.restore-carthage-cache.outputs.cache-hit != 'true'
36-
run: carthage bootstrap --platform ${{ inputs.platform }} --use-xcframeworks --no-use-binaries --cache-builds
37-
shell: bash
38-
3927
- name: Run tests
4028
uses: mxcl/xcodebuild@6e60022a0cbe8c89278be2dd1773a2f68e7c5c87
4129
with:

CONTRIBUTING.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,5 @@
55
66
## Environment setup
77

8-
We use [Carthage](https://github.com/Carthage/Carthage) to manage SimpleKeychain's dependencies.
9-
108
1. Clone this repository and enter its root directory.
11-
2. Run `carthage bootstrap --use-xcframeworks` to fetch and build the dependencies.
12-
3. Open `SimpleKeychain.xcodeproj` in Xcode.
9+
2. Open `SimpleKeychain.xcodeproj` in Xcode.

Cartfile.private

Lines changed: 0 additions & 2 deletions
This file was deleted.

Cartfile.resolved

Lines changed: 0 additions & 2 deletions
This file was deleted.

Package.swift

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
// swift-tools-version:5.7
2-
32
import PackageDescription
43

54
let package = Package(
65
name: "SimpleKeychain",
76
platforms: [.iOS(.v13), .macOS(.v11), .tvOS(.v13), .watchOS(.v7)],
87
products: [.library(name: "SimpleKeychain", targets: ["SimpleKeychain"])],
9-
dependencies: [
10-
.package(url: "https://github.com/Quick/Quick.git", .upToNextMajor(from: "7.0.0")),
11-
.package(url: "https://github.com/Quick/Nimble.git", .upToNextMajor(from: "12.0.0")),
12-
],
138
targets: [
149
.target(
1510
name: "SimpleKeychain",
@@ -20,8 +15,6 @@ let package = Package(
2015
name: "SimpleKeychainTests",
2116
dependencies: [
2217
"SimpleKeychain",
23-
.product(name: "Quick", package: "Quick"),
24-
.product(name: "Nimble", package: "Nimble"),
2518
],
2619
path: "SimpleKeychainTests",
2720
exclude: ["Info.plist"])

SimpleKeychain.xcodeproj/project.pbxproj

Lines changed: 0 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
5C737B34285AB9B100B4BB25 /* SimpleKeychainErrorSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C737B2F285AB57A00B4BB25 /* SimpleKeychainErrorSpec.swift */; };
2121
5C737B35285AB9B100B4BB25 /* SimpleKeychainErrorSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C737B2F285AB57A00B4BB25 /* SimpleKeychainErrorSpec.swift */; };
2222
5C737B36285AB9B100B4BB25 /* SimpleKeychainErrorSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C737B2F285AB57A00B4BB25 /* SimpleKeychainErrorSpec.swift */; };
23-
5C737B4F285ACC9F00B4BB25 /* Nimble.xcframework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5CE9CA1126FD42B0005A75FA /* Nimble.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
24-
5C737B50285ACC9F00B4BB25 /* Quick.xcframework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5CE9CA1026FD42B0005A75FA /* Quick.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
2523
5C840112285AFF7B00689C01 /* Accessibility.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C840111285AFF7B00689C01 /* Accessibility.swift */; };
2624
5C840113285AFF7B00689C01 /* Accessibility.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C840111285AFF7B00689C01 /* Accessibility.swift */; };
2725
5C840114285AFF7B00689C01 /* Accessibility.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C840111285AFF7B00689C01 /* Accessibility.swift */; };
@@ -32,16 +30,6 @@
3230
5CDF405B2852D88C003840E6 /* SimpleKeychain.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CDF40592852D88C003840E6 /* SimpleKeychain.swift */; };
3331
5CDF405C2852D88C003840E6 /* SimpleKeychain.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CDF40592852D88C003840E6 /* SimpleKeychain.swift */; };
3432
5CDF405D2852D88C003840E6 /* SimpleKeychain.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CDF40592852D88C003840E6 /* SimpleKeychain.swift */; };
35-
5CE9CA1226FD42B0005A75FA /* Quick.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5CE9CA1026FD42B0005A75FA /* Quick.xcframework */; };
36-
5CE9CA1326FD42B0005A75FA /* Nimble.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5CE9CA1126FD42B0005A75FA /* Nimble.xcframework */; };
37-
5CE9CA1626FD42F4005A75FA /* Nimble.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5CE9CA1126FD42B0005A75FA /* Nimble.xcframework */; };
38-
5CE9CA1726FD42F4005A75FA /* Quick.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5CE9CA1026FD42B0005A75FA /* Quick.xcframework */; };
39-
5CE9CA1826FD42FA005A75FA /* Nimble.xcframework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5CE9CA1126FD42B0005A75FA /* Nimble.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
40-
5CE9CA1926FD42FA005A75FA /* Quick.xcframework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5CE9CA1026FD42B0005A75FA /* Quick.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
41-
5CE9CA1A26FD430F005A75FA /* Nimble.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5CE9CA1126FD42B0005A75FA /* Nimble.xcframework */; };
42-
5CE9CA1B26FD430F005A75FA /* Quick.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5CE9CA1026FD42B0005A75FA /* Quick.xcframework */; };
43-
5CE9CA1C26FD4316005A75FA /* Nimble.xcframework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5CE9CA1126FD42B0005A75FA /* Nimble.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
44-
5CE9CA1D26FD4316005A75FA /* Quick.xcframework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5CE9CA1026FD42B0005A75FA /* Quick.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
4533
5CE9CA2126FD43F5005A75FA /* SimpleKeychain.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5B108AB81EA637B100ED4DD2 /* SimpleKeychain.framework */; };
4634
5CEB577B285BCE7E00A32A80 /* AccessibilitySpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CEB577A285BCE7E00A32A80 /* AccessibilitySpec.swift */; };
4735
5CEB577C285BCE7E00A32A80 /* AccessibilitySpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CEB577A285BCE7E00A32A80 /* AccessibilitySpec.swift */; };
@@ -122,28 +110,6 @@
122110
/* End PBXContainerItemProxy section */
123111

124112
/* Begin PBXCopyFilesBuildPhase section */
125-
5B062A3A1EA63F6100827E79 /* CopyFiles */ = {
126-
isa = PBXCopyFilesBuildPhase;
127-
buildActionMask = 2147483647;
128-
dstPath = "";
129-
dstSubfolderSpec = 10;
130-
files = (
131-
5CE9CA1C26FD4316005A75FA /* Nimble.xcframework in CopyFiles */,
132-
5CE9CA1D26FD4316005A75FA /* Quick.xcframework in CopyFiles */,
133-
);
134-
runOnlyForDeploymentPostprocessing = 0;
135-
};
136-
5C737B4E285ACC9200B4BB25 /* CopyFiles */ = {
137-
isa = PBXCopyFilesBuildPhase;
138-
buildActionMask = 2147483647;
139-
dstPath = "";
140-
dstSubfolderSpec = 10;
141-
files = (
142-
5C737B4F285ACC9F00B4BB25 /* Nimble.xcframework in CopyFiles */,
143-
5C737B50285ACC9F00B4BB25 /* Quick.xcframework in CopyFiles */,
144-
);
145-
runOnlyForDeploymentPostprocessing = 0;
146-
};
147113
5CAF69A826FE57A90045266B /* Copy Files */ = {
148114
isa = PBXCopyFilesBuildPhase;
149115
buildActionMask = 2147483647;
@@ -155,28 +121,6 @@
155121
name = "Copy Files";
156122
runOnlyForDeploymentPostprocessing = 0;
157123
};
158-
5F4D279C1BCEA6A7003C27B3 /* CopyFiles */ = {
159-
isa = PBXCopyFilesBuildPhase;
160-
buildActionMask = 2147483647;
161-
dstPath = "";
162-
dstSubfolderSpec = 10;
163-
files = (
164-
5CE9CA1826FD42FA005A75FA /* Nimble.xcframework in CopyFiles */,
165-
5CE9CA1926FD42FA005A75FA /* Quick.xcframework in CopyFiles */,
166-
);
167-
runOnlyForDeploymentPostprocessing = 0;
168-
};
169-
C1D1FBAA2C21915F008E9E3F /* CopyFiles */ = {
170-
isa = PBXCopyFilesBuildPhase;
171-
buildActionMask = 2147483647;
172-
dstPath = "";
173-
dstSubfolderSpec = 10;
174-
files = (
175-
C1D1FBAB2C219170008E9E3F /* Nimble.xcframework in CopyFiles */,
176-
C1D1FBAC2C219170008E9E3F /* Quick.xcframework in CopyFiles */,
177-
);
178-
runOnlyForDeploymentPostprocessing = 0;
179-
};
180124
/* End PBXCopyFilesBuildPhase section */
181125

182126
/* Begin PBXFileReference section */
@@ -196,8 +140,6 @@
196140
5C737B2F285AB57A00B4BB25 /* SimpleKeychainErrorSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SimpleKeychainErrorSpec.swift; sourceTree = "<group>"; };
197141
5C840111285AFF7B00689C01 /* Accessibility.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Accessibility.swift; sourceTree = "<group>"; };
198142
5CDF40592852D88C003840E6 /* SimpleKeychain.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SimpleKeychain.swift; sourceTree = "<group>"; };
199-
5CE9CA1026FD42B0005A75FA /* Quick.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = Quick.xcframework; path = Carthage/Build/Quick.xcframework; sourceTree = SOURCE_ROOT; };
200-
5CE9CA1126FD42B0005A75FA /* Nimble.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = Nimble.xcframework; path = Carthage/Build/Nimble.xcframework; sourceTree = SOURCE_ROOT; };
201143
5CEB577A285BCE7E00A32A80 /* AccessibilitySpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccessibilitySpec.swift; sourceTree = "<group>"; };
202144
5F4D27651BCE995C003C27B3 /* SimpleKeychainSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SimpleKeychainSpec.swift; sourceTree = "<group>"; };
203145
5F4D277B1BCE99DF003C27B3 /* SimpleKeychainTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SimpleKeychainTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -225,8 +167,6 @@
225167
isa = PBXFrameworksBuildPhase;
226168
buildActionMask = 2147483647;
227169
files = (
228-
5CE9CA1A26FD430F005A75FA /* Nimble.xcframework in Frameworks */,
229-
5CE9CA1B26FD430F005A75FA /* Quick.xcframework in Frameworks */,
230170
);
231171
runOnlyForDeploymentPostprocessing = 0;
232172
};
@@ -256,19 +196,13 @@
256196
isa = PBXFrameworksBuildPhase;
257197
buildActionMask = 2147483647;
258198
files = (
259-
5CE9CA1326FD42B0005A75FA /* Nimble.xcframework in Frameworks */,
260-
5CE9CA1226FD42B0005A75FA /* Quick.xcframework in Frameworks */,
261-
C1D1FBC12C21C89C008E9E3F /* CwlPreconditionTesting in Frameworks */,
262199
);
263200
runOnlyForDeploymentPostprocessing = 0;
264201
};
265202
5F4D278C1BCEA69E003C27B3 /* Frameworks */ = {
266203
isa = PBXFrameworksBuildPhase;
267204
buildActionMask = 2147483647;
268205
files = (
269-
5CE9CA1626FD42F4005A75FA /* Nimble.xcframework in Frameworks */,
270-
5CE9CA1726FD42F4005A75FA /* Quick.xcframework in Frameworks */,
271-
C1D1FBBF2C21C814008E9E3F /* CwlPreconditionTesting in Frameworks */,
272206
);
273207
runOnlyForDeploymentPostprocessing = 0;
274208
};
@@ -338,8 +272,6 @@
338272
5F51D71D1BCDC4D400613162 /* Frameworks */ = {
339273
isa = PBXGroup;
340274
children = (
341-
5CE9CA1126FD42B0005A75FA /* Nimble.xcframework */,
342-
5CE9CA1026FD42B0005A75FA /* Quick.xcframework */,
343275
);
344276
name = Frameworks;
345277
path = SimpleKeychain;
@@ -494,7 +426,6 @@
494426
5B0D47551EA63C74009FF1BF /* Sources */,
495427
5B0D47561EA63C74009FF1BF /* Frameworks */,
496428
5B0D47571EA63C74009FF1BF /* Resources */,
497-
5B062A3A1EA63F6100827E79 /* CopyFiles */,
498429
);
499430
buildRules = (
500431
);
@@ -569,7 +500,6 @@
569500
5F4D27771BCE99DF003C27B3 /* Sources */,
570501
5F4D27781BCE99DF003C27B3 /* Frameworks */,
571502
5F4D27791BCE99DF003C27B3 /* Resources */,
572-
5C737B4E285ACC9200B4BB25 /* CopyFiles */,
573503
);
574504
buildRules = (
575505
);
@@ -592,7 +522,6 @@
592522
5F4D278B1BCEA69E003C27B3 /* Sources */,
593523
5F4D278C1BCEA69E003C27B3 /* Frameworks */,
594524
5F4D278D1BCEA69E003C27B3 /* Resources */,
595-
5F4D279C1BCEA6A7003C27B3 /* CopyFiles */,
596525
);
597526
buildRules = (
598527
);
@@ -1196,7 +1125,6 @@
11961125
5B0D47621EA63C74009FF1BF /* Debug */ = {
11971126
isa = XCBuildConfiguration;
11981127
buildSettings = {
1199-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
12001128
CLANG_ANALYZER_NONNULL = YES;
12011129
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
12021130
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
@@ -1224,7 +1152,6 @@
12241152
5B0D47631EA63C74009FF1BF /* Release */ = {
12251153
isa = XCBuildConfiguration;
12261154
buildSettings = {
1227-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
12281155
CLANG_ANALYZER_NONNULL = YES;
12291156
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
12301157
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
@@ -1430,7 +1357,6 @@
14301357
5F4D27831BCE99E0003C27B3 /* Debug */ = {
14311358
isa = XCBuildConfiguration;
14321359
buildSettings = {
1433-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
14341360
BUNDLE_LOADER = "$(TEST_HOST)";
14351361
DEBUG_INFORMATION_FORMAT = dwarf;
14361362
INFOPLIST_FILE = SimpleKeychainTests/Info.plist;
@@ -1451,7 +1377,6 @@
14511377
5F4D27841BCE99E0003C27B3 /* Release */ = {
14521378
isa = XCBuildConfiguration;
14531379
buildSettings = {
1454-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
14551380
BUNDLE_LOADER = "$(TEST_HOST)";
14561381
INFOPLIST_FILE = SimpleKeychainTests/Info.plist;
14571382
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
Lines changed: 58 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,63 @@
11
import Security
2-
import Nimble
3-
import Quick
2+
import XCTest
43
import SimpleKeychain
54

6-
class AccessibilitySpec: QuickSpec {
7-
override class func spec() {
8-
describe("raw representable") {
9-
context("from raw value to case") {
10-
it("should map kSecAttrAccessibleWhenUnlocked") {
11-
let sut = Accessibility(rawValue: kSecAttrAccessibleWhenUnlocked)
12-
expect(sut) == Accessibility.whenUnlocked
13-
}
14-
15-
it("should map kSecAttrAccessibleWhenUnlockedThisDeviceOnly") {
16-
let sut = Accessibility(rawValue: kSecAttrAccessibleWhenUnlockedThisDeviceOnly)
17-
expect(sut) == Accessibility.whenUnlockedThisDeviceOnly
18-
}
19-
20-
it("should map kSecAttrAccessibleAfterFirstUnlock") {
21-
let sut = Accessibility(rawValue: kSecAttrAccessibleAfterFirstUnlock)
22-
expect(sut) == Accessibility.afterFirstUnlock
23-
}
24-
25-
it("should map kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly") {
26-
let sut = Accessibility(rawValue: kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly)
27-
expect(sut) == Accessibility.afterFirstUnlockThisDeviceOnly
28-
}
29-
30-
it("should map kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly") {
31-
let sut = Accessibility(rawValue: kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly)
32-
expect(sut) == Accessibility.whenPasscodeSetThisDeviceOnly
33-
}
34-
35-
it("should map unknown values") {
36-
let sut = Accessibility(rawValue: "foo" as CFString)
37-
expect(sut) == Accessibility.afterFirstUnlock
38-
}
39-
}
40-
41-
context("from case to raw value") {
42-
it("should map whenUnlocked") {
43-
let sut = Accessibility.whenUnlocked.rawValue as String
44-
expect(sut) == (kSecAttrAccessibleWhenUnlocked as String)
45-
}
46-
47-
it("should map whenUnlockedThisDeviceOnly") {
48-
let sut = Accessibility.whenUnlockedThisDeviceOnly.rawValue as String
49-
expect(sut) == (kSecAttrAccessibleWhenUnlockedThisDeviceOnly as String)
50-
}
51-
52-
it("should map afterFirstUnlock") {
53-
let sut = Accessibility.afterFirstUnlock.rawValue as String
54-
expect(sut) == (kSecAttrAccessibleAfterFirstUnlock as String)
55-
}
56-
57-
it("should map afterFirstUnlockThisDeviceOnly") {
58-
let sut = Accessibility.afterFirstUnlockThisDeviceOnly.rawValue as String
59-
expect(sut) == (kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly as String)
60-
}
61-
62-
it("should map whenPasscodeSetThisDeviceOnly") {
63-
let sut = Accessibility.whenPasscodeSetThisDeviceOnly.rawValue as String
64-
expect(sut) == (kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly as String)
65-
}
66-
67-
it("should map whenPasscodeSetThisDeviceOnly") {
68-
let sut = Accessibility.whenPasscodeSetThisDeviceOnly.rawValue as String
69-
expect(sut) == (kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly as String)
70-
}
71-
}
72-
}
5+
class AccessibilitySpec: XCTestCase {
6+
7+
// Test from raw value to case
8+
func testKSecAttrAccessibleWhenUnlocked() {
9+
let sut = Accessibility(rawValue: kSecAttrAccessibleWhenUnlocked)
10+
XCTAssertEqual(sut, Accessibility.whenUnlocked)
11+
}
12+
13+
func testKSecAttrAccessibleWhenUnlockedThisDeviceOnly() {
14+
let sut = Accessibility(rawValue: kSecAttrAccessibleWhenUnlockedThisDeviceOnly)
15+
XCTAssertEqual(sut, Accessibility.whenUnlockedThisDeviceOnly)
16+
}
17+
18+
func testKSecAttrAccessibleAfterFirstUnlock() {
19+
let sut = Accessibility(rawValue: kSecAttrAccessibleAfterFirstUnlock)
20+
XCTAssertEqual(sut, Accessibility.afterFirstUnlock)
21+
}
22+
23+
func testKSecAttrAccessibleAfterFirstUnlockThisDeviceOnly() {
24+
let sut = Accessibility(rawValue: kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly)
25+
XCTAssertEqual(sut, Accessibility.afterFirstUnlockThisDeviceOnly)
26+
}
27+
28+
func testKSecAttrAccessibleWhenPasscodeSetThisDeviceOnly() {
29+
let sut = Accessibility(rawValue: kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly)
30+
XCTAssertEqual(sut, Accessibility.whenPasscodeSetThisDeviceOnly)
31+
}
32+
33+
func testUnknownValues() {
34+
let sut = Accessibility(rawValue: "foo" as CFString)
35+
XCTAssertEqual(sut, Accessibility.afterFirstUnlock)
36+
}
37+
38+
// Test from case to raw value
39+
func testWhenUnlocked() {
40+
let sut = Accessibility.whenUnlocked.rawValue as String
41+
XCTAssertEqual(sut, kSecAttrAccessibleWhenUnlocked as String)
42+
}
43+
44+
func testWhenUnlockedThisDeviceOnly() {
45+
let sut = Accessibility.whenUnlockedThisDeviceOnly.rawValue as String
46+
XCTAssertEqual(sut, kSecAttrAccessibleWhenUnlockedThisDeviceOnly as String)
47+
}
48+
49+
func testAfterFirstUnlock() {
50+
let sut = Accessibility.afterFirstUnlock.rawValue as String
51+
XCTAssertEqual(sut, kSecAttrAccessibleAfterFirstUnlock as String)
52+
}
53+
54+
func testAfterFirstUnlockThisDeviceOnly() {
55+
let sut = Accessibility.afterFirstUnlockThisDeviceOnly.rawValue as String
56+
XCTAssertEqual(sut, kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly as String)
57+
}
58+
59+
func testWhenPasscodeSetThisDeviceOnly() {
60+
let sut = Accessibility.whenPasscodeSetThisDeviceOnly.rawValue as String
61+
XCTAssertEqual(sut, kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly as String)
7362
}
7463
}

0 commit comments

Comments
 (0)