File tree 3 files changed +33
-7
lines changed
Sources/OpenSwiftUICore/Util
Tests/OpenSwiftUICoreTests/Util
3 files changed +33
-7
lines changed Original file line number Diff line number Diff line change @@ -34,12 +34,12 @@ enum Tracing {
34
34
} else {
35
35
#if canImport(Darwin)
36
36
var info = Dl_info ( )
37
- guard dladdr ( nominalDescriptor, & info) = = 0 else {
37
+ guard dladdr ( nominalDescriptor, & info) ! = 0 else {
38
38
return unknown
39
39
}
40
40
let name = ( String ( cString: info. dli_fname) as NSString ) . lastPathComponent
41
41
moduleLookupCache. value [ nominalDescriptor] = name
42
- return unknown
42
+ return name
43
43
#else
44
44
// TODO: [Easy] Add a C layer to import dladdr on non-Darwin Swift platform
45
45
// See https://forums.swift.org/t/dladdr-and-the-clang-importer/26379/11
Original file line number Diff line number Diff line change 1
1
//
2
- // ThreadUtilsTest .swift
2
+ // ThreadUtilsTests .swift
3
3
// OpenSwiftUICoreTests
4
4
5
5
import OpenSwiftUICore
6
6
import Testing
7
7
8
- struct ThreadUtilsTest {
8
+ struct ThreadUtilsTests {
9
9
static let defaultValue : Int = 1
10
10
static let box = ThreadSpecific ( defaultValue)
11
11
12
12
@Test
13
13
func value( ) async throws {
14
- let box = ThreadUtilsTest . box
15
- #expect( box. value == ThreadUtilsTest . defaultValue)
14
+ let box = ThreadUtilsTests . box
15
+ #expect( box. value == ThreadUtilsTests . defaultValue)
16
16
try await withThrowingTaskGroup ( of: Int . self) { group in
17
17
group. addTask {
18
18
await Task . detached {
@@ -30,7 +30,7 @@ struct ThreadUtilsTest {
30
30
}
31
31
let result = try await group. reduce ( 0 , + )
32
32
#expect( result == 7 )
33
- #expect( box. value == ThreadUtilsTest . defaultValue)
33
+ #expect( box. value == ThreadUtilsTests . defaultValue)
34
34
}
35
35
}
36
36
}
Original file line number Diff line number Diff line change
1
+ //
2
+ // TracingTests.swift
3
+ // OpenSwiftUICoreTests
4
+
5
+ @testable import OpenSwiftUICore
6
+ import OpenGraphShims
7
+ import Testing
8
+
9
+ @Suite ( . disabled( if: !attributeGraphEnabled, " Not implemented in OG yet " ) )
10
+ struct TracingTests {
11
+ struct Demo { }
12
+
13
+ @Test ( . disabled( if: !attributeGraphEnabled, " OGTypeDescription is not implemented yet " ) )
14
+ func name( ) {
15
+ #expect( Tracing . nominalTypeName ( Int . self) == " Int " )
16
+ #expect( Tracing . nominalTypeName ( String . self) == " String " )
17
+ #expect( Tracing . nominalTypeName ( Demo . self) == " TracingTests.Demo " )
18
+ }
19
+
20
+ @Test ( . disabled( if: !attributeGraphEnabled, " OGTypeNominalDescriptor is not implemented yet " ) )
21
+ func library( ) async throws {
22
+ #expect( Tracing . libraryName ( defining: Int . self) == " libswiftCore.dylib " )
23
+ #expect( Tracing . libraryName ( defining: String . self) == " libswiftCore.dylib " )
24
+ #expect( Tracing . libraryName ( defining: Demo . self) == " OpenSwiftUICoreTests " )
25
+ }
26
+ }
You can’t perform that action at this time.
0 commit comments