-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
60 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// | ||
// Bundle+Extensions.swift | ||
// BDKSwiftExampleWallet | ||
// | ||
// Created by Matthew Ramsden on 8/22/23. | ||
// | ||
|
||
import Foundation | ||
|
||
extension Bundle { | ||
var displayName: String { | ||
return Bundle.main.infoDictionary?["CFBundleName"] as? String ?? Bundle.main.bundleIdentifier ?? "Unknown Bundle" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
BDKSwiftExampleWalletTests/BDKSwiftExampleWalletBundle+Extensions.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// | ||
// BDKSwiftExampleWalletBundle+Extensions.swift | ||
// BDKSwiftExampleWalletTests | ||
// | ||
// Created by Matthew Ramsden on 8/22/23. | ||
// | ||
|
||
import XCTest | ||
@testable import BDKSwiftExampleWallet | ||
|
||
final class BDKSwiftExampleWalletBundle_Extensions: XCTestCase { | ||
|
||
func testDisplayName() { | ||
let displayName = Bundle.main.displayName | ||
|
||
// Check that the displayName is not empty | ||
XCTAssertFalse(displayName.isEmpty) | ||
|
||
// Check that the displayName is either the bundle name or the bundle identifier | ||
if let bundleName = Bundle.main.infoDictionary?["CFBundleName"] as? String { | ||
XCTAssertEqual(displayName, bundleName) | ||
} else if let bundleIdentifier = Bundle.main.bundleIdentifier { | ||
XCTAssertEqual(displayName, bundleIdentifier) | ||
} else { | ||
XCTAssertEqual(displayName, "Unknown Bundle") | ||
} | ||
} | ||
|
||
} |