Skip to content

Commit

Permalink
[reports] don't offer individual coverage tests
Browse files Browse the repository at this point in the history
because there's a new global coverage option in CMake
  • Loading branch information
christopherlam committed Dec 10, 2023
1 parent d8cdf23 commit 699190d
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 141 deletions.
19 changes: 0 additions & 19 deletions gnucash/report/reports/standard/test/test-invoice.scm
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
(use-modules (tests srfi64-extras))
(use-modules (sxml simple))
(use-modules (sxml xpath))
(use-modules (system vm coverage))
(use-modules (system vm vm))

(define uuid-list
(list (cons 'invoice "5123a759ceb9483abf2182d01c140e8d")
Expand All @@ -21,23 +19,6 @@
(setlocale LC_ALL "C")

(define (run-test)
(if #f
(coverage-test run-test-proper)
(run-test-proper)))

(define (coverage-test tester)
(let* ((currfile (dirname (current-filename)))
(path (string-take currfile (string-rindex currfile #\/))))
(add-to-load-path path))
(call-with-values
(lambda()
(with-code-coverage tester))
(lambda (data result)
(let ((port (open-output-file "/tmp/lcov.info")))
(coverage-data->lcov data port)
(close port)))))

(define (run-test-proper)
(test-runner-factory gnc:test-runner)
(test-begin "test-invoice.scm")
(inv-tests 'invoice)
Expand Down
19 changes: 0 additions & 19 deletions gnucash/report/reports/standard/test/test-new-owner-report.scm
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,12 @@
(use-modules (tests srfi64-extras))
(use-modules (sxml simple))
(use-modules (sxml xpath))
(use-modules (system vm coverage))
(use-modules (system vm vm))

(define uuid "c146317be32e4948a561ec7fc89d15c1")

(setlocale LC_ALL "C")

(define (run-test)
(if #f
(coverage-test run-test-proper)
(run-test-proper)))

(define (coverage-test tester)
(let* ((currfile (dirname (current-filename)))
(path (string-take currfile (string-rindex currfile #\/))))
(add-to-load-path path))
(call-with-values
(lambda()
(with-code-coverage tester))
(lambda (data result)
(let ((port (open-output-file "/tmp/lcov.info")))
(coverage-data->lcov data port)
(close port)))))

(define (run-test-proper)
(let ((saved-format (qof-date-format-get)))
(qof-date-format-set QOF-DATE-FORMAT-ISO)
(test-runner-factory gnc:test-runner)
Expand Down
21 changes: 1 addition & 20 deletions gnucash/report/reports/standard/test/test-owner-report.scm
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,16 @@
(use-modules (tests srfi64-extras))
(use-modules (sxml simple))
(use-modules (sxml xpath))
(use-modules (system vm coverage))
(use-modules (system vm vm))

(define uuid-list
(list (cons 'customer-new "c146317be32e4948a561ec7fc89d15c1")))

(setlocale LC_ALL "C")

(define (run-test)
(if #f
(coverage-test run-test-proper)
(run-test-proper)))

(define (coverage-test tester)
(let* ((currfile (dirname (current-filename)))
(path (string-take currfile (string-rindex currfile #\/))))
(add-to-load-path path))
(call-with-values
(lambda()
(with-code-coverage tester))
(lambda (data result)
(let ((port (open-output-file "/tmp/lcov.info")))
(coverage-data->lcov data port)
(close port)))))

(define (teardown)
(gnc-clear-current-session))

(define (run-test-proper)
(define (run-test)
(let ((saved-format (qof-date-format-get)))
(qof-date-format-set QOF-DATE-FORMAT-ISO)
(test-runner-factory gnc:test-runner)
Expand Down
17 changes: 0 additions & 17 deletions gnucash/report/reports/standard/test/test-portfolios.scm
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
(use-modules (tests srfi64-extras))
(use-modules (sxml simple))
(use-modules (sxml xpath))
(use-modules (system vm coverage))
(use-modules (system vm vm))

;; This is implementation testing for both the Portfolio and the
;; Advanced Portfolio Report.
Expand All @@ -23,21 +21,6 @@
(setlocale LC_ALL "C")

(define (run-test)
(if #f
(coverage-test)
(run-test-proper)))

(define (coverage-test)
(let ((currfile (dirname (current-filename))))
(add-to-load-path (string-take currfile (string-rindex currfile #\/))))
(call-with-values
(lambda () (with-code-coverage run-test-proper))
(lambda (data result)
(let ((port (open-output-file "/tmp/lcov.info")))
(coverage-data->lcov data port)
(close port)))))

(define (run-test-proper)
(test-runner-factory gnc:test-runner)
(test-begin "test-portfolios.scm")
(null-test "portfolio" portfolio-uuid)
Expand Down
29 changes: 0 additions & 29 deletions gnucash/report/reports/standard/test/test-transaction.scm
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
(use-modules (tests srfi64-extras))
(use-modules (sxml simple))
(use-modules (sxml xpath))
(use-modules (system vm coverage))
(use-modules (system vm vm))

;; Guide to the test-transaction.scm

Expand All @@ -28,16 +26,6 @@
;; (options->sxml) which in turn generates the transaction report, and
;; dumps the output at /tmp/test-trep-*.html for review.

;; For coverage analysis, please amend (run-test) (if #f ...) to (if
;; #t ...) and this will run (coverage-test) instead, which will
;; generate the coverage report in /tmp/lcov.info -- the latter can be
;; converted to an html report using genhtml from
;; http://ltp.sourceforge.net/coverage/lcov.php

;; Please note the with-code-coverage has changed guile-2.0 to 2.2
;; which does not require specifying the VM; I have no experience
;; running in guile 2.2 and cannot confirm syntax.

;; copied from transaction.scm
(define trep-uuid "2fe3b9833af044abb929a88d5a59620f")
(define reconcile-uuid "e45218c6d76f11e7b5ef0800277ef320")
Expand All @@ -46,23 +34,6 @@
(setlocale LC_ALL "C")

(define (run-test)
(if #f
(coverage-test)
(run-test-proper)))

(define (coverage-test)
(let* ((currfile (dirname (current-filename)))
(path (string-take currfile (string-rindex currfile #\/))))
(add-to-load-path path))
(call-with-values
(lambda()
(with-code-coverage run-test-proper))
(lambda (data result)
(let ((port (open-output-file "/tmp/lcov.info")))
(coverage-data->lcov data port)
(close port)))))

(define (run-test-proper)
(test-runner-factory gnc:test-runner)
(test-begin "transaction.scm")
(null-test)
Expand Down
20 changes: 1 addition & 19 deletions gnucash/report/test/test-commodity-utils.scm
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@
(use-modules (sw_engine))
(use-modules (sw_app_utils))
(use-modules (gnucash report))
(use-modules (system vm coverage))

(setlocale LC_ALL "C")

(define (run-test-proper)
(define (run-test)
(test-runner-factory gnc:test-runner)
(test-begin "commodity-utils")
;; Tests go here
Expand All @@ -50,23 +49,6 @@
(test-weighted-average)
(test-end "commodity-utils"))

(define (coverage-test)
(let* ((currfile (dirname (current-filename)))
(path (string-take currfile (string-rindex currfile #\/))))
(add-to-load-path path))
(call-with-values
(lambda()
(with-code-coverage run-test-proper))
(lambda (data result)
(let ((port (open-output-file "/tmp/lcov.info")))
(coverage-data->lcov data port)
(close port)))))

(define (run-test)
(if #f ;switch to #t to run coverage
(coverage-test)
(run-test-proper)))

(define test-accounts
(list "Root" (list (cons 'type ACCT-TYPE-ROOT))
(list "Assets"(list (cons 'type ACCT-TYPE-ASSET))
Expand Down
18 changes: 0 additions & 18 deletions gnucash/report/test/test-report-html.scm
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,8 @@
(use-modules (tests test-engine-extras))
(use-modules (tests test-report-extras))
(use-modules (tests srfi64-extras))
(use-modules (system vm coverage))

(define (coverage-test)
(let* ((currfile (dirname (current-filename)))
(path (string-take currfile (string-rindex currfile #\/))))
(add-to-load-path path))
(call-with-values
(lambda()
(with-code-coverage run-test-proper))
(lambda (data result)
(let ((port (open-output-file "/tmp/lcov.info")))
(coverage-data->lcov data port)
(close port)))))

(define (run-test)
(if #f
(coverage-test)
(run-test-proper)))

(define (run-test-proper)
(test-runner-factory gnc:test-runner)
(test-begin "Testing/Temporary/test-report-html")
;; if (test-runner-factory gnc:test-runner) is commented out, this
Expand Down

0 comments on commit 699190d

Please sign in to comment.