File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -14,12 +14,19 @@ private import _TestingInternals
14
14
#if !SWT_NO_EXIT_TESTS
15
15
@Suite ( " Exit test tests " ) struct ExitTestTests {
16
16
@Test ( " Signal names are reported (where supported) " ) func signalName( ) {
17
- let exitStatus = ExitStatus . signal ( SIGABRT )
18
- #if SWT_TARGET_OS_APPLE || os(Linux) || os( FreeBSD) || os(OpenBSD) || os(Android)
19
- #expect ( String ( describing : exitStatus ) == " .signal(SIGABRT → \( SIGABRT ) ) " )
20
- #else
21
- #expect ( String ( describing : exitStatus ) == " .signal( \( SIGABRT ) ) " )
17
+ var hasSignalNames = false
18
+ #if SWT_TARGET_OS_APPLE || os(FreeBSD) || os(OpenBSD) || os(Android)
19
+ hasSignalNames = true
20
+ #elseif os(Linux) && !SWT_NO_DYNAMIC_LINKING
21
+ hasSignalNames = ( symbol ( named : " sigabbrev_np " ) != nil )
22
22
#endif
23
+
24
+ let exitStatus = ExitStatus . signal ( SIGABRT)
25
+ if hasSignalNames {
26
+ #expect( String ( describing: exitStatus) == " .signal(SIGABRT → \( SIGABRT) ) " )
27
+ } else {
28
+ #expect( String ( describing: exitStatus) == " .signal( \( SIGABRT) ) " )
29
+ }
23
30
}
24
31
25
32
@Test ( " Exit tests (passing) " ) func passing( ) async {
You can’t perform that action at this time.
0 commit comments