Skip to content

Commit

Permalink
Added test for new macro
Browse files Browse the repository at this point in the history
  • Loading branch information
samdeane committed Dec 6, 2024
1 parent f61d456 commit ac3dc30
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Tests/SwiftGodotTests/SignalTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import SwiftGodotTestability
@Godot
private class TestSignalNode: Node {
#signal("mySignal", arguments: ["age": Int.self, "name": String.self])
#nusignal("nuSignal", arguments: ["age": Int.self, "name": String.self])
var receivedInt: Int? = nil
var receivedString: String? = nil
Expand All @@ -30,6 +31,19 @@ final class SignalTests: GodotTestCase {
XCTAssertEqual (node.receivedString, "Joey", "Strings should have been the same")
}

func testNuSignal() {
let node = TestNode()
var signalReceived = false

node.nuSignal.connect { age, name in
XCTAssertEqual (age, 22)
XCTAssertEqual (name, "Sam")
signalReceived = true
}
node.nuSignal.emit(22, "Sam")
XCTAssertTrue (signalReceived, "signal should have been received")
}

func testBuiltInSignalWithNoArgument() {
let node = Node()
var signalReceived = false
Expand Down

0 comments on commit ac3dc30

Please sign in to comment.