diff options
| author | Chris Denton <chris@chrisdenton.dev> | 2024-02-27 00:58:18 -0300 |
|---|---|---|
| committer | Chris Denton <chris@chrisdenton.dev> | 2024-02-27 11:28:17 -0300 |
| commit | c84ba2306260dced7cb77f9a624b3e447c5d32d0 (patch) | |
| tree | e55b1d18b9182c32c0f0346a9c0ce1f4c643be97 | |
| parent | 7c41af290f1ef909024304bdc0b73650b24a1b00 (diff) | |
| download | rust-c84ba2306260dced7cb77f9a624b3e447c5d32d0.tar.gz rust-c84ba2306260dced7cb77f9a624b3e447c5d32d0.zip | |
Test getting the OS thread name
| -rw-r--r-- | library/std/src/thread/tests.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/library/std/src/thread/tests.rs b/library/std/src/thread/tests.rs index 5d6b9e94ee9..efd06c8df6e 100644 --- a/library/std/src/thread/tests.rs +++ b/library/std/src/thread/tests.rs @@ -69,6 +69,25 @@ fn test_named_thread_truncation() { result.unwrap().join().unwrap(); } +#[cfg(any( + target_os = "windows", + target_os = "linux", + target_os = "macos", + target_os = "ios", + target_os = "tvos", + target_os = "watchos" +))] +#[test] +fn test_get_os_named_thread() { + use crate::sys::thread::Thread; + let handler = thread::spawn(|| { + let name = c"test me please"; + Thread::set_name(name); + assert_eq!(name, Thread::get_name().unwrap().as_c_str()); + }); + handler.join().unwrap(); +} + #[test] #[should_panic] fn test_invalid_named_thread() { |
