refactor(bookspec): the specification lives in its own repository (P13 step 6)
bookspec/ (spec, examples, checker, runner, Lean, GnuCash adapter) moves to https://git.swaits.com/swaits/bookspec, history kept by git subtree split (public home; CC BY 4.0 for spec/ and examples/, MIT OR Apache-2.0 for the code). ledger-core and ledger-package depend on bookspec-checker and bookspec-runner as git dev-dependencies pinned to 74f2853d5f0db0066147c17fed8033cfe3d83a24, and read the examples through bookspec_checker::examples(). just check still runs every example via cargo test --workspace. The pin check against docs/spec/sources and the rules.md id check move into tests/bookspec.rs (they need this repository's files). The accounting is unchanged: no example or rule moved. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HS8WZziDnyxunC23MUxrLp
This commit is contained in:
1 parent
794807ab90
commit
b77a25fd7b
124 files changed
+145
-18081
No files matched your search
@@ -21,6 +21,7 @@ zip = "9.0.1"
|
||||
workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
bookspec-checker = { git = "https://git.swaits.com/swaits/bookspec", rev = "74f2853d5f0db0066147c17fed8033cfe3d83a24" }
|
||||
proptest = "1"
|
||||
tempfile = "3"
|
||||
toml = "1"
|
||||
@@ -2142,18 +2142,19 @@ proptest::proptest! {
|
||||
}
|
||||
}
|
||||
|
||||
/// The bookspec example `bookspec/examples/iif-quickbooks-journal-file.toml`
|
||||
/// The bookspec example `iif-quickbooks-journal-file.toml` (bookspec's `examples/`)
|
||||
/// (P3's accept: each regression test also a bookspec example), its
|
||||
/// expected values derived by hand, against the engine: the example's
|
||||
/// books, built from its setup and events, export the very file and
|
||||
/// changes it says.
|
||||
#[test]
|
||||
fn the_bookspec_iif_example_matches_the_engine() {
|
||||
let path = concat!(
|
||||
env!("CARGO_MANIFEST_DIR"),
|
||||
"/../../bookspec/examples/iif-quickbooks-journal-file.toml"
|
||||
);
|
||||
let spec: toml::Value = toml::from_str(&std::fs::read_to_string(path).unwrap()).unwrap();
|
||||
let text = bookspec_checker::examples()
|
||||
.into_iter()
|
||||
.find(|(name, _)| *name == "iif-quickbooks-journal-file.toml")
|
||||
.expect("the bookspec IIF example")
|
||||
.1;
|
||||
let spec: toml::Value = toml::from_str(text).unwrap();
|
||||
let setup = &spec["setup"];
|
||||
let mut l = Ledger::new(Currency::USD);
|
||||
for a in setup["accounts"].as_array().unwrap() {
|
||||
|
||||
Reference in new issue
Block a user