File: double_init_fail.rs

package info (click to toggle)
rust-rayon-core 1.13.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 528 kB
  • sloc: makefile: 2
file content (15 lines) | stat: -rw-r--r-- 474 bytes parent folder | download | duplicates (55)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use rayon_core::ThreadPoolBuilder;
use std::error::Error;

#[test]
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
fn double_init_fail() {
    let result1 = ThreadPoolBuilder::new().build_global();
    assert!(result1.is_ok());
    let err = ThreadPoolBuilder::new().build_global().unwrap_err();
    assert!(err.source().is_none());
    assert_eq!(
        err.to_string(),
        "The global thread pool has already been initialized.",
    );
}