Fix Principal topic monitor not initialized

in `test_path_normalize_for_cd`

This happens when running the tests using `cargo nextest run`, where
each test runs in its own process, but does not happen with normal
`cargo test`.

Fix by avoiding eprintf!, which can reach SigChecker::check. Instead use a custom panic-message.
This commit is contained in:
Henrik Hørlück Berg
2026-05-24 13:19:33 +02:00
committed by Peter Ammon
parent 17fdd2f153
commit 8513bb8dc4

View File

@@ -476,50 +476,65 @@ mod test_path_normalize_for_cd {
fn relative_path() {
let wd = L!("/home/user/");
let path = L!("projects");
eprintf!("(%s, %s)\n", wd, path);
assert_eq!(path_normalize_for_cd(wd, path), L!("/home/user/projects"));
assert_eq!(
path_normalize_for_cd(wd, path),
L!("/home/user/projects"),
"Normalized path for ({wd}, {path})"
);
}
#[test]
fn absolute_path() {
let wd = L!("/home/user/");
let path = L!("/etc");
eprintf!("(%s, %s)\n", wd, path);
assert_eq!(path_normalize_for_cd(wd, path), L!("/etc"));
assert_eq!(
path_normalize_for_cd(wd, path),
L!("/etc"),
"Normalized path for ({wd}, {path})"
);
}
#[test]
fn parent_directory() {
let wd = L!("/home/user/projects/");
let path = L!("../docs");
eprintf!("(%s, %s)\n", wd, path);
assert_eq!(path_normalize_for_cd(wd, path), L!("/home/user/docs"));
assert_eq!(
path_normalize_for_cd(wd, path),
L!("/home/user/docs"),
"Normalized path for ({wd}, {path})"
);
}
#[test]
fn current_directory() {
let wd = L!("/home/user/");
let path = L!("./");
eprintf!("(%s, %s)\n", wd, path);
assert_eq!(path_normalize_for_cd(wd, path), L!("/home/user"));
assert_eq!(
path_normalize_for_cd(wd, path),
L!("/home/user"),
"Normalized path for ({wd}, {path})"
);
}
#[test]
fn nested_parent_directory() {
let wd = L!("/home/user/projects/");
let path = L!("../../");
eprintf!("(%s, %s)\n", wd, path);
assert_eq!(path_normalize_for_cd(wd, path), L!("/home"));
assert_eq!(
path_normalize_for_cd(wd, path),
L!("/home"),
"Normalized path for ({wd}, {path})"
);
}
#[test]
fn complex_path() {
let wd = L!("/home/user/projects/");
let path = L!("./../other/projects/./.././../docs");
eprintf!("(%s, %s)\n", wd, path);
assert_eq!(
path_normalize_for_cd(wd, path),
L!("/home/user/other/projects/./.././../docs")
L!("/home/user/other/projects/./.././../docs"),
"Normalized path for ({wd}, {path})"
);
}
@@ -527,34 +542,43 @@ fn complex_path() {
fn root_directory() {
let wd = L!("/");
let path = L!("..");
eprintf!("(%s, %s)\n", wd, path);
assert_eq!(path_normalize_for_cd(wd, path), L!("/.."));
assert_eq!(
path_normalize_for_cd(wd, path),
L!("/.."),
"Normalized path for ({wd}, {path})"
);
}
#[test]
fn up_to_root_directory() {
let wd = L!("/foo/");
let path = L!("..");
eprintf!("(%s, %s)\n", wd, path);
assert_eq!(path_normalize_for_cd(wd, path), L!("/"));
assert_eq!(
path_normalize_for_cd(wd, path),
L!("/"),
"Normalized path for ({wd}, {path})"
);
}
#[test]
fn empty_path() {
let wd = L!("/home/user/");
let path = L!("");
eprintf!("(%s, %s)\n", wd, path);
assert_eq!(path_normalize_for_cd(wd, path), L!("/home/user/"));
assert_eq!(
path_normalize_for_cd(wd, path),
L!("/home/user/"),
"Normalized path for ({wd}, {path})"
);
}
#[test]
fn trailing_slash() {
let wd = L!("/home/user/projects/");
let path = L!("docs/");
eprintf!("(%s, %s)\n", wd, path);
assert_eq!(
path_normalize_for_cd(wd, path),
L!("/home/user/projects/docs/")
L!("/home/user/projects/docs/"),
"Normalized path for ({wd}, {path})"
);
}
}