summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2023-11-23 15:51:52 -0800
committerJohn Wiegley <johnw@newartisans.com>2024-08-05 08:35:56 -0700
commitb8d71b69e05aea46504f5c1a89fe0e16138f1057 (patch)
treeb9bb46a8bd88e4276ed87351f46b1e059636ff98 /test
parenta2df9c48870ee3fb25051c3473476f91e8d467d8 (diff)
downloadfork-ledger-b8d71b69e05aea46504f5c1a89fe0e16138f1057.tar.gz
fork-ledger-b8d71b69e05aea46504f5c1a89fe0e16138f1057.tar.bz2
fork-ledger-b8d71b69e05aea46504f5c1a89fe0e16138f1057.zip
Add positive and negative tests for the --hashes option
Diffstat (limited to 'test')
-rw-r--r--test/baseline/opt-hashes-neg.test23
-rw-r--r--test/baseline/opt-hashes.test28
2 files changed, 51 insertions, 0 deletions
diff --git a/test/baseline/opt-hashes-neg.test b/test/baseline/opt-hashes-neg.test
new file mode 100644
index 00000000..6e0e9164
--- /dev/null
+++ b/test/baseline/opt-hashes-neg.test
@@ -0,0 +1,23 @@
+2008/01/01 January
+ Expenses:Books $10.00
+ Assets:Cash
+
+2008/01/31 End of January
+ Expenses:Books $10.00
+ Assets:Cash
+
+2008/02/01 February
+ ; Hash: f80797304b8d9acb2084772364ee717f0b724cddb1a9ccb6a3fb8d9cb803fe3b9b7a458211a7fe818578b6ec75a1a31acbcf8e2926ea349141568252966189aa
+ Expenses:Books $20.00
+ Assets:Cash
+
+test print --hashes=sha512 -> 1
+__ERROR__
+While parsing file "$FILE", line 12:
+While parsing transaction:
+> 2008/02/01 February
+> ; Hash: f80797304b8d9acb2084772364ee717f0b724cddb1a9ccb6a3fb8d9cb803fe3b9b7a458211a7fe818578b6ec75a1a31acbcf8e2926ea349141568252966189aa
+> Expenses:Books $20.00
+> Assets:Cash
+Error: Expected hash f70797304b8d9acb2084772364ee717f0b724cddb1a9ccb6a3fb8d9cb803fe3b9b7a458211a7fe818578b6ec75a1a31acbcf8e2926ea349141568252966189aa != f80797304b8d9acb2084772364ee717f0b724cddb1a9ccb6a3fb8d9cb803fe3b9b7a458211a7fe818578b6ec75a1a31acbcf8e2926ea349141568252966189aa
+end test
diff --git a/test/baseline/opt-hashes.test b/test/baseline/opt-hashes.test
new file mode 100644
index 00000000..2ce317f0
--- /dev/null
+++ b/test/baseline/opt-hashes.test
@@ -0,0 +1,28 @@
+2008/01/01 January
+ Expenses:Books $10.00
+ Assets:Cash
+
+2008/01/31 End of January
+ Expenses:Books $10.00
+ Assets:Cash
+
+2008/02/01 February
+ Expenses:Books $20.00
+ Assets:Cash
+
+test print --hashes=sha512
+2008/01/01 January
+ ; Hash: e5aed085f0426d610bcbc20855ee4c36611f7c02c4534433164100c3b143fb49fb5190ea97b18eab1b479ef3032325c1887f9150357745f11091675fe71c2a42
+ Expenses:Books $10.00
+ Assets:Cash
+
+2008/01/31 End of January
+ ; Hash: 7e4853202dd22abf6419aa5f2dbdd4113a93e710d271f17f24428a0703b17b9640cae956d1521eb5f51244b53a47755bb3641490385053cc9aadb70255a6a52e
+ Expenses:Books $10.00
+ Assets:Cash
+
+2008/02/01 February
+ ; Hash: f70797304b8d9acb2084772364ee717f0b724cddb1a9ccb6a3fb8d9cb803fe3b9b7a458211a7fe818578b6ec75a1a31acbcf8e2926ea349141568252966189aa
+ Expenses:Books $20.00
+ Assets:Cash
+end test