test: ensure startup message is correct

This commit is contained in:
Khaïs COLIN 2025-05-03 19:00:41 +02:00
parent 6910407ad2
commit 7fbaec8743
7 changed files with 200 additions and 7 deletions

View file

@ -1,8 +1,18 @@
pub fn startup_msg() {
#[cfg(test)]
use insta::assert_snapshot;
pub fn startup_msg() -> String {
let name = env!("CARGO_PKG_NAME");
let version = env!("CARGO_PKG_VERSION");
let authors = env!("CARGO_PKG_AUTHORS");
println!("{name} v{version} started.",);
println!("Copyright 2025 {authors}. All rights reserved.")
format!(
"{name} v{version} started.\n\
Copyright 2025 {authors}. All rights reserved."
)
}
#[test]
fn test_startup_msg() {
assert_snapshot!(startup_msg())
}