|
| 1 | +// RUN: %empty-directory(%t) |
| 2 | +// RUN: %target-build-swift -target %target-future-triple -parse-stdlib %s -module-name main -o %t/a.out |
| 3 | +// RUN: %target-codesign %t/a.out |
| 4 | +// RUN: %target-run %t/a.out |
| 5 | +// REQUIRES: executable_test |
| 6 | +// REQUIRES: concurrency |
| 7 | +// UNSUPPORTED: use_os_stdlib |
| 8 | +// UNSUPPORTED: back_deployment_runtime |
| 9 | + |
| 10 | +import Swift |
| 11 | +import StdlibUnittest |
| 12 | +import _Concurrency |
| 13 | + |
| 14 | +let MetadataPrintingTests = TestSuite("MetadataPrinting") |
| 15 | + |
| 16 | +class NonSendable { |
| 17 | + var x: Int = 0 |
| 18 | +} |
| 19 | + |
| 20 | +func expect<T>(type: T.Type, printsAs string: String) { |
| 21 | + expectEqual(string, "\(type)") |
| 22 | +} |
| 23 | + |
| 24 | +MetadataPrintingTests.test("@isolated(any) functions") { |
| 25 | + expect(type: (@isolated(any) () -> ()).self, |
| 26 | + printsAs: "@isolated(any) () -> ()") |
| 27 | + expect(type: (@isolated(any) () -> NonSendable).self, |
| 28 | + printsAs: "@isolated(any) () -> NonSendable") |
| 29 | + expect(type: (@isolated(any) () -> sending NonSendable).self, |
| 30 | + printsAs: "@isolated(any) () -> sending NonSendable") |
| 31 | +} |
| 32 | + |
| 33 | +MetadataPrintingTests.test("global actor functions") { |
| 34 | + expect(type: (@MainActor () -> ()).self, |
| 35 | + printsAs: "@MainActor () -> ()") |
| 36 | + expect(type: (@MainActor () -> NonSendable).self, |
| 37 | + printsAs: "@MainActor () -> NonSendable") |
| 38 | + expect(type: (@MainActor () -> sending NonSendable).self, |
| 39 | + printsAs: "@MainActor () -> sending NonSendable") |
| 40 | +} |
| 41 | + |
| 42 | +runAllTests() |
0 commit comments