gnucash maint: Multiple changes pushed
Christopher Lam
clam at code.gnucash.org
Tue Feb 26 07:52:08 EST 2019
Updated via https://github.com/Gnucash/gnucash/commit/548ee9f5 (commit)
via https://github.com/Gnucash/gnucash/commit/c6b7338f (commit)
from https://github.com/Gnucash/gnucash/commit/d980bb50 (commit)
commit 548ee9f56b25244d0b706ea85f79b3285d7ca9ae
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Tue Feb 26 19:45:29 2019 +0800
[test-report-system] tests functions instead of returned values
Previous tests for report definition had modified report.scm to return
bool #f to signify 'aborted definition'. This had mistakenly
invalidated an old-report handling code path whereby guid was missing.
This commit will modify old tests to define reports, and verify
success/failure according to the (gnc:all-report-template-guids) list
length which, indirectly, is a surrogate marker for a successful
report definition.
diff --git a/gnucash/report/report-system/test/test-report-system.scm b/gnucash/report/report-system/test/test-report-system.scm
index a820a5ed9..090854b70 100644
--- a/gnucash/report/report-system/test/test-report-system.scm
+++ b/gnucash/report/report-system/test/test-report-system.scm
@@ -12,75 +12,88 @@
(test-begin "Testing/Temporary/test-report-system")
;; if (test-runner-factory gnc:test-runner) is commented out, this
;; will create Testing/Temporary/test-asset-performance.log
- (test-assert "Minimum Report Definition" (test-check1))
- (test-assert "Missing GUID detection" (test-check2))
- (test-assert "Detect double GUID" (test-check3))
- (test-assert "Report with Full Argument Set" (test-check4))
+ (test-check1)
+ (test-check2)
+ (test-check3)
+ (test-check4)
(test-end "Testing/Temporary/test-report-system"))
;; -----------------------------------------------------------------------
(define (test-check1)
+ (display "\n*** Minimum Report Definition\n")
(gnc:define-report 'version "1"
'name "Test Report Template"
- 'report-guid "54c2fc051af64a08ba2334c2e9179e23"))
+ 'report-guid "54c2fc051af64a08ba2334c2e9179e23")
+ (test-equal "1 report successfully defined"
+ 1
+ (length (gnc:all-report-template-guids))))
;; -----------------------------------------------------------------------
(define (test-check2)
- (not (gnc:define-report 'version "1"
- 'name "Test Report Template")))
+ (display "\n*** Missing GUID detection:\n")
+ (gnc:define-report 'version "1"
+ 'name "Test Report Template")
+ (test-equal "2 reports defined, with 1 autogenerated guid"
+ 2
+ (length (gnc:all-report-template-guids))))
;; -----------------------------------------------------------------------
(define (test-check3)
- (not (gnc:define-report 'version "1"
- 'name "Test Report Template"
- 'report-guid "54c2fc051af64a08ba2334c2e9179e23"
- 'parent-type "Parent Type"
- 'options-generator "Options Generator"
- 'renderer "Renderer"
- 'options-cleanup-cb "Options Clean-Up"
- 'options-changed-cb "Options Changed"
- 'in-menu? #f
- 'menu-path "Menu Path"
- 'menu-name "Menu Name"
- 'menu-tip "Menu Tip"
- 'export-types "Export Types"
- 'export-thunk "Export Thunk")))
+ (display "\n*** Detect double GUID\n")
+ (gnc:define-report 'version "1"
+ 'name "Test Report Template"
+ 'report-guid "54c2fc051af64a08ba2334c2e9179e23"
+ 'parent-type "Parent Type"
+ 'options-generator "Options Generator"
+ 'renderer "Renderer"
+ 'options-cleanup-cb "Options Clean-Up"
+ 'options-changed-cb "Options Changed"
+ 'in-menu? #f
+ 'menu-path "Menu Path"
+ 'menu-name "Menu Name"
+ 'menu-tip "Menu Tip"
+ 'export-types "Export Types"
+ 'export-thunk "Export Thunk")
+ (test-equal "still only 2 reports defined"
+ 2
+ (length (gnc:all-report-template-guids))))
;; -----------------------------------------------------------------------
(define (test-check4)
+ (display "\n*** Report with Full Argument Set\n")
(let ((guid "54c2fc051af64a08ba2334c2e9179e24"))
- (and
- (gnc:define-report 'version "1"
- 'name "Test Report Template"
- 'report-guid guid
- 'parent-type "Parent Type"
- 'options-generator "Options Generator"
- 'renderer "Renderer"
- 'options-cleanup-cb "Options Clean-Up"
- 'options-changed-cb "Options Changed"
- 'in-menu? #f
- 'menu-path "Menu Path"
- 'menu-name "Menu Name"
- 'menu-tip "Menu Tip"
- 'export-types "Export Types"
- 'export-thunk "Export Thunk")
- (let ((tmpl (gnc:find-report-template guid)))
- (and
- (string=? (gnc:report-template-version tmpl) "1")
- (string=? (gnc:report-template-name tmpl) "Test Report Template")
- (string=? (gnc:report-template-report-guid tmpl) guid)
- ;; parent type is not exported -> it is used in gnc:make-report
- (string=? (gnc:report-template-options-generator tmpl) "Options Generator")
- (string=? (gnc:report-template-renderer tmpl) "Renderer")
- (string=? (gnc:report-template-options-cleanup-cb tmpl) "Options Clean-Up")
- (string=? (gnc:report-template-options-changed-cb tmpl) "Options Changed")
- (not (gnc:report-template-in-menu? tmpl))
- (string=? (gnc:report-template-menu-path tmpl) "Menu Path")
- (string=? (gnc:report-template-menu-name tmpl) "Menu Name")
- (string=? (gnc:report-template-menu-tip tmpl) "Menu Tip")
- (string=? (gnc:report-template-export-types tmpl) "Export Types")
- (string=? (gnc:report-template-export-thunk tmpl) "Export Thunk"))))))
+ (gnc:define-report 'version "1"
+ 'name "Test Report Template"
+ 'report-guid guid
+ 'parent-type "Parent Type"
+ 'options-generator "Options Generator"
+ 'renderer "Renderer"
+ 'options-cleanup-cb "Options Clean-Up"
+ 'options-changed-cb "Options Changed"
+ 'in-menu? #f
+ 'menu-path "Menu Path"
+ 'menu-name "Menu Name"
+ 'menu-tip "Menu Tip"
+ 'export-types "Export Types"
+ 'export-thunk "Export Thunk")
+ (let ((tmpl (gnc:find-report-template guid)))
+ (test-assert "report properties correctly set"
+ (and
+ (string=? (gnc:report-template-version tmpl) "1")
+ (string=? (gnc:report-template-name tmpl) "Test Report Template")
+ (string=? (gnc:report-template-report-guid tmpl) guid)
+ ;; parent type is not exported -> it is used in gnc:make-report
+ (string=? (gnc:report-template-options-generator tmpl) "Options Generator")
+ (string=? (gnc:report-template-renderer tmpl) "Renderer")
+ (string=? (gnc:report-template-options-cleanup-cb tmpl) "Options Clean-Up")
+ (string=? (gnc:report-template-options-changed-cb tmpl) "Options Changed")
+ (not (gnc:report-template-in-menu? tmpl))
+ (string=? (gnc:report-template-menu-path tmpl) "Menu Path")
+ (string=? (gnc:report-template-menu-name tmpl) "Menu Name")
+ (string=? (gnc:report-template-menu-tip tmpl) "Menu Tip")
+ (string=? (gnc:report-template-export-types tmpl) "Export Types")
+ (string=? (gnc:report-template-export-thunk tmpl) "Export Thunk"))))))
commit c6b7338fbc9a3e577956e9b6cdf0323d92c6dd03
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Sun Feb 24 16:49:59 2019 +0800
[test-report-system] reindent
improve readability of test suite.
diff --git a/gnucash/report/report-system/test/test-report-system.scm b/gnucash/report/report-system/test/test-report-system.scm
index 470365ae5..a820a5ed9 100644
--- a/gnucash/report/report-system/test/test-report-system.scm
+++ b/gnucash/report/report-system/test/test-report-system.scm
@@ -8,70 +8,79 @@
(use-modules (gnucash engine test srfi64-extras))
(define (run-test)
- (test-runner-factory gnc:test-runner)
- (test-begin "Testing/Temporary/test-report-system") ;; if (test-runner-factory gnc:test-runner) is commented out, this
- ;; will create Testing/Temporary/test-asset-performance.log
- (test-assert "Minimum Report Definition" (test-check1))
- (test-assert "Missing GUID detection" (test-check2))
- (test-assert "Detect double GUID" (test-check3))
- (test-assert "Report with Full Argument Set" (test-check4))
- (test-end "Testing/Temporary/test-report-system")
-)
+ (test-runner-factory gnc:test-runner)
+ (test-begin "Testing/Temporary/test-report-system")
+ ;; if (test-runner-factory gnc:test-runner) is commented out, this
+ ;; will create Testing/Temporary/test-asset-performance.log
+ (test-assert "Minimum Report Definition" (test-check1))
+ (test-assert "Missing GUID detection" (test-check2))
+ (test-assert "Detect double GUID" (test-check3))
+ (test-assert "Report with Full Argument Set" (test-check4))
+ (test-end "Testing/Temporary/test-report-system"))
;; -----------------------------------------------------------------------
(define (test-check1)
- (gnc:define-report 'version "1" 'name "Test Report Template" 'report-guid "54c2fc051af64a08ba2334c2e9179e23")
-)
+ (gnc:define-report 'version "1"
+ 'name "Test Report Template"
+ 'report-guid "54c2fc051af64a08ba2334c2e9179e23"))
;; -----------------------------------------------------------------------
(define (test-check2)
- (not (gnc:define-report 'version "1" 'name "Test Report Template"))
-)
+ (not (gnc:define-report 'version "1"
+ 'name "Test Report Template")))
;; -----------------------------------------------------------------------
(define (test-check3)
- (if (not (gnc:define-report 'version "1" 'name "Test Report Template" 'report-guid "54c2fc051af64a08ba2334c2e9179e23" 'parent-type "Parent Type" 'options-generator "Options Generator" 'renderer "Renderer" 'options-cleanup-cb "Options Clean-Up" 'options-changed-cb "Options Changed" 'in-menu? #f 'menu-path "Menu Path" 'menu-name "Menu Name" 'menu-tip "Menu Tip" 'export-types "Export Types" 'export-thunk "Export Thunk"))
- #t
- #f
- )
-)
+ (not (gnc:define-report 'version "1"
+ 'name "Test Report Template"
+ 'report-guid "54c2fc051af64a08ba2334c2e9179e23"
+ 'parent-type "Parent Type"
+ 'options-generator "Options Generator"
+ 'renderer "Renderer"
+ 'options-cleanup-cb "Options Clean-Up"
+ 'options-changed-cb "Options Changed"
+ 'in-menu? #f
+ 'menu-path "Menu Path"
+ 'menu-name "Menu Name"
+ 'menu-tip "Menu Tip"
+ 'export-types "Export Types"
+ 'export-thunk "Export Thunk")))
;; -----------------------------------------------------------------------
(define (test-check4)
- (and
- (gnc:define-report 'version "1"
- 'name "Test Report Template"
- 'report-guid "54c2fc051af64a08ba2334c2e9179e24"
- 'parent-type "Parent Type"
- 'options-generator "Options Generator"
- 'renderer "Renderer"
- 'options-cleanup-cb "Options Clean-Up"
- 'options-changed-cb "Options Changed"
- 'in-menu? #f
- 'menu-path "Menu Path"
- 'menu-name "Menu Name"
- 'menu-tip "Menu Tip"
- 'export-types "Export Types"
- 'export-thunk "Export Thunk"
- )
- (string=? (gnc:report-template-version (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24")) "1")
- (string=? (gnc:report-template-name (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24")) "Test Report Template")
- (string=? (gnc:report-template-report-guid
- (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24")) "54c2fc051af64a08ba2334c2e9179e24")
- ;; parent type is not exported -> it is used in gnc:make-report
- (string=? (gnc:report-template-options-generator (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24")) "Options Generator")
- (string=? (gnc:report-template-renderer (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24")) "Renderer")
- (string=? (gnc:report-template-options-cleanup-cb (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24")) "Options Clean-Up")
- (string=? (gnc:report-template-options-changed-cb (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24")) "Options Changed")
- (not (gnc:report-template-in-menu? (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24")))
- (string=? (gnc:report-template-menu-path (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24")) "Menu Path")
- (string=? (gnc:report-template-menu-name (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24")) "Menu Name")
- (string=? (gnc:report-template-menu-tip (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24")) "Menu Tip")
- (string=? (gnc:report-template-export-types (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24")) "Export Types")
- (string=? (gnc:report-template-export-thunk (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24")) "Export Thunk")
- )
-)
+ (let ((guid "54c2fc051af64a08ba2334c2e9179e24"))
+ (and
+ (gnc:define-report 'version "1"
+ 'name "Test Report Template"
+ 'report-guid guid
+ 'parent-type "Parent Type"
+ 'options-generator "Options Generator"
+ 'renderer "Renderer"
+ 'options-cleanup-cb "Options Clean-Up"
+ 'options-changed-cb "Options Changed"
+ 'in-menu? #f
+ 'menu-path "Menu Path"
+ 'menu-name "Menu Name"
+ 'menu-tip "Menu Tip"
+ 'export-types "Export Types"
+ 'export-thunk "Export Thunk")
+ (let ((tmpl (gnc:find-report-template guid)))
+ (and
+ (string=? (gnc:report-template-version tmpl) "1")
+ (string=? (gnc:report-template-name tmpl) "Test Report Template")
+ (string=? (gnc:report-template-report-guid tmpl) guid)
+ ;; parent type is not exported -> it is used in gnc:make-report
+ (string=? (gnc:report-template-options-generator tmpl) "Options Generator")
+ (string=? (gnc:report-template-renderer tmpl) "Renderer")
+ (string=? (gnc:report-template-options-cleanup-cb tmpl) "Options Clean-Up")
+ (string=? (gnc:report-template-options-changed-cb tmpl) "Options Changed")
+ (not (gnc:report-template-in-menu? tmpl))
+ (string=? (gnc:report-template-menu-path tmpl) "Menu Path")
+ (string=? (gnc:report-template-menu-name tmpl) "Menu Name")
+ (string=? (gnc:report-template-menu-tip tmpl) "Menu Tip")
+ (string=? (gnc:report-template-export-types tmpl) "Export Types")
+ (string=? (gnc:report-template-export-thunk tmpl) "Export Thunk"))))))
Summary of changes:
.../report-system/test/test-report-system.scm | 100 +++++++++++++--------
1 file changed, 61 insertions(+), 39 deletions(-)
More information about the gnucash-changes
mailing list