Debian Codegraph @

debian/rust-vendor/ctrlc/tests/main/issue_97.rs

raw
1 // Copyright (c) 2023 CtrlC developers
2 // Licensed under the Apache License, Version 2.0
3 // <LICENSE-APACHE or
4 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT
5 // license <LICENSE-MIT or http://opensource.org/licenses/MIT>,
6 // at your option. All files in the project carrying such
7 // notice may not be copied, modified, or distributed except
8 // according to those terms.
9
10 #[macro_use]
11 mod harness;
12 use harness::{platform, run_harness};
13
14 mod test_signal_hook;
15 use test_signal_hook::run_signal_hook;
16
17 fn expect_multiple_handlers() {
18 #[cfg(not(windows))]
19 match ctrlc::try_set_handler(|| {}) {
20 Err(ctrlc::Error::MultipleHandlers) => {}
21 _ => panic!("Expected Error::MultipleHandlers"),
22 }
23 }
24
25 fn tests() {
26 run_tests!(run_signal_hook);
27 run_tests!(expect_multiple_handlers);
28 }
29
30 fn main() {
31 run_harness(tests);
32 }