Skip to content
Permalink
Browse files

🐛 Fix getting url for raw block files on linux

  • Loading branch information...
usatie committed Sep 11, 2019
1 parent 71e912e commit ab5dcec85de48511354aae514d3a7812707f6302
@@ -522,6 +522,7 @@
isa = PBXGroup;
children = (
147494C9201F9A29006D1CF8 /* BitcoinKit */,
291D369C2329472E001B2D2A /* TestResources */,
147494D4201F9A29006D1CF8 /* BitcoinKitTests */,
298FA582212788A8009EFAC4 /* BitcoinKit.playground */,
147494C8201F9A29006D1CF8 /* Products */,
@@ -559,8 +560,6 @@
147494D4201F9A29006D1CF8 /* BitcoinKitTests */ = {
isa = PBXGroup;
children = (
0FFA77FD2138D9CB00B7EC42 /* block1.raw */,
0FFA77FE2138D9CB00B7EC42 /* block413567.raw */,
147494D5201F9A29006D1CF8 /* BitcoinKitTests.swift */,
297C408021100810003AF4EF /* MnemonicTests.swift */,
0F59D2EA21370FD8008B9C0B /* BlockMessageTests.swift */,
@@ -623,6 +622,15 @@
path = "Pseudo Words";
sourceTree = "<group>";
};
291D369C2329472E001B2D2A /* TestResources */ = {
isa = PBXGroup;
children = (
0FFA77FD2138D9CB00B7EC42 /* block1.raw */,
0FFA77FE2138D9CB00B7EC42 /* block413567.raw */,
);
path = TestResources;
sourceTree = "<group>";
};
292AEA3C2112EB190012D7E5 /* Core */ = {
isa = PBXGroup;
children = (
@@ -1394,7 +1402,7 @@
CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Automatic;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 27AEDK3C9F;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
@@ -1433,7 +1441,7 @@
CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Automatic;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 27AEDK3C9F;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
@@ -1468,7 +1476,7 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 27AEDK3C9F;
DEVELOPMENT_TEAM = "";
HEADER_SEARCH_PATHS = "";
INFOPLIST_FILE = Tests/BitcoinKitTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
@@ -1479,6 +1487,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.bitcoinkit.BitcoinKitTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG BitcoinKitXcode";
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
@@ -1488,7 +1497,7 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 27AEDK3C9F;
DEVELOPMENT_TEAM = "";
HEADER_SEARCH_PATHS = "";
INFOPLIST_FILE = Tests/BitcoinKitTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
@@ -1499,6 +1508,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.bitcoinkit.BitcoinKitTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = BitcoinKitXcode;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
@@ -0,0 +1,61 @@
{
"object": {
"pins": [
{
"package": "Bits",
"repositoryURL": "https://github.com/vapor/bits.git",
"state": {
"branch": null,
"revision": "03079476b04139a8b744ad96f975176df5ae12bc",
"version": "1.1.1"
}
},
{
"package": "COpenSSL",
"repositoryURL": "https://github.com/vapor-community/copenssl.git",
"state": {
"branch": null,
"revision": "a347e9ec038b134aecf42e0c21f2deb9035adf3f",
"version": "1.0.0-rc.1"
}
},
{
"package": "Core",
"repositoryURL": "https://github.com/vapor/core.git",
"state": {
"branch": null,
"revision": "aa15871311b497a24a7f0e96b1ae6865dd600818",
"version": "2.2.1"
}
},
{
"package": "Debugging",
"repositoryURL": "https://github.com/vapor/debugging.git",
"state": {
"branch": null,
"revision": "fc5a27d6eb236141dc24e5f14eedaa2e035ae7b3",
"version": "1.1.1"
}
},
{
"package": "Random",
"repositoryURL": "https://github.com/vapor-community/random.git",
"state": {
"branch": null,
"revision": "d7c4397d125caba795d14d956efacfe2a27a63d0",
"version": "1.2.0"
}
},
{
"package": "secp256k1",
"repositoryURL": "https://github.com/Boilertalk/secp256k1.swift",
"state": {
"branch": null,
"revision": "823281fe9def21b384099b72a9a53ca988317b20",
"version": "0.1.4"
}
}
]
},
"version": 1
}
File renamed without changes.
File renamed without changes.
@@ -26,11 +26,20 @@ import XCTest
@testable import BitcoinKit

class BlockMessageTests: XCTestCase {

fileprivate func loadRawBlock(named name: String) throws -> BlockMessage {
let bundle = Bundle(for: type(of: self))
let url = bundle.url(forResource: name, withExtension: "raw")!
let data = try Data(contentsOf: url)
let data: Data
#if BitcoinKitXcode
let url = Bundle(for: type(of: self)).url(forResource: name, withExtension: "raw")!
data = try Data(contentsOf: url)
#else
// find raw files if using Swift Package Manager:
let currentDirectoryURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath)
let fileURL = currentDirectoryURL
.appendingPathComponent("TestResources", isDirectory: true)
.appendingPathComponent(name)
.appendingPathExtension("raw")
data = try Data(contentsOf: fileURL)
#endif

return BlockMessage.deserialize(data)
}

0 comments on commit ab5dcec

Please sign in to comment.
You can’t perform that action at this time.