[test-report-system] reindent

improve readability of test suite.
This commit is contained in:
Christopher Lam 2019-02-24 16:49:59 +08:00
parent d980bb50f7
commit c6b7338fbc

View File

@ -8,70 +8,79 @@
(use-modules (gnucash engine test srfi64-extras)) (use-modules (gnucash engine test srfi64-extras))
(define (run-test) (define (run-test)
(test-runner-factory gnc:test-runner) (test-runner-factory gnc:test-runner)
(test-begin "Testing/Temporary/test-report-system") ;; if (test-runner-factory gnc:test-runner) is commented out, this (test-begin "Testing/Temporary/test-report-system")
;; will create Testing/Temporary/test-asset-performance.log ;; if (test-runner-factory gnc:test-runner) is commented out, this
(test-assert "Minimum Report Definition" (test-check1)) ;; will create Testing/Temporary/test-asset-performance.log
(test-assert "Missing GUID detection" (test-check2)) (test-assert "Minimum Report Definition" (test-check1))
(test-assert "Detect double GUID" (test-check3)) (test-assert "Missing GUID detection" (test-check2))
(test-assert "Report with Full Argument Set" (test-check4)) (test-assert "Detect double GUID" (test-check3))
(test-end "Testing/Temporary/test-report-system") (test-assert "Report with Full Argument Set" (test-check4))
) (test-end "Testing/Temporary/test-report-system"))
;; ----------------------------------------------------------------------- ;; -----------------------------------------------------------------------
(define (test-check1) (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) (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) (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")) (not (gnc:define-report 'version "1"
#t 'name "Test Report Template"
#f '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) (define (test-check4)
(and (let ((guid "54c2fc051af64a08ba2334c2e9179e24"))
(gnc:define-report 'version "1" (and
'name "Test Report Template" (gnc:define-report 'version "1"
'report-guid "54c2fc051af64a08ba2334c2e9179e24" 'name "Test Report Template"
'parent-type "Parent Type" 'report-guid guid
'options-generator "Options Generator" 'parent-type "Parent Type"
'renderer "Renderer" 'options-generator "Options Generator"
'options-cleanup-cb "Options Clean-Up" 'renderer "Renderer"
'options-changed-cb "Options Changed" 'options-cleanup-cb "Options Clean-Up"
'in-menu? #f 'options-changed-cb "Options Changed"
'menu-path "Menu Path" 'in-menu? #f
'menu-name "Menu Name" 'menu-path "Menu Path"
'menu-tip "Menu Tip" 'menu-name "Menu Name"
'export-types "Export Types" 'menu-tip "Menu Tip"
'export-thunk "Export Thunk" 'export-types "Export Types"
) 'export-thunk "Export Thunk")
(string=? (gnc:report-template-version (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24")) "1") (let ((tmpl (gnc:find-report-template guid)))
(string=? (gnc:report-template-name (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24")) "Test Report Template") (and
(string=? (gnc:report-template-report-guid (string=? (gnc:report-template-version tmpl) "1")
(gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24")) "54c2fc051af64a08ba2334c2e9179e24") (string=? (gnc:report-template-name tmpl) "Test Report Template")
;; parent type is not exported -> it is used in gnc:make-report (string=? (gnc:report-template-report-guid tmpl) guid)
(string=? (gnc:report-template-options-generator (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24")) "Options Generator") ;; parent type is not exported -> it is used in gnc:make-report
(string=? (gnc:report-template-renderer (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24")) "Renderer") (string=? (gnc:report-template-options-generator tmpl) "Options Generator")
(string=? (gnc:report-template-options-cleanup-cb (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24")) "Options Clean-Up") (string=? (gnc:report-template-renderer tmpl) "Renderer")
(string=? (gnc:report-template-options-changed-cb (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24")) "Options Changed") (string=? (gnc:report-template-options-cleanup-cb tmpl) "Options Clean-Up")
(not (gnc:report-template-in-menu? (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24"))) (string=? (gnc:report-template-options-changed-cb tmpl) "Options Changed")
(string=? (gnc:report-template-menu-path (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24")) "Menu Path") (not (gnc:report-template-in-menu? tmpl))
(string=? (gnc:report-template-menu-name (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24")) "Menu Name") (string=? (gnc:report-template-menu-path tmpl) "Menu Path")
(string=? (gnc:report-template-menu-tip (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24")) "Menu Tip") (string=? (gnc:report-template-menu-name tmpl) "Menu Name")
(string=? (gnc:report-template-export-types (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24")) "Export Types") (string=? (gnc:report-template-menu-tip tmpl) "Menu Tip")
(string=? (gnc:report-template-export-thunk (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24")) "Export Thunk") (string=? (gnc:report-template-export-types tmpl) "Export Types")
) (string=? (gnc:report-template-export-thunk tmpl) "Export Thunk"))))))
)