summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJohann Klähn <kljohann@gmail.com>2012-10-13 15:17:09 +0200
committerJohn Wiegley <johnw@newartisans.com>2012-10-18 13:45:40 -0700
commit49b02614a39ad86bb499df8b410232a5948247d7 (patch)
tree691f32be90eec67bc7131d41dbc11026e9726f6f /test
parent0d90de44b62274ae761b8d81c754f2c78cd44f56 (diff)
downloadfork-ledger-49b02614a39ad86bb499df8b410232a5948247d7.tar.gz
fork-ledger-49b02614a39ad86bb499df8b410232a5948247d7.tar.bz2
fork-ledger-49b02614a39ad86bb499df8b410232a5948247d7.zip
fix account mapping in csv conversion
By using payees_for_unknown_accounts instead of account_mappings in csv.cc ledger will have the same behaviour as in `ledger -f - print` in that it uses payee fields in account directives to rewrite the account.
Diffstat (limited to 'test')
-rw-r--r--test/baseline/feat-convert-with-diretives.dat3
-rw-r--r--test/baseline/feat-convert-with-diretives.test28
2 files changed, 31 insertions, 0 deletions
diff --git a/test/baseline/feat-convert-with-diretives.dat b/test/baseline/feat-convert-with-diretives.dat
new file mode 100644
index 00000000..ac13ff81
--- /dev/null
+++ b/test/baseline/feat-convert-with-diretives.dat
@@ -0,0 +1,3 @@
+date,payee,amount
+2012/01/01,KFC,$10
+2012/01/02,"REWE SAGT DANKE 123454321",10€
diff --git a/test/baseline/feat-convert-with-diretives.test b/test/baseline/feat-convert-with-diretives.test
new file mode 100644
index 00000000..2f6e0102
--- /dev/null
+++ b/test/baseline/feat-convert-with-diretives.test
@@ -0,0 +1,28 @@
+account Expenses:Food
+ payee KFC
+ payee REWE
+
+payee REWE
+ alias REWE SAGT DANKE
+
+# When reading csv file without directives:
+test -f /dev/null convert test/baseline/feat-convert-with-diretives.dat
+2012/01/01 * KFC
+ Expenses:Unknown $10
+ Equity:Unknown
+
+2012/01/02 * REWE SAGT DANKE 123454321
+ Expenses:Unknown 10€
+ Equity:Unknown
+end test
+
+# When reading csv file with directives:
+test --account "Assets:Cash" convert test/baseline/feat-convert-with-diretives.dat
+2012/01/01 * KFC
+ Expenses:Food $10
+ Assets:Cash
+
+2012/01/02 * REWE
+ Expenses:Food 10€
+ Assets:Cash
+end test