Skip to content

Commit bc84af5

Browse files
update
1 parent 0729e8f commit bc84af5

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

Diff for: Documentation/Proposals/NNNN-constrain-the-granularity-of-test-time-limit-durations.md renamed to Documentation/Proposals/0004-constrain-the-granularity-of-test-time-limit-durations.md

+17-12
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
# Constrain the granularity of test time limit durations
22

33
* Proposal:
4-
[SWT-NNNN](NNNN-constrain-the-granularity-of-test-time-limit-durations.md)
4+
[SWT-0004](0004-constrain-the-granularity-of-test-time-limit-durations.md)
55
* Authors: [Dennis Weissmann](https://github.com/dennisweissmann)
6-
* Status: **Awaiting review**
6+
* Status: **Awaiting Review**
77
* Implementation:
8-
[apple/swift-testing#NNNNN](https://github.com/apple/swift-testing/pull/NNNNN)
8+
[apple/swift-testing#534](https://github.com/apple/swift-testing/pull/534)
99
* Review:
10-
([pitch](https://forums.swift.org/t/pitch-constrain-the-granularity-of-test-time
11-
-limit-durations/73146))
10+
([pitch](https://forums.swift.org/t/pitch-constrain-the-granularity-of-test-time-limit-durations/73146))
1211

1312
## Introduction
1413

@@ -66,8 +65,10 @@ API.
6665

6766
## Detailed Design
6867

69-
The `TimeLimitTrait.Duration` struct only has one factory method: `public
70-
static func minutes(_ minutes: some BinaryInteger) -> Self`.
68+
The `TimeLimitTrait.Duration` struct only has one factory method:
69+
```swift
70+
public static func minutes(_ minutes: some BinaryInteger) -> Self`
71+
```
7172

7273
That ensures 2 things:
7374
1. It's impossible to create short time limits (under a minute).
@@ -114,7 +115,7 @@ public struct TimeLimitTrait: TestTrait, SuiteTrait {
114115
The extension on `Trait` that allows for `.timeLimit(...)` to work is defined
115116
like this:
116117

117-
```
118+
```swift
118119
/// Construct a time limit trait that causes a test to time out if it runs for
119120
/// too long.
120121
///
@@ -160,11 +161,11 @@ func serve100CustomersInOneHour() async {
160161
}
161162
```
162163

163-
The `TimeLimitTrait.Duration` struct has various `unavailable` overloads that
164-
are included for diagnostic purposes only. They are all documented and
164+
The `TimeLimitTrait.Duration` struct has various `unavailable` overloads that
165+
are included for diagnostic purposes only. They are all documented and
165166
annotated like this:
166167

167-
```
168+
```swift
168169
/// Construct a time limit duration given a number of <unit>.
169170
///
170171
/// This function is unavailable and is provided for diagnostic purposes only.
@@ -181,7 +182,11 @@ N/A
181182

182183
## Future Directions
183184

184-
N/A.
185+
We could reconsider the granularity constraints and allow for more finegrained
186+
time limits if we come to the conclusion that the advantages outweigh the
187+
disadvantages.
188+
Part of that could be the automatic detection of environments (like CI vs local
189+
and providing a way to use different timeouts in different environments.
185190

186191
## Alternatives Considered
187192

0 commit comments

Comments
 (0)