Skip to content
Merged
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
10 changes: 8 additions & 2 deletions Vault/Tests/FoundationExtensionsTests/Task+RaceTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ enum TaskRaceTests {

@Test("Cancellation is always checked before returning")
func noScheduledTasksCancelledThrowsCancellation() async throws {
let cancellationWaiter = TaskCancellationWaiter()
let parent = Task {
try await Task.race(firstResolved: [TaskRace<Void>]())
// Only race once cancelled, as the task might otherwise run to completion before `cancel()`.
await cancellationWaiter.waitForTaskCancellation()
return try await Task.race(firstResolved: [TaskRace<Void>]())
}
parent.cancel()

Expand Down Expand Up @@ -143,8 +146,11 @@ enum TaskRaceTests {

@Test("Cancellation is always checked before returning")
func noScheduledTasksCancelledThrowsCancellation() async throws {
let cancellationWaiter = TaskCancellationWaiter()
let parent = Task {
try await Task.race(firstValue: [TaskRace<Void>]())
// Only race once cancelled, as the task might otherwise run to completion before `cancel()`.
await cancellationWaiter.waitForTaskCancellation()
return try await Task.race(firstValue: [TaskRace<Void>]())
}
parent.cancel()

Expand Down
5 changes: 5 additions & 0 deletions scripts/validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ destination="id=$udid"
step "Lint" make -C Vault lint

fastlane_note=""
# Shells that haven't run `rbenv init` (non-interactive ones, like an agent's)
# would otherwise find the system Ruby and skip this check.
if command -v rbenv >/dev/null; then
PATH="$(rbenv root)/shims:$PATH"
fi
ruby_version=$(cat "$worktree/.ruby-version")
if [ "$(cd "$worktree" && ruby -e 'print RUBY_VERSION' 2>/dev/null)" = "$ruby_version" ]; then
step "Fastlane config" /bin/bash -c \
Expand Down