Evaluate the installed action for a fail point. Used by the `fail_point!` macro; not intended to be called directly.
(name: &str)
| 64 | /// Evaluate the installed action for a fail point. Used by the |
| 65 | /// `fail_point!` macro; not intended to be called directly. |
| 66 | pub fn eval(name: &str) { |
| 67 | if let Some(action) = lookup(name) { |
| 68 | match action { |
| 69 | FailAction::Panic => panic!("fail_point fired: {name}"), |
| 70 | FailAction::Sleep(d) => std::thread::sleep(d), |
| 71 | } |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | /// RAII guard that clears a fail point on drop. Use to keep tests |
| 76 | /// from leaking installed actions across cases. |