Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Tests/TUIkitTests/FrameDiffWriterTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,6 @@ struct DiffIntegrationTests {

@Test("Content and status bar caches are independent")
func independentCaches() {
let writer = FrameDiffWriter()

// Simulate writing content + status bar (using internal state check)
let contentLines = ["Content1", "Content2"]
let statusLines = ["Status1"]
Expand Down
3 changes: 2 additions & 1 deletion Tests/TUIkitTests/LifecycleManagerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,13 @@ struct LifecycleManagerTaskTests {
nonisolated(unsafe) var wasCancelled = false
manager.startTask(token: "task-1", priority: .medium) {
// Long-running task that checks cancellation
try? await Task.sleep(for: .seconds(10))
try? await Task.sleep(for: .milliseconds(100))
wasCancelled = Task.isCancelled
}
// Cancel immediately
manager.cancelTask(token: "task-1")
try await Task.sleep(for: .milliseconds(50))
#expect(wasCancelled == true)
// Task was cancelled, so it either didn't complete the sleep
// or Task.isCancelled was true. Either way the task is cancelled.
// We can't easily observe the internal state, but cancellation was requested.
Expand Down
2 changes: 1 addition & 1 deletion Tests/TUIkitTests/ProgressViewTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ struct ProgressViewStyleTests {

@Test("All styles render correct width")
func allStylesCorrectWidth() {
let styles: [ProgressBarStyle] = [.block, .blockFine, .shade, .bar, .dot]
let styles: [TrackStyle] = [.block, .blockFine, .shade, .bar, .dot]
let context = testContext(width: 20)

for style in styles {
Expand Down
7 changes: 4 additions & 3 deletions Tests/TUIkitTests/RenderBottleneckTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ struct RenderBottleneckTests {
/// Uses `Date` instead of `CFAbsoluteTimeGetCurrent` because CoreFoundation
/// timing functions are not available on Linux. The precision difference
/// is negligible for performance benchmarks at millisecond granularity.
@discardableResult
private func measure(_ name: String, iterations: Int = 1000, block: () -> Void) -> TimeInterval {
let start = Date()
for _ in 0..<iterations {
Expand Down Expand Up @@ -53,19 +54,19 @@ struct RenderBottleneckTests {

// Depth 2
let depth2 = VStack { VStack { Text("A") } }
let time2 = measure("Depth 2", iterations: iterations) {
measure("Depth 2", iterations: iterations) {
_ = renderToBuffer(depth2, context: context)
}

// Depth 3
let depth3 = VStack { VStack { VStack { Text("A") } } }
let time3 = measure("Depth 3", iterations: iterations) {
measure("Depth 3", iterations: iterations) {
_ = renderToBuffer(depth3, context: context)
}

// Depth 5
let depth5 = VStack { VStack { VStack { VStack { VStack { Text("A") } } } } }
let time5 = measure("Depth 5", iterations: iterations) {
measure("Depth 5", iterations: iterations) {
_ = renderToBuffer(depth5, context: context)
}

Expand Down
7 changes: 2 additions & 5 deletions Tests/TUIkitTests/SecureFieldTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,9 @@ struct SecureFieldTests {

@Test("SecureField onSubmit modifier stores action")
func onSubmitStoresAction() {
var text = ""
var submitted = false
let binding = Binding(get: { text }, set: { text = $0 })
let binding = Binding(get: { "" }, set: { _ in })

let secureField = SecureField("Password", text: binding)
.onSubmit { submitted = true }
let secureField = SecureField("Password", text: binding).onSubmit { }

#expect(secureField.onSubmitAction != nil)
}
Expand Down
1 change: 0 additions & 1 deletion Tests/TUIkitTests/StatePropertyTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ struct StatePropertyWrapperTests {
func stateTriggerRender() {
// StateBox.didSet calls AppState.shared.setNeedsRender().
// We mutate and check that the shared instance is marked as needing render.
let initialNeedsRender = AppState.shared.needsRender
let state = State(wrappedValue: "initial")
state.wrappedValue = "changed"
let triggered = AppState.shared.needsRender
Expand Down