Add tests for libgnucash/scm/utilities.scm functions
- tests for list<->vec
- tests for gnc:substring-replace
- tests for gnc:substring-replace-from-to
The latter confirms that the comment before the function definition
is *incorrect* - it describes that substring-replace-from-to will
start from the 2nd substring for the first substitution, and
performs 2 substitutions. However the comment illustrates only 1
substitution. The test suite performs the test according to code
behaviour, rather than the comment. This issue is moot in practice
because the end-after is always called with negative in the code
base.
original comment:
;; gnc:substring-replace-from-to
;; same as gnc:substring-replace extended by:
;; start: from which occurrence onwards the replacement shall start
;; end-after: max. number times the replacement should executed
;;
;; Example: (gnc:substring-replace-from-to "foobarfoobarfoobar" "bar" "xyz" 2 2)
;; returns "foobarfooxyzfoobar".
When exporting transactions to CSV not all were showing up in the CSV
file. This was due to the start and end dates not being set to the
'start of day' and 'end of day' respectively. Also if you had specified
a range and subsequently used the 'Show All' button the dates used
would still be the ones used for the range.
The 'Category Description' scroll window height was not able to be
changed to see all the text without scrolling. Add the 'Categories' and
the 'Category Description' scroll windows to a vertical paned widget.
When testing for a MS Windows path which has a ":", a gvfs path with the
format '/run/user/1000/gvfs/smb-share:server=192.168.1.11,share=public/
test-xml-file.gnucash' is recognised as a Windows path. To avoid this
expand the test to ":/" and also ":\"
On Windows boost::filesystem::path's string() produces a string
that goes out of scope with the function in which it's called, so
returning its c_str() ptr yields freed memory, usually full of garbage.
This has an interesting side effect in gnc-file.c's check_file_path():
Since the memory is freed, g_path_get_dirname() reuses it after an
iteration or two, writing its result into the same address. The
following strcmp naturally returns 0 because it's comparing two
instances of the same ptr, so check_file_path falsely reports that
the proposed save path is in GNC_USERDATA_DIR.
Error in guile code. Using (case var (datum ...)) means that datum are
symbols, so if datum is (GNC-INVOICE-VEND-INVOICE) it would try
(eqv? type 'GNC-INVOICE-VEND-INVOICE) which would never be true. We
need (eqv? type GNC-INVOICE-VEND-INVOICE). Using (cond) is more
appropriate here.
The Transaction Association path head was being displayed with '%20' as
the space as it was not being unescaped. Fixed by unescaping and also
noticed that the error message string were wrong also.