The backlog was the one column priority governed alone, which sat a p1 nobody had promised above a p3 due tomorrow. It has no entry stamp, so it now takes the due date as the date `by_status_order` keys on: soonest first, undated below every dated one, and priority then title as the tiebreak, which is still the whole order among the undated ones. `TicketItem::due_key` is where a due becomes an orderable date. Only a plain `YYYY-MM-DD` counts, which is all `--due` has accepted since daa0e79, with `due_date` cutting a legacy datetime back to its date. Free text answers `None` and sinks with the unset ones rather than sorting on its spelling: a due nobody can place on a calendar is unknown, the same reading a missing stamp already gets. The comparator stays the single function keyed on `Status`, so `ls`, `ls --ids`, the board's columns and `campaign::members` move together. The All tab keeps `by_priority_then_title`: that merge spans statuses, so no single date governs it. `ls_listed_tickets_sorted_alphabetically` gave its three tickets three different due dates while asserting title order. They share one now, so the case still tests the tiebreak it names rather than the new order. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1029 lines
37 KiB
Rust
1029 lines
37 KiB
Rust
use assert_cmd::Command;
|
|
use assert_fs::TempDir;
|
|
use assert_fs::fixture::{PathChild, PathCreateDir};
|
|
use std::fs;
|
|
|
|
const BIN_NAME: &str = env!("CARGO_BIN_EXE_worklane");
|
|
|
|
fn setup_worklane(temp: &TempDir) -> std::path::PathBuf {
|
|
let worklane = temp.child(".worklane");
|
|
worklane.create_dir_all().unwrap();
|
|
|
|
for dir in ["backlog", "committed", "reviewing", "done"] {
|
|
worklane.child(dir).create_dir_all().unwrap();
|
|
}
|
|
|
|
worklane.path().to_path_buf()
|
|
}
|
|
|
|
fn create_ticket(
|
|
worklane_dir: &std::path::Path,
|
|
status: &str,
|
|
title: &str,
|
|
owner: &str,
|
|
due: &str,
|
|
) {
|
|
let ticket_body = format!(
|
|
"# {}\n\
|
|
\n\
|
|
## Description\n\
|
|
test desc\n\
|
|
\n\
|
|
## Acceptance Criteria\n\
|
|
- [ ] test\n\
|
|
\n\
|
|
## Implementation Plan\n\
|
|
- test\n\
|
|
\n\
|
|
## Metadata\n\
|
|
\n\
|
|
- **ID**: 00000000-0000-0000-0000-000000000001\n\
|
|
- **Tags**: test\n\
|
|
- **Due**: {}\n\
|
|
- **Owner**: {}\n\
|
|
- **Status**: {}\n\
|
|
",
|
|
title, due, owner, status
|
|
);
|
|
let slug = title
|
|
.to_lowercase()
|
|
.chars()
|
|
.filter(|c| c.is_alphanumeric() || *c == ' ' || *c == '-' || *c == '_')
|
|
.map(|c| if c == ' ' { '-' } else { c })
|
|
.collect::<String>();
|
|
let filename = format!("00000000-0000-0000-0000-000000000001_{}.md", slug);
|
|
fs::write(worklane_dir.join(status).join(&filename), ticket_body).unwrap();
|
|
}
|
|
|
|
fn get_stdout(cmd: &mut Command) -> String {
|
|
let assert = cmd.assert();
|
|
String::from_utf8(assert.get_output().stdout.clone()).unwrap()
|
|
}
|
|
|
|
#[test]
|
|
fn ls_without_status_shows_overview() {
|
|
let temp = TempDir::new().unwrap();
|
|
let worklane = setup_worklane(&temp);
|
|
|
|
create_ticket(&worklane, "backlog", "Feature A", "alice", "2026-06-01");
|
|
create_ticket(&worklane, "backlog", "Feature B", "bob", "2026-07-01");
|
|
create_ticket(&worklane, "committed", "Feature C", "charlie", "2026-08-01");
|
|
create_ticket(&worklane, "done", "Feature D", "dave", "2026-09-01");
|
|
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path()).arg("ls").assert().success();
|
|
|
|
let stdout = get_stdout(&mut cmd);
|
|
assert!(stdout.contains("BACKLOG"));
|
|
assert!(stdout.contains("2 tickets"));
|
|
assert!(stdout.contains("COMMITTED"));
|
|
assert!(stdout.contains("1 ticket"));
|
|
assert!(stdout.contains("DONE"));
|
|
assert!(stdout.contains("Feature A"));
|
|
assert!(stdout.contains("Feature B"));
|
|
assert!(stdout.contains("Feature C"));
|
|
}
|
|
|
|
#[test]
|
|
fn ls_with_status_filters_tickets() {
|
|
let temp = TempDir::new().unwrap();
|
|
let worklane = setup_worklane(&temp);
|
|
|
|
create_ticket(&worklane, "backlog", "Feature A", "alice", "2026-06-01");
|
|
create_ticket(&worklane, "committed", "Feature B", "bob", "2026-07-01");
|
|
create_ticket(&worklane, "reviewing", "Feature C", "charlie", "2026-08-01");
|
|
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path()).arg("ls").args(["committed"]);
|
|
|
|
cmd.assert().success();
|
|
|
|
let stdout = get_stdout(&mut cmd);
|
|
assert!(stdout.contains("Feature B"));
|
|
}
|
|
|
|
#[test]
|
|
fn ls_with_invalid_status_fails() {
|
|
let temp = TempDir::new().unwrap();
|
|
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path())
|
|
.arg("ls")
|
|
.args(["nonexistent"])
|
|
.assert()
|
|
.failure();
|
|
}
|
|
|
|
/// Title is the last tiebreak, so the three share a due date and a priority: anything
|
|
/// else here would be testing the due order instead, which has its own case.
|
|
#[test]
|
|
fn ls_listed_tickets_sorted_alphabetically() {
|
|
let temp = TempDir::new().unwrap();
|
|
let worklane = setup_worklane(&temp);
|
|
|
|
create_ticket(&worklane, "backlog", "Zebra", "alice", "2026-06-01");
|
|
create_ticket(&worklane, "backlog", "Apple", "bob", "2026-06-01");
|
|
create_ticket(&worklane, "backlog", "Mango", "charlie", "2026-06-01");
|
|
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path())
|
|
.arg("ls")
|
|
.args(["backlog"])
|
|
.assert()
|
|
.success();
|
|
|
|
let stdout = get_stdout(&mut cmd);
|
|
let apple_pos = stdout.find("Apple");
|
|
let mango_pos = stdout.find("Mango");
|
|
let zebra_pos = stdout.find("Zebra");
|
|
assert!(apple_pos.is_some() && mango_pos.is_some() && zebra_pos.is_some());
|
|
assert!(apple_pos.unwrap() < mango_pos.unwrap());
|
|
assert!(mango_pos.unwrap() < zebra_pos.unwrap());
|
|
}
|
|
|
|
#[test]
|
|
fn ls_empty_status_shows_message() {
|
|
let temp = TempDir::new().unwrap();
|
|
let _worklane = setup_worklane(&temp);
|
|
|
|
// Intentionally leave "done" empty
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path())
|
|
.arg("ls")
|
|
.args(["done"])
|
|
.assert()
|
|
.success();
|
|
|
|
let stdout = get_stdout(&mut cmd);
|
|
assert!(stdout.contains("No tickets in 'done'"));
|
|
}
|
|
|
|
#[test]
|
|
fn ls_displays_owner_and_due() {
|
|
let temp = TempDir::new().unwrap();
|
|
let worklane = setup_worklane(&temp);
|
|
|
|
create_ticket(&worklane, "backlog", "Test ticket", "alice", "2026-12-31");
|
|
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path())
|
|
.arg("ls")
|
|
.args(["backlog"])
|
|
.assert()
|
|
.success();
|
|
|
|
let stdout = get_stdout(&mut cmd);
|
|
assert!(stdout.contains("alice"));
|
|
assert!(stdout.contains("2026-12-31"));
|
|
}
|
|
|
|
/// Both the abbreviated id and the created-at column used to slice by byte
|
|
/// offset, so either a short name or a multibyte character panicked.
|
|
#[test]
|
|
fn ls_handles_short_and_non_ascii_filenames() {
|
|
let temp = TempDir::new().unwrap();
|
|
let worklane = setup_worklane(&temp);
|
|
|
|
for filename in ["ab.md", "émigré-ticket.md", "日本語.md"] {
|
|
fs::write(
|
|
worklane.join("backlog").join(filename),
|
|
"# Odd Name\n\n## Metadata\n\n- **Owner**: alice\n- **Status**: backlog\n",
|
|
)
|
|
.unwrap();
|
|
}
|
|
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path())
|
|
.arg("ls")
|
|
.arg("backlog")
|
|
.assert()
|
|
.success();
|
|
|
|
let stdout = get_stdout(&mut cmd);
|
|
assert_eq!(stdout.matches("Odd Name").count(), 3);
|
|
}
|
|
|
|
#[test]
|
|
fn ls_survives_a_malformed_created_at() {
|
|
let temp = TempDir::new().unwrap();
|
|
let worklane = setup_worklane(&temp);
|
|
|
|
fs::write(
|
|
worklane.join("backlog").join("00000000-0000-0000-0000-000000000009_bad-date.md"),
|
|
"# Bad Date\n\n## Metadata\n\n- **Created At**: 日本語日本語日本語\n- **Status**: backlog\n",
|
|
)
|
|
.unwrap();
|
|
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path())
|
|
.arg("ls")
|
|
.arg("backlog")
|
|
.assert()
|
|
.success();
|
|
|
|
let stdout = get_stdout(&mut cmd);
|
|
assert!(stdout.contains("Bad Date"));
|
|
// Unparseable, so the timestamp column is dropped rather than printed raw
|
|
assert!(!stdout.contains("日本語"));
|
|
}
|
|
|
|
fn create_ticket_with_priority(worklane_dir: &std::path::Path, title: &str, priority: &str) {
|
|
let slug: String = title.to_lowercase().replace(' ', "-");
|
|
let body = format!(
|
|
"# {}\n\n## Metadata\n\n- **ID**: 00000000-0000-0000-0000-00000000000{}\n\
|
|
- **Priority**: {}\n- **Tags**: test\n- **Due**: _Not set_\n\
|
|
- **Owner**: alice\n- **Status**: backlog\n",
|
|
title,
|
|
slug.len() % 10,
|
|
priority
|
|
);
|
|
let filename = format!("0000000{}-0000-0000-0000-000000000001_{}.md", slug.len() % 10, slug);
|
|
fs::write(worklane_dir.join("backlog").join(filename), body).unwrap();
|
|
}
|
|
|
|
#[test]
|
|
fn ls_sorts_by_priority_then_title() {
|
|
let temp = TempDir::new().unwrap();
|
|
let worklane = setup_worklane(&temp);
|
|
|
|
create_ticket_with_priority(&worklane, "Zebra urgent", "1");
|
|
create_ticket_with_priority(&worklane, "Apple later", "4");
|
|
create_ticket_with_priority(&worklane, "Middle one", "2");
|
|
create_ticket(&worklane, "backlog", "No priority at all", "alice", "_Not set_");
|
|
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path()).arg("ls").arg("backlog");
|
|
let stdout = get_stdout(&mut cmd);
|
|
|
|
let at = |needle: &str| stdout.find(needle).unwrap_or_else(|| panic!("{needle} missing"));
|
|
assert!(at("Zebra urgent") < at("Middle one"), "priority 1 must lead");
|
|
assert!(at("Middle one") < at("Apple later"), "2 before 4");
|
|
// Unset sorts last even though its title would come first alphabetically
|
|
assert!(at("Apple later") < at("No priority at all"), "unset must trail");
|
|
}
|
|
|
|
#[test]
|
|
fn ls_filters_by_priority_and_composes_with_status() {
|
|
let temp = TempDir::new().unwrap();
|
|
let worklane = setup_worklane(&temp);
|
|
|
|
create_ticket_with_priority(&worklane, "Urgent one", "1");
|
|
create_ticket_with_priority(&worklane, "Lower one", "3");
|
|
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path())
|
|
.args(["ls", "backlog", "--priority", "1"]);
|
|
let stdout = get_stdout(&mut cmd);
|
|
assert!(stdout.contains("Urgent one"));
|
|
assert!(!stdout.contains("Lower one"), "filter let a level 3 through");
|
|
|
|
// Same filter without a status, through the grouped listing
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path()).args(["ls", "--priority", "3"]);
|
|
let stdout = get_stdout(&mut cmd);
|
|
assert!(stdout.contains("Lower one"));
|
|
assert!(!stdout.contains("Urgent one"));
|
|
}
|
|
|
|
#[test]
|
|
fn ls_shows_a_mark_for_the_level() {
|
|
let temp = TempDir::new().unwrap();
|
|
let worklane = setup_worklane(&temp);
|
|
|
|
create_ticket_with_priority(&worklane, "Top level", "1");
|
|
create_ticket_with_priority(&worklane, "Bottom level", "5");
|
|
create_ticket(&worklane, "backlog", "Nothing set", "alice", "_Not set_");
|
|
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path()).arg("ls").arg("backlog");
|
|
let stdout = get_stdout(&mut cmd);
|
|
|
|
// Piped, so no escapes: the glyph is carrying the level by itself
|
|
assert!(!stdout.contains('\u{1b}'));
|
|
assert!(
|
|
stdout.contains("\u{25cf}\u{25cf} "),
|
|
"no full meter for level 1 in {stdout:?}"
|
|
);
|
|
assert!(stdout.contains("\u{25cb}\u{25cb} "), "no empty meter for level 5");
|
|
assert!(stdout.contains("\u{b7}\u{b7} "), "no unset mark");
|
|
// The raw number is not what the listing shows
|
|
assert!(!stdout.contains(" 1 "), "the digit leaked into the row");
|
|
}
|
|
|
|
/// A ticket whose Tags field is whatever the test needs it to be, written verbatim so a
|
|
/// missing field, an unset one and a real list are all reachable.
|
|
fn create_ticket_with_tags(
|
|
worklane_dir: &std::path::Path,
|
|
status: &str,
|
|
title: &str,
|
|
tags: &str,
|
|
priority: &str,
|
|
) {
|
|
let slug: String = title.to_lowercase().replace(' ', "-");
|
|
let body = format!(
|
|
"# {title}\n\n## Metadata\n\n - **ID**: 00000000-0000-0000-0000-000000000001\n - **Priority**: {priority}\n{tags} - **Due**: _Not set_\n- **Owner**: alice\n- **Status**: {status}\n"
|
|
);
|
|
fs::write(
|
|
worklane_dir
|
|
.join(status)
|
|
.join(format!("00000000-0000-0000-0000-000000000001_{slug}.md")),
|
|
body,
|
|
)
|
|
.unwrap();
|
|
}
|
|
|
|
/// The Tags line as a ticket carries it, for the common case of a real list.
|
|
fn tags(list: &str) -> String {
|
|
format!("- **Tags**: {list}\n")
|
|
}
|
|
|
|
#[test]
|
|
fn ls_filters_by_tag_and_composes_with_status_and_priority() {
|
|
let temp = TempDir::new().unwrap();
|
|
let worklane = setup_worklane(&temp);
|
|
|
|
create_ticket_with_tags(&worklane, "backlog", "Tagged bug", &tags("bug,cli"), "1");
|
|
create_ticket_with_tags(&worklane, "backlog", "Tagged feature", &tags("feature"), "1");
|
|
create_ticket_with_tags(&worklane, "backlog", "Lower bug", &tags("bug"), "3");
|
|
create_ticket_with_tags(&worklane, "committed", "Started bug", &tags("bug"), "1");
|
|
|
|
// Alone, through the grouped listing: every status, only the tagged tickets.
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path()).args(["ls", "--tag", "bug"]);
|
|
let stdout = get_stdout(&mut cmd);
|
|
assert!(stdout.contains("Tagged bug"), "{stdout}");
|
|
assert!(stdout.contains("Lower bug"), "{stdout}");
|
|
assert!(
|
|
stdout.contains("Started bug"),
|
|
"a tagged ticket in another status was dropped"
|
|
);
|
|
assert!(!stdout.contains("Tagged feature"), "an untagged ticket came through");
|
|
// The counts are filtered too, since they are the same collect.
|
|
assert!(stdout.contains("[BACKLOG] 2 tickets"), "{stdout}");
|
|
assert!(stdout.contains("[COMMITTED] 1 ticket"), "{stdout}");
|
|
|
|
// With the status positional.
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path())
|
|
.args(["ls", "backlog", "--tag", "bug"]);
|
|
let stdout = get_stdout(&mut cmd);
|
|
assert!(stdout.contains("Tagged bug"));
|
|
assert!(stdout.contains("Lower bug"));
|
|
assert!(!stdout.contains("Started bug"), "the status was ignored");
|
|
|
|
// With --priority, and with both: none asked for is everything kept, so the three
|
|
// compose without a rule per pair.
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path())
|
|
.args(["ls", "--tag", "bug", "--priority", "1"]);
|
|
let stdout = get_stdout(&mut cmd);
|
|
assert!(stdout.contains("Tagged bug"));
|
|
assert!(stdout.contains("Started bug"));
|
|
assert!(!stdout.contains("Lower bug"), "the priority was ignored");
|
|
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path())
|
|
.args(["ls", "backlog", "--tag", "bug", "--priority", "1"]);
|
|
let stdout = get_stdout(&mut cmd);
|
|
assert!(stdout.contains("Tagged bug"));
|
|
assert!(!stdout.contains("Lower bug"), "the priority was ignored");
|
|
assert!(!stdout.contains("Started bug"), "the status was ignored");
|
|
assert!(!stdout.contains("Tagged feature"), "the tag was ignored");
|
|
}
|
|
|
|
/// The field is a list of whole values, not a string to search: a ticket tagged `bugfix`
|
|
/// is not a ticket tagged `bug`, and neither is one tagged `Bug`. Case sensitive is the
|
|
/// opinion the field already takes, since `tag_color` draws those two differently.
|
|
#[test]
|
|
fn ls_matches_a_whole_tag_value_and_not_a_substring_or_another_case() {
|
|
let temp = TempDir::new().unwrap();
|
|
let worklane = setup_worklane(&temp);
|
|
|
|
create_ticket_with_tags(&worklane, "backlog", "Real bug", &tags("bug"), "2");
|
|
create_ticket_with_tags(&worklane, "backlog", "Only bugfix", &tags("bugfix"), "2");
|
|
create_ticket_with_tags(&worklane, "backlog", "Capital Bug", &tags("Bug"), "2");
|
|
// A value that only appears with its neighbours around it, so a match on the raw
|
|
// field would find it and a match on the split values cannot.
|
|
create_ticket_with_tags(&worklane, "backlog", "Spaced list", &tags("cli, filter"), "2");
|
|
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path())
|
|
.args(["ls", "backlog", "--tag", "bug"]);
|
|
let stdout = get_stdout(&mut cmd);
|
|
assert!(stdout.contains("Real bug"), "{stdout}");
|
|
assert!(!stdout.contains("Only bugfix"), "bug matched bugfix");
|
|
assert!(!stdout.contains("Capital Bug"), "bug matched Bug");
|
|
|
|
// Trimmed on the way in, so the space after the comma is not part of the tag.
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path())
|
|
.args(["ls", "backlog", "--tag", "filter"]);
|
|
assert!(get_stdout(&mut cmd).contains("Spaced list"));
|
|
|
|
// And the field as written is not itself a tag.
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path())
|
|
.args(["ls", "backlog", "--tag", "cli, filter"]);
|
|
let stdout = get_stdout(&mut cmd);
|
|
assert!(!stdout.contains("Spaced list"), "the whole field matched as one tag");
|
|
}
|
|
|
|
/// No tags is no match, however the ticket spells it: the field absent, unset, or empty.
|
|
#[test]
|
|
fn ls_never_matches_a_ticket_carrying_no_tags() {
|
|
let temp = TempDir::new().unwrap();
|
|
let worklane = setup_worklane(&temp);
|
|
|
|
create_ticket_with_tags(&worklane, "backlog", "Has one", &tags("bug"), "2");
|
|
create_ticket_with_tags(&worklane, "backlog", "Field unset", &tags("_None_"), "2");
|
|
create_ticket_with_tags(&worklane, "backlog", "Field empty", "- **Tags**:\n", "2");
|
|
create_ticket_with_tags(&worklane, "backlog", "Field missing", "", "2");
|
|
create_ticket_with_tags(&worklane, "backlog", "Only commas", &tags(", ,"), "2");
|
|
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path())
|
|
.args(["ls", "backlog", "--tag", "bug"]);
|
|
let stdout = get_stdout(&mut cmd);
|
|
assert!(stdout.contains("Has one"), "{stdout}");
|
|
for absent in ["Field unset", "Field empty", "Field missing", "Only commas"] {
|
|
assert!(!stdout.contains(absent), "{absent} matched a tag it does not carry");
|
|
}
|
|
|
|
// Nor does an empty tag reach the filter: the value parser refuses it, so nothing is
|
|
// listed rather than everything.
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path()).args(["ls", "backlog", "--tag", ""]);
|
|
cmd.assert().failure().code(2);
|
|
}
|
|
|
|
/// A tag nothing carries lists nothing and still succeeds. The message is the one `ls`
|
|
/// already gives for a filter that empties a status, rather than a second one invented
|
|
/// here for tags alone.
|
|
#[test]
|
|
fn ls_with_a_tag_nothing_carries_lists_nothing() {
|
|
let temp = TempDir::new().unwrap();
|
|
let worklane = setup_worklane(&temp);
|
|
|
|
create_ticket_with_tags(&worklane, "backlog", "Tagged bug", &tags("bug"), "2");
|
|
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path())
|
|
.args(["ls", "backlog", "--tag", "frontend"]);
|
|
cmd.assert().success();
|
|
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path())
|
|
.args(["ls", "backlog", "--tag", "frontend"]);
|
|
let stdout = get_stdout(&mut cmd);
|
|
assert!(!stdout.contains("Tagged bug"), "{stdout}");
|
|
assert!(stdout.contains("No tickets in 'backlog' status."), "{stdout}");
|
|
|
|
// Through the grouped listing the counts go to zero and no section is drawn.
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path()).args(["ls", "--tag", "frontend"]);
|
|
let stdout = get_stdout(&mut cmd);
|
|
assert!(stdout.contains("[BACKLOG] 0 tickets"), "{stdout}");
|
|
assert!(!stdout.contains("Tagged bug"), "{stdout}");
|
|
}
|
|
|
|
/// A ticket with an id of its own, since `create_ticket` gives every fixture the same
|
|
/// uuid and `--ids` is the one output where the id is the whole point.
|
|
fn create_ticket_with_id(
|
|
worklane_dir: &std::path::Path,
|
|
status: &str,
|
|
title: &str,
|
|
uuid: &str,
|
|
tags: &str,
|
|
) {
|
|
let ticket_body = format!(
|
|
"# {title}\n\n## Metadata\n\n- **ID**: {uuid}\n- **Tags**: {tags}\n- **Owner**: alice\n- **Status**: {status}\n"
|
|
);
|
|
let filename = format!("{uuid}_{}.md", slug(title));
|
|
fs::write(worklane_dir.join(status).join(filename), ticket_body).unwrap();
|
|
}
|
|
|
|
/// The slug rule, as AGENTS.md requires: derived, never written by hand.
|
|
fn slug(title: &str) -> String {
|
|
title
|
|
.to_lowercase()
|
|
.chars()
|
|
.filter(|c| c.is_alphanumeric() || *c == ' ' || *c == '-' || *c == '_')
|
|
.map(|c| if c == ' ' { '-' } else { c })
|
|
.collect()
|
|
}
|
|
|
|
/// One ticket per line, the seven-character id then a tab then the title, and nothing
|
|
/// else: no heading, no counts, no owner or due column.
|
|
#[test]
|
|
fn ls_ids_prints_the_id_and_the_title_and_nothing_else() {
|
|
let temp = TempDir::new().unwrap();
|
|
let worklane = setup_worklane(&temp);
|
|
|
|
create_ticket_with_id(
|
|
&worklane,
|
|
"backlog",
|
|
"Feature A",
|
|
"1b78a24c-0000-0000-0000-000000000001",
|
|
"bug",
|
|
);
|
|
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path()).args(["ls", "--ids"]);
|
|
cmd.assert().success();
|
|
|
|
let stdout = get_stdout(&mut cmd);
|
|
assert_eq!(stdout, "1b78a24\tFeature A\n", "{stdout:?}");
|
|
}
|
|
|
|
/// Every status, done included, where the decorated listing leaves done out. A
|
|
/// completion has to be able to name a finished ticket.
|
|
#[test]
|
|
fn ls_ids_includes_done_and_narrows_to_a_named_status() {
|
|
let temp = TempDir::new().unwrap();
|
|
let worklane = setup_worklane(&temp);
|
|
|
|
create_ticket_with_id(
|
|
&worklane,
|
|
"backlog",
|
|
"Still open",
|
|
"aaaaaaa1-0000-0000-0000-000000000001",
|
|
"bug",
|
|
);
|
|
create_ticket_with_id(
|
|
&worklane,
|
|
"done",
|
|
"Finished",
|
|
"bbbbbbb2-0000-0000-0000-000000000002",
|
|
"bug",
|
|
);
|
|
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path()).args(["ls", "--ids"]);
|
|
let stdout = get_stdout(&mut cmd);
|
|
assert!(stdout.contains("Still open"), "{stdout}");
|
|
assert!(stdout.contains("Finished"), "a done ticket cannot be named: {stdout}");
|
|
|
|
// The decorated listing is unchanged: done is counted, not listed.
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path()).arg("ls");
|
|
let stdout = get_stdout(&mut cmd);
|
|
assert!(!stdout.contains("Finished"), "{stdout}");
|
|
|
|
// The positional still narrows it.
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path()).args(["ls", "done", "--ids"]);
|
|
let stdout = get_stdout(&mut cmd);
|
|
assert_eq!(stdout, "bbbbbbb\tFinished\n", "{stdout:?}");
|
|
}
|
|
|
|
/// The filters apply to `--ids` exactly as they do to the listing, so a completion can
|
|
/// be narrowed the same way.
|
|
#[test]
|
|
fn ls_ids_still_takes_the_filters() {
|
|
let temp = TempDir::new().unwrap();
|
|
let worklane = setup_worklane(&temp);
|
|
|
|
create_ticket_with_id(
|
|
&worklane,
|
|
"backlog",
|
|
"Tagged bug",
|
|
"aaaaaaa1-0000-0000-0000-000000000001",
|
|
"bug",
|
|
);
|
|
create_ticket_with_id(
|
|
&worklane,
|
|
"backlog",
|
|
"Tagged cli",
|
|
"bbbbbbb2-0000-0000-0000-000000000002",
|
|
"cli",
|
|
);
|
|
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path())
|
|
.args(["ls", "--ids", "--tag", "cli"]);
|
|
let stdout = get_stdout(&mut cmd);
|
|
assert_eq!(stdout, "bbbbbbb\tTagged cli\n", "{stdout:?}");
|
|
}
|
|
|
|
/// An unknown campaign is refused before anything is read, even here. A completion that
|
|
/// listed the whole board because the name was misspelled would be worse than one that
|
|
/// printed nothing.
|
|
#[test]
|
|
fn ls_ids_still_refuses_an_unknown_campaign() {
|
|
let temp = TempDir::new().unwrap();
|
|
let worklane = setup_worklane(&temp);
|
|
|
|
create_ticket_with_id(
|
|
&worklane,
|
|
"backlog",
|
|
"Feature A",
|
|
"aaaaaaa1-0000-0000-0000-000000000001",
|
|
"bug",
|
|
);
|
|
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path())
|
|
.args(["ls", "--ids", "--campaign", "no such campaign"]);
|
|
cmd.assert().failure();
|
|
}
|
|
|
|
/// A status the board is missing is skipped rather than refused, unlike the listing:
|
|
/// the caller is a shell filling in candidates, and an error printed over the prompt is
|
|
/// worse there than no candidates.
|
|
#[test]
|
|
fn ls_ids_is_quiet_about_a_missing_status_directory() {
|
|
let temp = TempDir::new().unwrap();
|
|
let worklane = temp.child(".worklane");
|
|
worklane.create_dir_all().unwrap();
|
|
worklane.child("backlog").create_dir_all().unwrap();
|
|
|
|
create_ticket_with_id(
|
|
worklane.path(),
|
|
"backlog",
|
|
"Feature A",
|
|
"aaaaaaa1-0000-0000-0000-000000000001",
|
|
"bug",
|
|
);
|
|
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path()).args(["ls", "--ids"]);
|
|
cmd.assert().success();
|
|
let stdout = get_stdout(&mut cmd);
|
|
assert_eq!(stdout, "aaaaaaa\tFeature A\n", "{stdout:?}");
|
|
|
|
// The listing still says so, since a person reading it can act on it.
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path()).args(["ls", "done"]);
|
|
let assert = cmd.assert().failure();
|
|
let stderr = String::from_utf8(assert.get_output().stderr.clone()).unwrap();
|
|
assert!(stderr.contains("No 'done' directory"), "{stderr}");
|
|
}
|
|
|
|
/// A status outside the four is clap's to refuse now, so it is a usage error naming the
|
|
/// four rather than a runtime one.
|
|
#[test]
|
|
fn ls_names_the_four_statuses_when_given_another() {
|
|
let temp = TempDir::new().unwrap();
|
|
setup_worklane(&temp);
|
|
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
let assert = cmd
|
|
.current_dir(temp.path())
|
|
.args(["ls", "nonexistent"])
|
|
.assert()
|
|
.code(2);
|
|
let stderr = String::from_utf8(assert.get_output().stderr.clone()).unwrap();
|
|
assert!(stderr.contains("invalid value 'nonexistent'"), "{stderr}");
|
|
for status in ["backlog", "committed", "reviewing", "done"] {
|
|
assert!(stderr.contains(status), "{status} is not offered: {stderr}");
|
|
}
|
|
}
|
|
|
|
/// The listing reads the stamps to order the column by them, and prints none of them.
|
|
/// Pinned against a ticket carrying one, since a listing that started showing them would
|
|
/// change the output every board and completion script parses.
|
|
#[test]
|
|
fn ls_output_is_unchanged_by_a_status_stamp() {
|
|
let temp = TempDir::new().unwrap();
|
|
let worklane = setup_worklane(&temp);
|
|
|
|
create_ticket(&worklane, "committed", "Stamped", "alice", "2026-06-01");
|
|
let path = worklane
|
|
.join("committed")
|
|
.join("00000000-0000-0000-0000-000000000001_stamped.md");
|
|
let before = {
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path()).arg("ls").arg("committed");
|
|
get_stdout(&mut cmd)
|
|
};
|
|
|
|
let stamped = fs::read_to_string(&path)
|
|
.unwrap()
|
|
.replace("- **Status**:", "- **Committed On**: 2026-08-22 09:14:30\n- **Status**:");
|
|
fs::write(&path, stamped).unwrap();
|
|
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path()).arg("ls").arg("committed");
|
|
let after = get_stdout(&mut cmd);
|
|
|
|
assert_eq!(after, before);
|
|
assert!(!after.contains("Committed On"), "{after}");
|
|
}
|
|
|
|
/// A ticket in a status with the entry stamp that status is ordered by, or none.
|
|
///
|
|
/// The field is derived from the status rather than passed, so a case says which column
|
|
/// it is about and cannot name the wrong stamp for it.
|
|
fn create_stamped_ticket(
|
|
worklane_dir: &std::path::Path,
|
|
status: &str,
|
|
title: &str,
|
|
uuid: &str,
|
|
priority: &str,
|
|
stamp: Option<&str>,
|
|
) {
|
|
let field = match status {
|
|
"committed" => "Committed On",
|
|
"reviewing" => "Submitted On",
|
|
"done" => "Completed On",
|
|
other => panic!("{other} has no entry stamp"),
|
|
};
|
|
let line = match stamp {
|
|
Some(value) => format!("- **{field}**: {value}\n"),
|
|
None => String::new(),
|
|
};
|
|
let body = format!(
|
|
"# {title}\n\n## Metadata\n\n- **ID**: {uuid}\n- **Priority**: {priority}\n\
|
|
- **Tags**: test\n- **Due**: _Not set_\n- **Owner**: alice\n{line}\
|
|
- **Status**: {status}\n"
|
|
);
|
|
fs::write(
|
|
worklane_dir
|
|
.join(status)
|
|
.join(format!("{uuid}_{}.md", slug(title))),
|
|
body,
|
|
)
|
|
.unwrap();
|
|
}
|
|
|
|
/// A backlog ticket with the due date that column is ordered by.
|
|
///
|
|
/// Backlog only, the way [`create_stamped_ticket`] is one status at a time: the due is
|
|
/// what stands in for an entry stamp in the one column that has none, and `_Not set_`
|
|
/// passed here is the undated case rather than a separate helper.
|
|
fn create_due_ticket(
|
|
worklane_dir: &std::path::Path,
|
|
title: &str,
|
|
uuid: &str,
|
|
priority: &str,
|
|
due: &str,
|
|
) {
|
|
let body = format!(
|
|
"# {title}\n\n## Metadata\n\n- **ID**: {uuid}\n- **Priority**: {priority}\n\
|
|
- **Tags**: test\n- **Due**: {due}\n- **Owner**: alice\n\
|
|
- **Status**: backlog\n"
|
|
);
|
|
fs::write(
|
|
worklane_dir
|
|
.join("backlog")
|
|
.join(format!("{uuid}_{}.md", slug(title))),
|
|
body,
|
|
)
|
|
.unwrap();
|
|
}
|
|
|
|
fn positions(stdout: &str, titles: [&str; 3]) -> Vec<usize> {
|
|
titles
|
|
.iter()
|
|
.map(|title| {
|
|
stdout
|
|
.find(title)
|
|
.unwrap_or_else(|| panic!("{title} missing from {stdout}"))
|
|
})
|
|
.collect()
|
|
}
|
|
|
|
/// Committed and reviewing are queues, and the head is what has waited longest: that is
|
|
/// what the reader picks next from. Priority no longer decides it, which is why the
|
|
/// oldest here is the least urgent of the three.
|
|
#[test]
|
|
fn ls_orders_committed_and_reviewing_by_the_oldest_entry_stamp() {
|
|
for status in ["committed", "reviewing"] {
|
|
let temp = TempDir::new().unwrap();
|
|
let worklane = setup_worklane(&temp);
|
|
|
|
let at = |n: u8| format!("aaaa000{n}-0000-0000-0000-000000000001");
|
|
create_stamped_ticket(
|
|
&worklane,
|
|
status,
|
|
"Newest",
|
|
&at(1),
|
|
"1",
|
|
Some("2026-08-03 09:00:00"),
|
|
);
|
|
create_stamped_ticket(
|
|
&worklane,
|
|
status,
|
|
"Oldest",
|
|
&at(2),
|
|
"5",
|
|
Some("2026-08-01 09:00:00"),
|
|
);
|
|
create_stamped_ticket(
|
|
&worklane,
|
|
status,
|
|
"Middle",
|
|
&at(3),
|
|
"1",
|
|
Some("2026-08-02 09:00:00"),
|
|
);
|
|
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path()).args(["ls", status]);
|
|
let stdout = get_stdout(&mut cmd);
|
|
|
|
let seen = positions(&stdout, ["Oldest", "Middle", "Newest"]);
|
|
assert!(seen[0] < seen[1] && seen[1] < seen[2], "{status}: {stdout}");
|
|
|
|
// The overview lists the same columns, so it has to agree with the narrowed
|
|
// listing rather than falling back to priority for the same tickets.
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path()).arg("ls");
|
|
let overview = get_stdout(&mut cmd);
|
|
|
|
let seen = positions(&overview, ["Oldest", "Middle", "Newest"]);
|
|
assert!(seen[0] < seen[1] && seen[1] < seen[2], "{status} overview: {overview}");
|
|
}
|
|
}
|
|
|
|
/// Done reads like a changelog: what just landed is at the top. The p1 that finished
|
|
/// first is at the bottom, which is the whole point of the column not being priority.
|
|
#[test]
|
|
fn ls_orders_done_by_the_newest_entry_stamp() {
|
|
let temp = TempDir::new().unwrap();
|
|
let worklane = setup_worklane(&temp);
|
|
|
|
let at = |n: u8| format!("bbbb000{n}-0000-0000-0000-000000000001");
|
|
create_stamped_ticket(&worklane, "done", "First", &at(1), "1", Some("2026-08-01 09:00:00"));
|
|
create_stamped_ticket(&worklane, "done", "Last", &at(2), "5", Some("2026-08-03 09:00:00"));
|
|
create_stamped_ticket(&worklane, "done", "Middle", &at(3), "1", Some("2026-08-02 09:00:00"));
|
|
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path()).args(["ls", "done"]);
|
|
let stdout = get_stdout(&mut cmd);
|
|
|
|
let seen = positions(&stdout, ["Last", "Middle", "First"]);
|
|
assert!(seen[0] < seen[1] && seen[1] < seen[2], "{stdout}");
|
|
}
|
|
|
|
/// The backlog has no entry stamp, so the due date is its clock and the soonest deadline
|
|
/// heads the column. The p1 here is due last and is listed last, which is exactly what
|
|
/// priority alone got wrong.
|
|
#[test]
|
|
fn ls_orders_the_backlog_by_the_soonest_due_date() {
|
|
let temp = TempDir::new().unwrap();
|
|
let worklane = setup_worklane(&temp);
|
|
|
|
let at = |n: u8| format!("dddd000{n}-0000-0000-0000-000000000001");
|
|
create_due_ticket(&worklane, "Soonest", &at(1), "5", "2026-09-01");
|
|
create_due_ticket(&worklane, "Latest", &at(2), "1", "2026-09-03");
|
|
create_due_ticket(&worklane, "Between", &at(3), "3", "2026-09-02");
|
|
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path()).args(["ls", "backlog"]);
|
|
let stdout = get_stdout(&mut cmd);
|
|
|
|
let seen = positions(&stdout, ["Soonest", "Between", "Latest"]);
|
|
assert!(seen[0] < seen[1] && seen[1] < seen[2], "{stdout}");
|
|
|
|
// The overview lists the same column, so it has to agree with the narrowed listing
|
|
// rather than falling back to priority for the same tickets.
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path()).arg("ls");
|
|
let overview = get_stdout(&mut cmd);
|
|
|
|
let seen = positions(&overview, ["Soonest", "Between", "Latest"]);
|
|
assert!(seen[0] < seen[1] && seen[1] < seen[2], "{overview}");
|
|
}
|
|
|
|
/// A due nobody promised must not outrank one somebody did. The undated ticket here is
|
|
/// the most urgent of the three and still trails both, and among the dated ones the
|
|
/// equal due falls through to priority.
|
|
#[test]
|
|
fn ls_sinks_an_undated_backlog_ticket_below_the_dated_ones() {
|
|
let temp = TempDir::new().unwrap();
|
|
let worklane = setup_worklane(&temp);
|
|
|
|
let at = |n: u8| format!("eeee000{n}-0000-0000-0000-000000000001");
|
|
create_due_ticket(&worklane, "Undated", &at(1), "1", "_Not set_");
|
|
create_due_ticket(&worklane, "Urgent", &at(2), "3", "2026-09-01");
|
|
create_due_ticket(&worklane, "Relaxed", &at(3), "5", "2026-09-01");
|
|
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path()).args(["ls", "backlog"]);
|
|
let stdout = get_stdout(&mut cmd);
|
|
|
|
let seen = positions(&stdout, ["Urgent", "Relaxed", "Undated"]);
|
|
assert!(seen[0] < seen[1] && seen[1] < seen[2], "{stdout}");
|
|
}
|
|
|
|
/// A missing stamp is unknown, not ancient, so it sinks below every stamped ticket
|
|
/// rather than claiming the head of the queue. Every ticket on a board older than the
|
|
/// stamps is one of these.
|
|
#[test]
|
|
fn ls_sinks_an_unstamped_ticket_below_the_stamped_ones() {
|
|
let temp = TempDir::new().unwrap();
|
|
let worklane = setup_worklane(&temp);
|
|
|
|
let at = |n: u8| format!("cccc000{n}-0000-0000-0000-000000000001");
|
|
create_stamped_ticket(&worklane, "committed", "Unstamped", &at(1), "1", None);
|
|
create_stamped_ticket(
|
|
&worklane,
|
|
"committed",
|
|
"Waited",
|
|
&at(2),
|
|
"5",
|
|
Some("2026-08-01 09:00:00"),
|
|
);
|
|
create_stamped_ticket(
|
|
&worklane,
|
|
"committed",
|
|
"Fresh",
|
|
&at(3),
|
|
"5",
|
|
Some("2026-08-09 09:00:00"),
|
|
);
|
|
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path()).args(["ls", "committed"]);
|
|
let stdout = get_stdout(&mut cmd);
|
|
|
|
let seen = positions(&stdout, ["Waited", "Fresh", "Unstamped"]);
|
|
assert!(seen[0] < seen[1] && seen[1] < seen[2], "{stdout}");
|
|
}
|
|
|
|
/// The two listings are one order. A completion offering candidates in a different
|
|
/// order than the board prints them would make the head of a column mean two things.
|
|
#[test]
|
|
fn ls_ids_prints_the_same_order_the_listing_does() {
|
|
let temp = TempDir::new().unwrap();
|
|
let worklane = setup_worklane(&temp);
|
|
|
|
let at = |n: u8| format!("dddd000{n}-0000-0000-0000-000000000001");
|
|
create_stamped_ticket(
|
|
&worklane,
|
|
"reviewing",
|
|
"Newest",
|
|
&at(1),
|
|
"1",
|
|
Some("2026-08-03 09:00:00"),
|
|
);
|
|
create_stamped_ticket(
|
|
&worklane,
|
|
"reviewing",
|
|
"Oldest",
|
|
&at(2),
|
|
"5",
|
|
Some("2026-08-01 09:00:00"),
|
|
);
|
|
create_stamped_ticket(&worklane, "reviewing", "Unstamped", &at(3), "1", None);
|
|
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path()).args(["ls", "reviewing", "--ids"]);
|
|
let ids = get_stdout(&mut cmd);
|
|
|
|
let titles: Vec<&str> = ids.lines().filter_map(|line| line.split('\t').nth(1)).collect();
|
|
assert_eq!(titles, ["Oldest", "Newest", "Unstamped"], "{ids:?}");
|
|
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path()).args(["ls", "reviewing"]);
|
|
let stdout = get_stdout(&mut cmd);
|
|
|
|
let seen = positions(&stdout, ["Oldest", "Newest", "Unstamped"]);
|
|
assert!(seen[0] < seen[1] && seen[1] < seen[2], "{stdout}");
|
|
}
|
|
|
|
/// Discarded is the other terminal status, so the decorated listing leaves it out the
|
|
/// way it leaves done out: it is counted in the summary and not listed. The positional
|
|
/// and `--ids` still reach it, since a ticket nobody will work still has to be nameable.
|
|
#[test]
|
|
fn ls_hides_discarded_but_counts_and_can_name_it() {
|
|
let temp = TempDir::new().unwrap();
|
|
let worklane = setup_worklane(&temp);
|
|
temp.child(".worklane")
|
|
.child("discarded")
|
|
.create_dir_all()
|
|
.unwrap();
|
|
|
|
create_ticket_with_id(
|
|
&worklane,
|
|
"backlog",
|
|
"Still open",
|
|
"aaaaaaa1-0000-0000-0000-000000000001",
|
|
"bug",
|
|
);
|
|
create_ticket_with_id(
|
|
&worklane,
|
|
"discarded",
|
|
"Abandoned",
|
|
"ccccccc3-0000-0000-0000-000000000003",
|
|
"bug",
|
|
);
|
|
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path()).arg("ls");
|
|
let stdout = get_stdout(&mut cmd);
|
|
assert!(stdout.contains("Still open"), "{stdout}");
|
|
assert!(!stdout.contains("Abandoned"), "discarded was listed: {stdout}");
|
|
assert!(stdout.contains("DISCARDED"), "discarded is not counted: {stdout}");
|
|
|
|
// Nameable both ways, the way done is.
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path()).args(["ls", "--ids"]);
|
|
assert!(get_stdout(&mut cmd).contains("Abandoned"));
|
|
|
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
|
cmd.current_dir(temp.path()).args(["ls", "discarded"]);
|
|
assert!(get_stdout(&mut cmd).contains("Abandoned"));
|
|
}
|