mirror of
https://github.com/Toxblh/MTMR.git
synced 2026-01-11 17:38:38 +00:00
replace garbage in the app with garbage in the tests (until apple fix that), enable coverage
This commit is contained in:
parent
85aa2c4f2b
commit
a3c7fa7464
@ -11,7 +11,8 @@
|
|||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
language = ""
|
language = ""
|
||||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||||
|
codeCoverageEnabled = "YES">
|
||||||
<Testables>
|
<Testables>
|
||||||
<TestableReference
|
<TestableReference
|
||||||
skipped = "NO">
|
skipped = "NO">
|
||||||
|
|||||||
@ -332,59 +332,6 @@ enum LongActionType: Decodable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension ItemType: Equatable {}
|
|
||||||
func ==(lhs: ItemType, rhs: ItemType) -> Bool {
|
|
||||||
switch (lhs, rhs) {
|
|
||||||
case let (.staticButton(a), .staticButton(b)):
|
|
||||||
return a == b
|
|
||||||
case let (.appleScriptTitledButton(a, b), .appleScriptTitledButton(c, d)):
|
|
||||||
return a == c && b == d
|
|
||||||
|
|
||||||
default:
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extension ActionType: Equatable {}
|
|
||||||
func ==(lhs: ActionType, rhs: ActionType) -> Bool {
|
|
||||||
switch (lhs, rhs) {
|
|
||||||
case (.none, .none):
|
|
||||||
return true
|
|
||||||
case let (.hidKey(a), .hidKey(b)):
|
|
||||||
return a == b
|
|
||||||
case let (.keyPress(a), .keyPress(b)):
|
|
||||||
return a == b
|
|
||||||
case let (.appleSctipt(a), .appleSctipt(b)):
|
|
||||||
return a == b
|
|
||||||
case let (.shellScript(a, b), .shellScript(c, d)):
|
|
||||||
return a == c && b == d
|
|
||||||
case let (.openUrl(a), .openUrl(b)):
|
|
||||||
return a == b
|
|
||||||
default:
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
extension LongActionType: Equatable {}
|
|
||||||
func ==(lhs: LongActionType, rhs: LongActionType) -> Bool {
|
|
||||||
switch (lhs, rhs) {
|
|
||||||
case (.none, .none):
|
|
||||||
return true
|
|
||||||
case let (.hidKey(a), .hidKey(b)):
|
|
||||||
return a == b
|
|
||||||
case let (.keyPress(a), .keyPress(b)):
|
|
||||||
return a == b
|
|
||||||
case let (.appleSctipt(a), .appleSctipt(b)):
|
|
||||||
return a == b
|
|
||||||
case let (.shellScript(a, b), .shellScript(c, d)):
|
|
||||||
return a == c && b == d
|
|
||||||
case let (.openUrl(a), .openUrl(b)):
|
|
||||||
return a == b
|
|
||||||
default:
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
enum GeneralParameter {
|
enum GeneralParameter {
|
||||||
case width(_: CGFloat)
|
case width(_: CGFloat)
|
||||||
@ -470,10 +417,6 @@ extension NSImage: SourceProtocol {
|
|||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
extension SourceProtocol where Self: Equatable {}
|
|
||||||
func ==(left: SourceProtocol, right: SourceProtocol) -> Bool {
|
|
||||||
return left.data == right.data
|
|
||||||
}
|
|
||||||
|
|
||||||
extension String {
|
extension String {
|
||||||
var base64Data: Data? {
|
var base64Data: Data? {
|
||||||
|
|||||||
@ -7,8 +7,14 @@ class ParseConfig: XCTestCase {
|
|||||||
[ { "type": "staticButton", "title": "Pew" } ]
|
[ { "type": "staticButton", "title": "Pew" } ]
|
||||||
""".data(using: .utf8)!
|
""".data(using: .utf8)!
|
||||||
let result = try? JSONDecoder().decode([BarItemDefinition].self, from: buttonNoActionFixture)
|
let result = try? JSONDecoder().decode([BarItemDefinition].self, from: buttonNoActionFixture)
|
||||||
XCTAssertEqual(result?.first?.type, .staticButton(title: "Pew"))
|
guard case .staticButton("Pew")? = result?.first?.type else {
|
||||||
XCTAssertEqual(result?.first?.action, .some(.none))
|
XCTFail()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
guard case .none? = result?.first?.action else {
|
||||||
|
XCTFail()
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func testButtonKeyCodeAction() {
|
func testButtonKeyCodeAction() {
|
||||||
@ -16,8 +22,14 @@ class ParseConfig: XCTestCase {
|
|||||||
[ { "type": "staticButton", "title": "Pew", "action": "hidKey", "keycode": 123} ]
|
[ { "type": "staticButton", "title": "Pew", "action": "hidKey", "keycode": 123} ]
|
||||||
""".data(using: .utf8)!
|
""".data(using: .utf8)!
|
||||||
let result = try? JSONDecoder().decode([BarItemDefinition].self, from: buttonKeycodeFixture)
|
let result = try? JSONDecoder().decode([BarItemDefinition].self, from: buttonKeycodeFixture)
|
||||||
XCTAssertEqual(result?.first?.type, .staticButton(title: "Pew"))
|
guard case .staticButton("Pew")? = result?.first?.type else {
|
||||||
XCTAssertEqual(result?.first?.action, .hidKey(keycode: 123))
|
XCTFail()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
guard case .hidKey(keycode: 123)? = result?.first?.action else {
|
||||||
|
XCTFail()
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func testPredefinedItem() {
|
func testPredefinedItem() {
|
||||||
@ -25,8 +37,14 @@ class ParseConfig: XCTestCase {
|
|||||||
[ { "type": "escape" } ]
|
[ { "type": "escape" } ]
|
||||||
""".data(using: .utf8)!
|
""".data(using: .utf8)!
|
||||||
let result = try? JSONDecoder().decode([BarItemDefinition].self, from: buttonKeycodeFixture)
|
let result = try? JSONDecoder().decode([BarItemDefinition].self, from: buttonKeycodeFixture)
|
||||||
XCTAssertEqual(result?.first?.type, .staticButton(title: "esc"))
|
guard case .staticButton("esc")? = result?.first?.type else {
|
||||||
XCTAssertEqual(result?.first?.action, .keyPress(keycode: 53))
|
XCTFail()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
guard case .keyPress(keycode: 53)? = result?.first?.action else {
|
||||||
|
XCTFail()
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func testExtendedWidthForPredefinedItem() {
|
func testExtendedWidthForPredefinedItem() {
|
||||||
@ -34,8 +52,18 @@ class ParseConfig: XCTestCase {
|
|||||||
[ { "type": "escape", "width": 110}, ]
|
[ { "type": "escape", "width": 110}, ]
|
||||||
""".data(using: .utf8)!
|
""".data(using: .utf8)!
|
||||||
let result = try? JSONDecoder().decode([BarItemDefinition].self, from: buttonKeycodeFixture)
|
let result = try? JSONDecoder().decode([BarItemDefinition].self, from: buttonKeycodeFixture)
|
||||||
XCTAssertEqual(result?.first?.type, .staticButton(title: "esc"))
|
guard case .staticButton("esc")? = result?.first?.type else {
|
||||||
XCTAssertEqual(result?.first?.action, .keyPress(keycode: 53))
|
XCTFail()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
guard case .keyPress(keycode: 53)? = result?.first?.action else {
|
||||||
|
XCTFail()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
guard case .width(110)? = result?.first?.additionalParameters[.width] else {
|
||||||
|
XCTFail()
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user