|
| 1 | +use std::process::Command; |
| 2 | + |
| 3 | +#[test] |
| 4 | +fn root_help_documents_canonical_cortex_home_paths() { |
| 5 | + let output = Command::new(env!("CARGO_BIN_EXE_Cortex")) |
| 6 | + .arg("--help") |
| 7 | + .env("NO_COLOR", "1") |
| 8 | + .output() |
| 9 | + .expect("failed to run Cortex --help"); |
| 10 | + |
| 11 | + assert!( |
| 12 | + output.status.success(), |
| 13 | + "Cortex --help failed: stdout=\n{}\nstderr=\n{}", |
| 14 | + String::from_utf8_lossy(&output.stdout), |
| 15 | + String::from_utf8_lossy(&output.stderr) |
| 16 | + ); |
| 17 | + |
| 18 | + let stdout = String::from_utf8_lossy(&output.stdout); |
| 19 | + |
| 20 | + assert!( |
| 21 | + stdout.contains("default: ~/.cortex"), |
| 22 | + "CORTEX_HOME help should document the canonical ~/.cortex default:\n{stdout}" |
| 23 | + ); |
| 24 | + assert!( |
| 25 | + stdout.contains("~/.cortex/config.toml"), |
| 26 | + "Config path should use canonical Cortex home:\n{stdout}" |
| 27 | + ); |
| 28 | + assert!( |
| 29 | + stdout.contains("~/.cortex/sessions/"), |
| 30 | + "Sessions path should use canonical Cortex home:\n{stdout}" |
| 31 | + ); |
| 32 | + assert!( |
| 33 | + stdout.contains("~/.cortex/logs/"), |
| 34 | + "Logs path should use canonical Cortex home:\n{stdout}" |
| 35 | + ); |
| 36 | + assert!( |
| 37 | + !stdout.contains("~/.config/cortex"), |
| 38 | + "Help should not advertise lowercase XDG config paths:\n{stdout}" |
| 39 | + ); |
| 40 | + assert!( |
| 41 | + !stdout.contains("~/.local/share/cortex"), |
| 42 | + "Help should not advertise lowercase XDG data paths:\n{stdout}" |
| 43 | + ); |
| 44 | + assert!( |
| 45 | + !stdout.contains("~/.cache/cortex"), |
| 46 | + "Help should not advertise lowercase XDG cache paths:\n{stdout}" |
| 47 | + ); |
| 48 | +} |
0 commit comments