Commit Graph

10 Commits

Author SHA1 Message Date
Geert Janssens
e79e82edcf CMake - remove parameter repetition in else() and endif() statements
This follows Professional CMake's recommended practises
2020-02-05 11:38:14 +01:00
Christopher Lam
a259ba4a3e [utilities] move gnc:html-string-sanitize to utilities.scm 2019-09-22 22:48:07 +08:00
Christopher Lam
0511ce723e [API] gnc:list-flatten flattens lists recursively
and is a schemey algorithm rather than a report algorithm, so, belongs
centrally.
2019-09-21 11:18:26 +08:00
Christopher Lam
273ae720cc [scm-utilities][API] add sort-and-delete-duplicates
this can be used instead of delete-duplicates when the list must also
be sorted.

the main reason for this function will be for the upcoming aging.scm
report which will use it heavily to slice APAR splits into owner list.
2019-07-20 21:10:08 +08:00
Geert Janssens
d4c524a9ef Fix test dependency issue 2019-05-13 20:14:58 +02:00
Christopher Lam
4d529c02cd [libgnucash-scm-utilities] remove unneeded section in CMakeLists 2019-04-27 17:04:02 +08:00
Christopher Lam
0cf49f1244 [test-libgnucash-scm-utilities] amend info to explain comment fix 2019-04-25 11:20:34 +08:00
John Ralls
a12bbaccd3 Create CMakeLists.txt in libgnucash/scm/test.
Amended by chris to add a working scm/test/CMakeLists.txt.
2019-04-25 10:51:20 +08:00
Christopher Lam
92a920c4e0 [test-libgnucash-scm-utilities] renamed from test-utilities.scm 2019-04-25 10:51:20 +08:00
Christopher Lam
d9623b0ad1 [test-utilities] initial commit
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".
2019-04-23 18:52:36 +08:00