test(cli): split-date and axis naming nothing are refused (improvise-tpm8)
This commit is contained in:
committed by
Edward Langley
parent
ec9747cc0e
commit
053699b652
@@ -666,6 +666,40 @@ fn a_headless_date_import_splits_when_told_to() {
|
||||
assert!(doc.contains("2024-01-15"), "the raw dates stay: {doc}");
|
||||
}
|
||||
|
||||
/// improvise-8jk6.3 review: a `--split-date` that names nothing splittable
|
||||
/// said nothing and exited 0.
|
||||
#[test]
|
||||
fn split_date_naming_an_unknown_or_non_date_field_is_refused() {
|
||||
let scratch = Scratch::new("split_date_unknown");
|
||||
for field in ["Nope", "Revenue"] {
|
||||
let out_path = scratch.path("out.improv");
|
||||
let out = run_import(
|
||||
&dated_csv(&scratch),
|
||||
&out_path,
|
||||
&["--extract", "Date:Month", "--split-date", field],
|
||||
);
|
||||
assert!(!out.status.success(), "{field}: {}", stderr_of(&out));
|
||||
let err = stderr_of(&out);
|
||||
assert!(err.contains("--split-date") && err.contains(field), "{err}");
|
||||
}
|
||||
}
|
||||
|
||||
/// improvise-8jk6.3 review: `--axis Date_Month:column` names a category the
|
||||
/// hierarchical import no longer builds, and was dropped without a word.
|
||||
#[test]
|
||||
fn an_axis_naming_a_category_the_import_did_not_build_is_refused() {
|
||||
let scratch = Scratch::new("axis_unknown");
|
||||
let out_path = scratch.path("out.improv");
|
||||
let out = run_import(
|
||||
&dated_csv(&scratch),
|
||||
&out_path,
|
||||
&["--extract", "Date:Month", "--axis", "Date_Month:column"],
|
||||
);
|
||||
assert!(!out.status.success(), "{}", stderr_of(&out));
|
||||
let err = stderr_of(&out);
|
||||
assert!(err.contains("Date_Month") && err.contains("--split-date"), "{err}");
|
||||
}
|
||||
|
||||
/// code-maat's reports: three schemas, a stray note, and room for the output.
|
||||
fn code_maat_folder(scratch: &Scratch) -> PathBuf {
|
||||
let dir = scratch.path("maat");
|
||||
|
||||
Reference in New Issue
Block a user