You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would make sense to be able to mark a whole suite as @available(macOS 11, *) or w/e instead of making us mark each test. Also the error when you try to do this makes no sense.
Expected behavior
Successful compilation when marking whole suite as available on specific platforms.
Actual behavior
/Users/camdennarzt/Developer/getargv.swift/Tests/SwiftGetargvTests/Test.swift:6:1: error: Attribute 'Suite' cannot be applied to this structure because it has been marked '@available(macOS 11.0, *)'
4 | @testable import SwiftGetargv
5 |
6 | @available(macOS 11.0, *)
| `- error: Attribute 'Suite' cannot be applied to this structure because it has been marked '@available(macOS 11.0, *)'
7 | @Suite()
8 | struct SwiftGetargvTests {
/Users/camdennarzt/Developer/getargv.swift/Tests/SwiftGetargvTests/Test.swift:10:5: error: Attribute 'Test' cannot be applied to this function because it has been marked '@available(macOS 11.0, *)'
8 | struct SwiftGetargvTests {
9 |
10 | @Test("test getArgvOfPid NUL replacement", arguments: zip([true, false], [" ", "\0"]))
| `- error: Attribute 'Test' cannot be applied to this function because it has been marked '@available(macOS 11.0, *)'
11 | func GetArgvOfPidNuls(nuls: Bool, separator: String) throws {
12 | let expectedOutput = CommandLine.arguments.joined(separator: separator).utf8CString
/Users/camdennarzt/Developer/getargv.swift/Tests/SwiftGetargvTests/Test.swift:19:5: error: Attribute 'Test' cannot be applied to this function because it has been marked '@available(macOS 11.0, *)'
17 | }
18 |
19 | @Test("test getArgvAndArgcOfPid")
| `- error: Attribute 'Test' cannot be applied to this function because it has been marked '@available(macOS 11.0, *)'
20 | func testGetArgvAndArgcOfPid() throws {
21 | let expectedOutput = CommandLine.arguments
error: fatalError
This is especially bad because the error: error: Attribute 'Test' cannot be applied to this function because it has been marked '@available(macOS 11.0, *)' is not true, if you apply the @Test attribute to a function which has been marked with @available(macOS 11.0, *) that works, it's just that inheriting the available attr from the suite breaks things.
Swift & OS version (output of swift --version ; uname -a)
<unknown>:0: warning: using (deprecated) legacy driver, Swift installation does not contain swift-driver at: '/Library/Developer/CommandLineTools/usr/bin/swift-driver-new'
Apple Swift version 6.0 (swiftlang-6.0.0.7.6 clang-1600.0.24.1)
Target: x86_64-apple-darwin24.0.0
Darwin Camdens-Mac 24.0.0 Darwin Kernel Version 24.0.0: Thu Jun 20 20:36:19 PDT 2024; root:xnu-11215.0.115.501.3~1/RELEASE_X86_64 x86_64
The text was updated successfully, but these errors were encountered:
This constraint exists because, in order to correctly compute availability on a suite, we need to be able to see the availability of all its containing types (or if a test is declared in an extension, of the original type declaration.)
As of swift-syntax-600, it's possible for us to see the containing type declarations of everything that isn't an extension, so we may be able to resolve this in the common case. Extensions continue to pose a problem because tests declared in them could be subject to availability constraints that are not bound to the visible AST, but that's an existing problem.
Ah, right, now I remember. It's not just about syntax, because we need some way to determine the fully-qualified name of the suite type and that information isn't available if the suite type is unavailable.
Description
It would make sense to be able to mark a whole suite as
@available(macOS 11, *)
or w/e instead of making us mark each test. Also the error when you try to do this makes no sense.Expected behavior
Successful compilation when marking whole suite as available on specific platforms.
Actual behavior
This is especially bad because the error:
error: Attribute 'Test' cannot be applied to this function because it has been marked '@available(macOS 11.0, *)'
is not true, if you apply the@Test
attribute to a function which has been marked with@available(macOS 11.0, *)
that works, it's just that inheriting the available attr from the suite breaks things.Steps to reproduce
swift-testing version/commit hash
0.11.0
Swift & OS version (output of
swift --version ; uname -a
)The text was updated successfully, but these errors were encountered: