(1f1b321) Record a move's reason in its history entry, and bump to 0.31.2
This commit is contained in:
@@ -1360,3 +1360,44 @@ fn un_discarding_drops_the_discard_stamp() {
|
||||
assert!(field(&content, "Discarded On").is_none(), "{content}");
|
||||
assert!(field(&content, "Committed On").is_some(), "{content}");
|
||||
}
|
||||
|
||||
/// Prose takes a leading hyphen, so a reason that reads like a flag is stored as the
|
||||
/// content it is rather than refused or swallowed. The cost of that bargain is that a
|
||||
/// genuinely mistyped flag here lands in the log too.
|
||||
#[test]
|
||||
fn a_reason_takes_a_leading_hyphen_as_content() {
|
||||
let temp = TempDir::new().unwrap();
|
||||
let worklane = setup_worklane(&temp);
|
||||
create_ticket(
|
||||
&worklane,
|
||||
"backlog",
|
||||
"Hyphen Reason",
|
||||
"Prose trap.",
|
||||
"bbbb2222",
|
||||
"alice",
|
||||
"_Not set_",
|
||||
"",
|
||||
);
|
||||
|
||||
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
||||
cmd.current_dir(temp.path())
|
||||
.args([
|
||||
"mv",
|
||||
"bbbb2222",
|
||||
"--status",
|
||||
"committed",
|
||||
"--reason",
|
||||
"-not-a-flag",
|
||||
])
|
||||
.assert()
|
||||
.success();
|
||||
|
||||
let dir = worklane.join("history").join("bbbb2222");
|
||||
let entry = fs::read_dir(&dir)
|
||||
.unwrap()
|
||||
.filter_map(|e| e.ok())
|
||||
.map(|e| fs::read_to_string(e.path()).unwrap())
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n");
|
||||
assert!(entry.contains("**Reason**: -not-a-flag\n"), "{entry:?}");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user