test(core): the adapter runs refused dates, amounts, periods, roles, exports, 1099 years and returns
The bookspec examples now spell the input an engine has to refuse, and the adapter takes each through the real books: - a date past 9999 is refused by `Store::create_entry`'s own `try_create_entry` (DateOutOfRange), and a line past one quadrillion by `add_line` (AmountOutOfRange), each on a rehearsal so a refused entry leaves no draft; - a close whose period partly overlaps another creates it through `Store::create_period` and reads PeriodsOverlap; - `assign_role` is `Store::assign_role`, the journaled command, so a role on a header is refused by `check_assign_role` (ControlAccountMismatch) and the chart stays as it was; - an IIF export with an entry on a receivable and a payable account is refused with BS-format-10's word, which is why `export_iif` keeps its typed error; - a 2027 worksheet is refused through `RuleNotKnown` as `unknown_1099_year`, never guessed; - `return_tin` reads the full number from the real `ledger_vault::Vault` the example's `setup.vault_tins` fills, and the books' own record keeps only the last four. The adapter skips sixteen examples now (three more, each for an option wanderbooks did not pick): allow-partial-overlap, carry-the-last-amount and nowhere. Every one of the 95 it runs passes. Co-Authored-By: DeepSeek V4.1 Flash <noreply@opencode.ai>
This commit is contained in:
1 parent
9c299eb768
commit
7ac1e644b2
11 files changed
+178
-14
No files matched your search
@@ -38,7 +38,12 @@ pub(crate) fn check(b: &Books<'_>, x: &Expect) -> Option<&'static str> {
|
||||
only(
|
||||
x.party.is_some(),
|
||||
"party",
|
||||
&["party_part", "party_totals", "party_tin_last4"],
|
||||
&[
|
||||
"party_part",
|
||||
"party_totals",
|
||||
"party_tin_last4",
|
||||
"return_tin",
|
||||
],
|
||||
);
|
||||
only(x.basis.is_some(), "basis", &["party_totals"]);
|
||||
only(x.payee.is_some(), "payee", &["vendor_1099"]);
|
||||
@@ -65,6 +70,10 @@ pub(crate) fn check(b: &Books<'_>, x: &Expect) -> Option<&'static str> {
|
||||
"add_account",
|
||||
"set_tax_category",
|
||||
"period",
|
||||
"vendor_1099",
|
||||
"iif_lines",
|
||||
"iif_changes",
|
||||
"return_tin",
|
||||
],
|
||||
);
|
||||
if COMMANDS.contains(&q) {
|
||||
@@ -77,12 +86,26 @@ pub(crate) fn check(b: &Books<'_>, x: &Expect) -> Option<&'static str> {
|
||||
check_command(ex, l, x);
|
||||
return None;
|
||||
}
|
||||
// Anything else shows its values; a period may be refused instead.
|
||||
// Anything else shows its values; a period may be refused instead, and
|
||||
// so may a 1099 worksheet, an export and a return (BS-1099-2,
|
||||
// BS-format-10, BS-partner-8). The refusal is the engine's own.
|
||||
assert!(
|
||||
x.refused.is_some() != x.values.as_ref().is_some_and(|v| !v.is_empty()),
|
||||
"{}: {q} expects values (a period: values or refused)",
|
||||
ex.id
|
||||
);
|
||||
if let Some(want) = &x.refused
|
||||
&& matches!(q, "vendor_1099" | "iif_lines" | "iif_changes" | "return_tin")
|
||||
{
|
||||
match b.answer(&x.query()) {
|
||||
Err(r) => assert_eq!(&r.reason, want, "{}: {q} refused ({})", ex.id, r.reason),
|
||||
Ok(v) => panic!("{}: {q} answered {v}, expected refused: {want}", ex.id),
|
||||
}
|
||||
if matches!(q, "iif_lines" | "iif_changes") {
|
||||
check_format_refused(ex, x);
|
||||
}
|
||||
return None;
|
||||
}
|
||||
match q {
|
||||
"period" => check_period(ex, x),
|
||||
"day" => check_day(ex, x),
|
||||
@@ -110,6 +133,7 @@ pub(crate) fn check(b: &Books<'_>, x: &Expect) -> Option<&'static str> {
|
||||
"party_part" => check_party_part(b, x),
|
||||
"party_totals" => check_party_totals(b, x),
|
||||
"party_tin_last4" => check_party_tin_last4(b, x),
|
||||
"return_tin" => check_return_tin(b, x),
|
||||
"project" => check_project(b, x),
|
||||
"aging" => check_aging(b, x),
|
||||
"document_dates" => check_document_dates(b, x),
|
||||
|
||||
Reference in new issue
Block a user