Oregami
Repositories/oxedyne/fe2o3

oxedyne/fe2o3/fe2o3_steel/tests/command_line.rs

1.2 KiB, 1 run

created by r1870400018:72536, which is this file's identity for as long as the history lasts, whatever it is later renamed to

download · who wrote it · its history

1//! A command given on the command line (`<app> server`) that refuses to run must fail the
2//! process. Until 2026-10-11 an `Evaluation::Error` was dropped there, so a production start
3//! missing its certificate exited with a nought and said nothing, and a supervisor with
4//! `Restart=on-failure` read that as a deliberate stop (found staging Zoapedia, Z9).
5
6use oxedyne_fe2o3_steel::app::tui::command_line_outcome;
7
8use oxedyne_fe2o3_tui::lib_tui::repl::Evaluation;
9
10#[test]
11fn test_an_error_evaluation_fails_the_invocation() {
12 let evals = vec![
13 Evaluation::Output("starting".to_string()),
14 Evaluation::Error("Missing certificate for vhost 'example.test'.".to_string()),
15 Evaluation::Exit,
16 ];
17 match command_line_outcome(evals, "Example") {
18 Ok(()) => panic!("an Error evaluation was swallowed"),
19 Err(e) => {
20 let msg = format!("{}", e);
21 assert!(msg.contains("Missing certificate for vhost 'example.test'."), "{}", msg);
22 assert!(msg.contains("Example"), "{}", msg);
23 }
24 }
25}
26
27#[test]
28fn test_output_exit_and_none_succeed() {
29 let evals = vec![
30 Evaluation::Output("done".to_string()),
31 Evaluation::None,
32 Evaluation::Exit,
33 ];
34 assert!(command_line_outcome(evals, "Example").is_ok());
35}