Skip to content

Commit 4bf3d6d

Browse files
update unit tests and spm spec with Swift 5.5
1 parent f8fd111 commit 4bf3d6d

File tree

4 files changed

+31
-14
lines changed

4 files changed

+31
-14
lines changed

Package.swift

+28-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,30 @@
1-
// swift-tools-version:4.0
1+
// swift-tools-version:5.5
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
24
import PackageDescription
35

4-
let package = Package(name: "TweetNacl", products: [.library(name: "TweetNacl", targets: ["TweetNacl"])],
5-
targets: [
6-
.target(name: "CTweetNacl"),
7-
.target(name: "TweetNacl", dependencies: ["CTweetNacl"]),
8-
.testTarget(name: "TweetNaclTests", dependencies: ["TweetNacl"]),
9-
],
10-
swiftLanguageVersions: [4])
6+
let package = Package(
7+
name: "TweetNacl",
8+
products: [
9+
.library(
10+
name: "TweetNacl",
11+
targets: ["TweetNacl"]),
12+
],
13+
dependencies: [],
14+
targets: [
15+
.target(name: "CTweetNacl"),
16+
.target(
17+
name: "TweetNacl",
18+
dependencies: ["CTweetNacl"]),
19+
.testTarget(
20+
name: "TweetNaclTests",
21+
dependencies: ["TweetNacl"],
22+
resources: [
23+
.process("SecretboxTestData.json"),
24+
.process("BoxTestData.json"),
25+
.process("ScalarMultiTestData.json"),
26+
.process("SignTestData.json")
27+
]
28+
),
29+
]
30+
)

Tests/TweetNaclTests/NaclBox_Tests.swift

+1-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ class NaclBox_Test: XCTestCase {
4848

4949
let testSuite = XCTestSuite(name: NSStringFromClass(self))
5050

51-
let testBundle = Bundle(for: NaclBox_Test.self)
52-
let fileURL = testBundle.url(forResource: "BoxTestData", withExtension: "json")
51+
let fileURL = Bundle.module.url(forResource: "BoxTestData", withExtension: "json")
5352
let fileData = try! Data(contentsOf: fileURL!)
5453
let json = try! JSONSerialization.jsonObject(with: fileData, options: [])
5554
let arrayOfData = json as! [Array<String>]

Tests/TweetNaclTests/NaclScalarMulti_Tests.swift

+1-2
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ class NaclScalarMulti_Tests: XCTestCase {
7777

7878
let testSuite = XCTestSuite(name: NSStringFromClass(self))
7979

80-
let testBundle = Bundle(for: NaclSecretbox_Tests.self)
81-
let fileURL = testBundle.url(forResource: "ScalarMultiTestData", withExtension: "json")
80+
let fileURL = Bundle.module.url(forResource: "ScalarMultiTestData", withExtension: "json")
8281
let fileData = try! Data(contentsOf: fileURL!)
8382
let json = try! JSONSerialization.jsonObject(with: fileData, options: [])
8483
let arrayOfData = json as! [Array<String>]

Tests/TweetNaclTests/NaclSecretbox_Tests.swift

+1-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ class NaclSecretbox_Tests: XCTestCase {
5151

5252
let testSuite = XCTestSuite(name: NSStringFromClass(self))
5353

54-
let testBundle = Bundle(for: NaclSecretbox_Tests.self)
55-
let fileURL = testBundle.url(forResource: "SecretboxTestData", withExtension: "json")
54+
let fileURL = Bundle.module.url(forResource: "SecretboxTestData", withExtension: "json")
5655
let fileData = try! Data(contentsOf: fileURL!)
5756
let jsonDecoder = JSONDecoder()
5857
let arrayOfData = try! jsonDecoder.decode([[String]].self, from: fileData)

0 commit comments

Comments
 (0)