mod support;
use support::shore;
struct RemovedPath {
argv: &'static [&'static str],
hint_contains: &'static [&'static str],
}
const REMOVED_PATHS: &[RemovedPath] = &[
RemovedPath {
argv: &["review", "publish", "--help"],
hint_contains: &[],
},
RemovedPath {
argv: &["review", "verdict", "--help"],
hint_contains: &[],
},
RemovedPath {
argv: &["review", "ack", "--help"],
hint_contains: &[],
},
RemovedPath {
argv: &["review", "disposition", "--help"],
hint_contains: &[],
},
RemovedPath {
argv: &["review", "intervention", "--help"],
hint_contains: &["shore input-request"],
},
RemovedPath {
argv: &["review", "lineage", "--help"],
hint_contains: &["shore capture --supersedes", "shore revision list"],
},
RemovedPath {
argv: &["review", "unit", "--help"],
hint_contains: &["shore revision list", "shore revision show"],
},
RemovedPath {
argv: &["review", "capture", "--help"],
hint_contains: &["shore capture"],
},
RemovedPath {
argv: &["review", "history", "--help"],
hint_contains: &["shore history"],
},
RemovedPath {
argv: &["review", "endorse", "--help"],
hint_contains: &["shore endorse"],
},
RemovedPath {
argv: &["review", "observation", "add", "--help"],
hint_contains: &["shore observation"],
},
RemovedPath {
argv: &["review", "assessment", "add", "--help"],
hint_contains: &["shore assessment"],
},
RemovedPath {
argv: &["review", "validation", "add", "--help"],
hint_contains: &["shore validation"],
},
RemovedPath {
argv: &["review", "input-request", "open", "--help"],
hint_contains: &["shore input-request"],
},
RemovedPath {
argv: &["review", "association", "associate-commit", "--help"],
hint_contains: &["shore association record"],
},
RemovedPath {
argv: &["review", "association", "associate-ref", "--help"],
hint_contains: &["shore association record --ref"],
},
RemovedPath {
argv: &["review", "association", "withdraw-commit", "--help"],
hint_contains: &["shore association withdraw"],
},
RemovedPath {
argv: &["review", "association", "withdraw-ref", "--help"],
hint_contains: &["shore association withdraw"],
},
RemovedPath {
argv: &["review", "association", "list", "--help"],
hint_contains: &["shore association record|withdraw|list"],
},
RemovedPath {
argv: &["input-request", "fetch", "--help"],
hint_contains: &["shore input-request show"],
},
RemovedPath {
argv: &["review", "revisions", "--help"],
hint_contains: &["shore revision list"],
},
RemovedPath {
argv: &["review", "show", "--help"],
hint_contains: &["shore revision show"],
},
RemovedPath {
argv: &["identity", "enroll", "--help"],
hint_contains: &["shore identity delegate <AGENT> --principal <P>"],
},
RemovedPath {
argv: &["keys", "init", "--help"],
hint_contains: &["The `keys` family is now `key`"],
},
RemovedPath {
argv: &["dump", "--help"],
hint_contains: &["shore diff", "shore inspect", "shore revision show"],
},
RemovedPath {
argv: &["show", "--help"],
hint_contains: &["shore diff", "shore inspect", "shore revision show"],
},
RemovedPath {
argv: &["notes", "apply", "--help"],
hint_contains: &["shore observation", "shore revision show"],
},
];
#[test]
fn review_namespace_is_retired_with_a_hint() {
for argv in [vec!["review"], vec!["review", "--help"]] {
let out = shore(argv.clone());
assert!(!out.status.success(), "{argv:?} should be unregistered");
let err = String::from_utf8_lossy(&out.stderr);
assert!(
err.contains("unrecognized subcommand"),
"{argv:?} stderr:\n{err}"
);
assert!(
err.contains("flattened to the top level"),
"{argv:?} stderr:\n{err}"
);
}
}
#[test]
fn removed_review_paths_are_unregistered_and_hint_at_successors() {
for case in REMOVED_PATHS {
let output = shore(case.argv.iter().copied());
let stderr = String::from_utf8_lossy(&output.stderr);
assert!(!output.status.success(), "{:?} must be rejected", case.argv);
assert!(
stderr.contains("unrecognized subcommand"),
"{:?} should be unregistered:\n{stderr}",
case.argv
);
for needle in case.hint_contains {
assert!(
stderr.contains(needle),
"{:?} hint missing {needle:?}:\n{stderr}",
case.argv
);
}
}
}