Merge branch 'main' into t3/coverage-gap-tests-v-d2

This commit is contained in:
swaits committed 2026-11-09 05:07:33 -07:00
commit 5fd382450b
100 files changed
+1793 -374

No files matched your search

+3 -4
View File
@@ -1,5 +1,4 @@
//! Documents through the store, at random (BS-arap-2 INVARIANTS 1, 2,
//! 4 and 6; plan P4b.15): histories of invoices, bills, payments (with a
//! Documents through the store, at random (BS-arap-2 invariants 1, 2, 3, 6, 7 and 9; plan P4b.15): histories of invoices, bills, payments (with a
//! payment method and a reference, or none), voids, reversals of any
//! entry, closed months and refused hand lines, run through `Store`, then
//! replayed (the books reopened) and read by a `Snapshot`.
@@ -9,7 +8,7 @@
//! the live books, their replay and a viewer's snapshot agree on
//! every figure, at every date, and the control accounts equal
//! their documents.
//! SOURCE: BS-entry-4 (replay), BS-arap-2 INVARIANTS 1, 2, 4, 6.
//! SOURCE: BS-entry-4 (replay), BS-arap-2 invariants 1, 2, 3, 6, 7 and 9.
//! ```
use chrono::NaiveDate;
@@ -417,7 +416,7 @@ fn agree(live: &Ledger, dir: &Path, docs: &[DocRef]) -> Result<(), TestCaseError
proptest! {
#![proptest_config(ProptestConfig::with_cases(32))]
/// BS-arap-2 INVARIANT 4 (and 1, 2, 6 through the store): a document's
/// BS-arap-2 invariant 7 (and 1, 6, 9 through the store): a document's
/// state is a function of the journal and the day. Half the history,
/// then the books reopened and compared; the rest on the reopened
/// books, compared again.
+7 -8
View File
@@ -377,7 +377,7 @@ fn legacy_reversal_now_counts() {
assert_eq!(trial_balance_json(&again), g["trial_balance"]);
}
/// BS-arap-2 scenario 5 and item 7 in books an earlier version keeps: the
/// BS-arap-2 scenario 5 and WB-arap-4 in books an earlier version keeps: the
/// right payment after the wrong one was reversed waits for the journal
/// feature document_standing (an older version would count both),
/// refused and journaling nothing until the owner's upgrade; a payment
@@ -831,7 +831,7 @@ fn no_new_fields_journals_byte_for_byte() {
}
/// The issued copy is filed with the invoice or nothing is (plan P4b S4.3
/// item 11, A-7; BS-arap-4 item 3): a refusal leaves the journal, the
/// item 11, A-7; BS-arap-4 invariant 3 and WB-arap-8): a refusal leaves the journal, the
/// ledger and the allocators exactly as they were; an issue journals the
/// entry, `invoice.created`, `receipt.attached` on that entry
/// (`INV-0007.pdf`, `application/pdf`, "Issued invoice") and
@@ -1247,8 +1247,7 @@ fn mark_sent_on_void_refused() {
/// A settlement of two invoices, a discount and a processor's fee: one
/// entry whose events name the lines they tag, every figure derived, and
/// the books replaying to the same lines (plan P4b S6; BS-arap-6
/// INVARIANTS 1 and 3).
/// the books replaying to the same lines (plan P4b S6; BS-arap-6 invariant 3 and WB-arap-15).
#[test]
fn a_settlement_names_its_lines_and_replays() {
use ledger_core::{Application, DocRef, Fee, SettleParams};
@@ -1422,7 +1421,7 @@ fn settlement_waits_for_documents_v2() {
/// Legacy payment events carry no `line`, so replay keeps the positional
/// rule: the first untagged control line for the payment's amount, in the
/// order the events come (plan P4b S6; BS-arap-6 INVARIANT 3).
/// order the events come (plan P4b S6; WB-arap-15).
#[test]
fn legacy_payment_events_keep_the_positional_rule() {
use ledger_core::{DocRef, Movement};
@@ -1582,7 +1581,7 @@ fn write_off_waits_for_documents_v2() {
/// A write-off is journaled as its entry and one `invoice.written_off`,
/// and replay derives the same figures and the projection agrees: the
/// invoice reads Written off, the bad-debt expense is on 6990, and the
/// control account still equals its documents (BS-arap-5, BS-arap-2 INVARIANT 1).
/// control account still equals its documents (BS-arap-5, BS-arap-2 invariant 1).
#[test]
fn write_off_replays_and_projects() {
let dir = test_dir("write-off-replay");
@@ -1600,7 +1599,7 @@ fn write_off_replays_and_projects() {
)
.unwrap();
// Half paid, the rest written off: the invoice reads Written off with
// 50 paid and 50 written off (BS-arap-2 SCENARIO 7).
// 50 paid and 50 written off (BS-arap-2 scenario 7).
s.receive_payment(inv, d(2026, 4, 20), cents(5_000), bank)
.unwrap();
let from = journal_len(&dir.0);
@@ -1683,7 +1682,7 @@ fn write_off_replays_and_projects() {
s.verify().unwrap();
}
/// No evidence, no write-off (BS-arap-5 INVARIANT 1; Treas. Reg.
/// No evidence, no write-off (BS-arap-5 statement 10; Treas. Reg.
/// §1.166-2(a)): refused, journaling nothing; an attachment already filed
/// is linked instead, to the entry and the invoice.
#[test]
+1 -1
View File
@@ -1175,7 +1175,7 @@ fn reversing_a_linked_acquisition_still_opens_and_verifies() {
Store::open(&dir).unwrap().verify().unwrap();
}
// ------------------------------------------------- depreciation runs (BS-asset-1 rules 6 and 8)
// ------------------------------------------------- depreciation runs (BS-asset-1 statements 14 and 28)
/// A run is the books' record of what they carry for an asset
/// (Ledger::accumulated_posted): recorded live, replayed from the journal,
@@ -1,4 +1,4 @@
//! An invoice's or bill's lines in the journal (BS-statement-5 item 8,
//! An invoice's or bill's lines in the journal (BS-statement-5 statement 6,
//! BS-format-1): a line naming its project carries `class_id` (journal feature
//! `document_line_projects`), and the entry's revenue or expense line for
//! that project is tagged by `entry.line_class_set` right after its
@@ -9,7 +9,7 @@
//! ```text
//! GOAL: a document's projects are journaled once, replay exactly, and
//! never reach books whose owner hasn't consented to the format.
//! SOURCE: BS-statement-5 item 8, BS-format-1, BS-entry-4; plan/served.md
//! SOURCE: BS-statement-5 statement 6, BS-format-1, BS-entry-4; plan/served.md
//! D-39 (the owner's upgrade).
//! ```
+1 -1
View File
@@ -2636,7 +2636,7 @@ fn every_figure_of(l: &ledger_core::Ledger) -> (usize, usize) {
tally(reports::general_ledger(l, start, end).map(|_| ()));
tally(reports::members_equity(l, start, end, &members).map(|_| ()));
// The statement of cash flows foots on every book, or is refused
// for a reason: never an engine error (BS-statement-3 rule 9).
// for a reason: never an engine error (BS-statement-3 statement 14).
let cf = reports::cash_flow(
l,
&reports::CashFlowParams {