Generate and pretty print a random ledger
Dependencies
- [2]
37UTZL2GAlign signs within one column - [3]
ILUKKAPNImplement Arbitrary for core data types behind a feature flag - [4]
SJ6AFVZLremove const configuration in favor of runtime config - [5]
5S4MZHL5pretty print decimals using icu - [6]
QRIJE4AQadd a simple pretty printer for beancount directives - [7]
2JBFREZGenable additional warnings - [8]
HMWEY23DMove core data types back into beancount-types - [9]
HNSHOQVHImplement Directive with enum_dispatch - [10]
KBSTC23NClean up testing using new builder methods on types - [11]
XQHYMSDYAdd importer for Union Investment transactions - [12]
E2DDQ4MXDefine inheritable lints configuration - [13]
MDRERLJHUpgrade dependencies - [14]
R7S2CWF7Add type for account segments - [15]
72AIO2FZUpgrade dependencies - [16]
ONRIF4V7add basic snapshot test for pretty printer - [17]
NSWL54NMallow deriving pretty printing config from a set of directives - [18]
SLTVZLYXUpgrade dependencies - [19]
ND7GASJ4track current column position when writing - [20]
A35XMWPSRestructure workspace - [21]
GUNI4ZUIuse larger numbers in test - [22]
4W4CDACXUpgrade dependencies - [*]
YDK6X6PPadd a library of important types for beancount - [*]
UESS5YZEmigrate dependencies into workspace manifest - [*]
6MR76MLLReplace build script with cargo-px - [*]
I2P2FTLEadd basic parser for german decimals - [*]
UO34MAAGRefactor CSV-based Importers - [*]
2Z4EGCWQUpdate dependencies - [*]
HFKQ4E7IUpgrade dependencies
Change contents
- edit in beancount/types/Cargo.toml at line 39
- edit in beancount/pretty-printer/tests/snapshotting.rs at line 3
use arbitrary::Arbitrary as _;use arbitrary::Unstructured; - replacement in beancount/pretty-printer/tests/snapshotting.rs at line 7[4.105]→[4.105:196](∅→∅),[4.196]→[4.81396:81428](∅→∅),[4.81428]→[4.226:260](∅→∅),[4.226]→[4.226:260](∅→∅),[4.308]→[4.308:338](∅→∅),[4.338]→[4.0:43](∅→∅)
use beancount_types::Account;use beancount_types::Amount;use beancount_types::Commodity;use beancount_types::Directive;use beancount_types::Transaction;use rust_decimal_macros::dec;use tap::Tap as _;use time::macros::date;use rand::prelude::RngCore as _;use rand::SeedableRng as _;use testresult::TestResult; - replacement in beancount/pretty-printer/tests/snapshotting.rs at line 12[4.347]→[4.347:381](∅→∅),[4.381]→[4.44:83](∅→∅),[4.83]→[4.83:433](∅→∅),[4.433]→[2.56:247](∅→∅),[2.247]→[4.433:732](∅→∅),[4.433]→[4.433:732](∅→∅)
fn pretty_printed_transaction() {let directives = [Directive::from(Transaction::on(date!(2022 - 03 - 07)).tap_mut(|transaction| {let commodity = Commodity::try_from("EUR").unwrap();transaction.build_posting(Account::try_from("Assets:Checking").unwrap(), |posting| {posting.set_amount(Amount::new(dec!(-10000.00), commodity));}).build_posting(Account::try_from("Assets:Investment").unwrap(), |posting| {posting.set_amount(Amount::new(dec!(-3000.00), commodity));}).build_posting(Account::try_from("Assets:Wallet").unwrap(), |posting| {posting.set_amount(Amount::new(dec!(9000.00), commodity));}).build_posting(Account::try_from("Expenses:Banking:Fees").unwrap(), |_| {});}),)];fn pretty_print_full_ledger() -> TestResult {const RNG_SEED: [u8; 32] = [63, 207, 120, 21, 179, 129, 192, 241, 29, 100, 39, 165, 125, 38, 239, 72, 43, 102, 215, 22,64, 154, 60, 220, 200, 112, 167, 114, 20, 119, 166, 85,];const ARBITRARY_SEED_SIZE: usize = 2 << 10;const PRINTER_BUFFER_SIZE: usize = 1024;let mut rng = rand::rngs::SmallRng::from_seed(RNG_SEED);let mut buffer = [0; ARBITRARY_SEED_SIZE];rng.fill_bytes(&mut buffer);let mut u = Unstructured::new(&buffer);let directives: Vec<_> = <_>::arbitrary(&mut u)?; - replacement in beancount/pretty-printer/tests/snapshotting.rs at line 28
let mut buffer = Vec::with_capacity(1_024);let mut buffer = Vec::with_capacity(PRINTER_BUFFER_SIZE); - replacement in beancount/pretty-printer/tests/snapshotting.rs at line 31
printer.print_directives(&directives).unwrap();printer.print_directives(&directives)?; - replacement in beancount/pretty-printer/tests/snapshotting.rs at line 34
insta::assert_snapshot!(formatted)insta::assert_snapshot!(formatted);Ok(()) - file deletion: snapshotting__pretty_printed_transaction.snap
---source: common/beancount-pretty-printer/tests/snapshotting.rsexpression: formatted---2022-03-07 *Assets:Checking -10,000.00 EURAssets:Wallet 9,000.00 EURExpenses:Banking:FeesAssets:Investment - 3,000.00 EUR - file addition: snapshotting__pretty_print_full_ledger.snap[4.1703]
---source: beancount/pretty-printer/tests/snapshotting.rsexpression: formatted----3888-04-27 * ""1755-03-22 close Assets:Y4su4NuttnC:4XBPpxfNc5F9tci-Z99X:EunhF8F7ohnYMbRpBthqxIESGNjUBj:XSo35AQQ:22CfeSTBZBMr3W1740-09-14 close Expenses:ELCGOeoBh8T6MggNJYhjLUl0V53JpA - replacement in beancount/pretty-printer/Cargo.toml at line 21
beancount-types.path = "../types"beancount-types.workspace = true - edit in beancount/pretty-printer/Cargo.toml at line 40
arbitrary.workspace = true - edit in beancount/pretty-printer/Cargo.toml at line 42
rand.workspace = true - edit in beancount/pretty-printer/Cargo.toml at line 45
testresult.workspace = true - edit in beancount/pretty-printer/Cargo.toml at line 47[26.2348]
[dev-dependencies.beancount-types]features = ["arbitrary"]workspace = true - edit in Cargo.toml at line 78
testresult = "0.4.0" - edit in Cargo.toml at line 132
[workspace.dependencies.rand]features = ["small_rng"]version = "0.8.5" - edit in Cargo.lock at line 443
"arbitrary", - edit in Cargo.lock at line 454
"rand", - edit in Cargo.lock at line 460[29.492][30.1735]
"testresult", - edit in Cargo.lock at line 3119
"arbitrary", - edit in Cargo.lock at line 3692
[[package]]name = "testresult"version = "0.4.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "d72e255c0541f86589b0287139b70bd941a197ea4cea8fd8f87afe9c965a99e4" - edit in Cargo.lock at line 5015
[[package]] - resolve order conflict in Cargo.lock at line 5015[4.106038]