gnucash maint: Add scheme backward compatibility functions renamed in #979

Christopher Lam clam at code.gnucash.org
Fri Apr 23 09:21:40 EDT 2021


Updated	 via  https://github.com/Gnucash/gnucash/commit/5957b3c2 (commit)
	from  https://github.com/Gnucash/gnucash/commit/49102c7a (commit)



commit 5957b3c256628e64eeab97d33ea038253e5d9445
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Fri Apr 23 17:48:12 2021 +0800

    Add scheme backward compatibility functions renamed in #979

diff --git a/bindings/guile/engine.scm b/bindings/guile/engine.scm
index 18656abed..bc75b8172 100644
--- a/bindings/guile/engine.scm
+++ b/bindings/guile/engine.scm
@@ -31,11 +31,21 @@
                    (gnucash engine commodity-table)
                    (gnucash engine gnc-numeric))
 
+(export gnc-pricedb-lookup-latest-before-t64)
+(export gnc-pricedb-lookup-latest-before-any-currency-t64)
 (export gnc:account-map-descendants)
 (export gnc:account-map-children)
 (export account-full-name<?)
 (export accounts-get-children-depth)
 
+(define (gnc-pricedb-lookup-latest-before-t64 . args)
+  (issue-deprecation-warning "gnc-pricedb-lookup-latest-before-t64 has been renamed to gnc-pricedb-lookup-nearest-before-t64")
+  (apply gnc-pricedb-lookup-nearest-before-t64 args))
+
+(define (gnc-pricedb-lookup-latest-before-any-currency-t64 . args)
+  (issue-deprecation-warning "gnc-pricedb-lookup-latest-before-any-currency-t64 has been renamed to gnc-pricedb-lookup-nearest-before-any-currency-t64")
+  (apply gnc-pricedb-lookup-nearest-before-any-currency-t64 args))
+
 ;; A few account related utility functions which used to be in engine-utilities.scm
 (define (gnc:account-map-descendants thunk account)
   (issue-deprecation-warning "gnc:account-map-descendants is deprecated.")
diff --git a/bindings/guile/test/CMakeLists.txt b/bindings/guile/test/CMakeLists.txt
index 9382136c9..9033bad3d 100644
--- a/bindings/guile/test/CMakeLists.txt
+++ b/bindings/guile/test/CMakeLists.txt
@@ -71,6 +71,7 @@ if (HAVE_SRFI64)
 
     set (scm_tests_with_srfi64_SOURCES
         test-business-core.scm
+        test-scm-engine.scm
         )
 
     gnc_add_scheme_test_targets (scm-test-with-srfi64
diff --git a/bindings/guile/test/test-scm-engine.scm b/bindings/guile/test/test-scm-engine.scm
new file mode 100644
index 000000000..85f7f028f
--- /dev/null
+++ b/bindings/guile/test/test-scm-engine.scm
@@ -0,0 +1,20 @@
+(use-modules (srfi srfi-64))
+(use-modules (tests srfi64-extras))
+(use-modules (gnucash engine))
+
+(define (run-test)
+  (test-runner-factory gnc:test-runner)
+  (test-begin "test-engine")
+  (test-engine)
+  (test-end "test-engine"))
+
+(define (test-engine)
+  (test-begin "testing function availability")
+
+  (test-assert "testing gnc-pricedb-lookup-latest-before-t64"
+    (gnc-pricedb-lookup-latest-before-t64 '() '() '() 0))
+
+  (test-assert "testing gnc-pricedb-lookup-latest-before-any-currency-t64"
+    (gnc-pricedb-lookup-latest-before-any-currency-t64 '() '() 0))
+
+  (test-end "testing deprecated functions"))



Summary of changes:
 bindings/guile/engine.scm               | 10 ++++++++++
 bindings/guile/test/CMakeLists.txt      |  1 +
 bindings/guile/test/test-scm-engine.scm | 20 ++++++++++++++++++++
 3 files changed, 31 insertions(+)
 create mode 100644 bindings/guile/test/test-scm-engine.scm



More information about the gnucash-changes mailing list