Skip to content

Commit 8d1482a

Browse files
authored
Merge pull request #2 from jonblatho/swift-4.2
Sync up LinuxMain.swift (hopefully)
2 parents a50823d + 44d6d59 commit 8d1482a

File tree

1 file changed

+80
-9
lines changed

1 file changed

+80
-9
lines changed

Tests/LinuxMain.swift

Lines changed: 80 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,51 @@
11
import XCTest
2+
@testable import JWATests
23
@testable import JWTTests
34

5+
extension HMACAlgorithmTests {
6+
static var allTests: [(String, (HMACAlgorithmTests) -> () throws -> Void)] {
7+
return [
8+
("testSHA256Name", testSHA256Name),
9+
("testSHA384Name", testSHA384Name),
10+
("testSHA512Name", testSHA512Name),
11+
("testSHA256Sign", testSHA256Sign),
12+
("testSHA384Sign", testSHA384Sign),
13+
("testSHA512Sign", testSHA512Sign),
14+
("testSHA256Verify", testSHA256Verify),
15+
("testSHA384Verify", testSHA384Verify),
16+
("testSHA512Verify", testSHA512Verify)
17+
]
18+
}
19+
}
420

5-
extension EncodeTests {
6-
static var allTests: [(String, (EncodeTests) -> (Void) throws -> Void)] {
21+
extension NoneAlgorithmTests {
22+
static var allTests: [(String, (NoneAlgorithmTests) -> () throws -> Void)] {
723
return [
8-
("testEncodingJWT", testEncodingJWT),
9-
("testEncodingWithBuilder", testEncodingWithBuilder),
24+
("testName", testName),
25+
("testSign", testSign),
26+
("testVerify", testVerify)
1027
]
1128
}
1229
}
1330

31+
extension CompactJSONDecoderTests {
32+
static var allTests: [(String, (CompactJSONDecoderTests) -> () throws -> Void)] {
33+
return [
34+
("testDecoder", testDecoder)
35+
]
36+
}
37+
}
38+
39+
extension CompactJSONEncoderTests {
40+
static var allTests: [(String, (CompactJSONEncoderTests) -> () throws -> Void)] {
41+
return [
42+
("testEncode", testEncode)
43+
]
44+
}
45+
}
46+
1447
extension DecodeTests {
15-
static var allTests: [(String, (DecodeTests) -> (Void) throws -> Void)] {
48+
static var allTests: [(String, (DecodeTests) -> () throws -> Void)] {
1649
return [
1750
("testDecodingValidJWT", testDecodingValidJWT),
1851
("testFailsToDecodeInvalidStringWithoutThreeSegments", testFailsToDecodeInvalidStringWithoutThreeSegments),
@@ -40,26 +73,64 @@ extension DecodeTests {
4073
("testNoneFailsWithSecretAlgorithm", testNoneFailsWithSecretAlgorithm),
4174
("testMatchesAnyAlgorithm", testMatchesAnyAlgorithm),
4275
("testHS384Algorithm", testHS384Algorithm),
43-
("testHS512Algorithm", testHS512Algorithm),
76+
("testHS512Algorithm", testHS512Algorithm)
4477
]
4578
}
4679
}
4780

81+
extension IntegrationTests {
82+
static var allTests: [(String, (IntegrationTests) -> () throws -> Void)] {
83+
return [
84+
("testVerificationFailureWithoutLeeway", testVerificationFailureWithoutLeeway),
85+
("testVerificationSuccessWithLeeway", testVerificationSuccessWithLeeway)
86+
]
87+
}
88+
}
89+
90+
extension JWTEncodeTests {
91+
static var allTests: [(String, (JWTEncodeTests) -> () throws -> Void)] {
92+
return [
93+
("testEncodingJWT", testEncodingJWT),
94+
("testEncodingWithBuilder", testEncodingWithBuilder),
95+
("testEncodingClaimsWithHeaders", testEncodingClaimsWithHeaders)
96+
]
97+
}
98+
}
99+
48100
extension PayloadTests {
49-
static var allTests: [(String, (PayloadTests) -> (Void) throws -> Void)] {
101+
static var allTests: [(String, (PayloadTests) -> () throws -> Void)] {
50102
return [
51103
("testIssuer", testIssuer),
52104
("testAudience", testAudience),
53105
("testExpiration", testExpiration),
54106
("testNotBefore", testNotBefore),
55107
("testIssuedAt", testIssuedAt),
56-
("testCustomAttributes", testCustomAttributes),
108+
("testCustomAttributes", testCustomAttributes)
57109
]
58110
}
59111
}
60112

113+
extension ValidationTests {
114+
static var allTests: [(String, (ValidationTests) -> () throws -> Void)] {
115+
return [
116+
("testClaimJustExpiredWithoutLeeway", testClaimJustExpiredWithoutLeeway),
117+
("testClaimJustNotExpiredWithoutLeeway", testClaimJustNotExpiredWithoutLeeway),
118+
("testNotBeforeIsImmatureSignatureWithoutLeeway", testNotBeforeIsImmatureSignatureWithoutLeeway),
119+
("testNotBeforeIsValidWithLeeway", testNotBeforeIsValidWithLeeway),
120+
("testIssuedAtIsInFutureWithoutLeeway", testIssuedAtIsInFutureWithoutLeeway),
121+
("testIssuedAtIsValidWithLeeway", testIssuedAtIsValidWithLeeway)
122+
]
123+
}
124+
}
125+
61126
XCTMain([
62-
testCase(EncodeTests.allTests),
127+
testCase(HMACAlgorithmTests.allTests),
128+
testCase(NoneAlgorithmTests.allTests),
129+
testCase(CompactJSONDecoder.allTests),
130+
testCase(CompactJSONEncoder.allTests),
63131
testCase(DecodeTests.allTests),
132+
testCase(IntegrationTests.allTests),
133+
testCase(JWTEncodeTests.allTests),
64134
testCase(PayloadTests.allTests),
135+
testCase(ValidationTests.allTests)
65136
])

0 commit comments

Comments
 (0)