-
Notifications
You must be signed in to change notification settings - Fork 796
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 797163 - qof_book_get_option segfaults when retrieving a non-leaf…
… frame returns a KvpFrame into a nested list of pairs returns a KvpValue GLIST into a list
- Loading branch information
1 parent
0c4d438
commit 1c79918
Showing
3 changed files
with
114 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
(use-modules (srfi srfi-64)) | ||
(use-modules (tests srfi64-extras)) | ||
(use-modules (gnucash engine)) | ||
(use-modules (gnucash app-utils)) | ||
|
||
(define (run-test) | ||
(test-runner-factory gnc:test-runner) | ||
(test-begin "test-app-utils") | ||
(test-kvp-access) | ||
(test-end "test-app-utils")) | ||
|
||
(define (setup book) | ||
(qof-book-set-option book "bla" '("top" "lvl1a")) | ||
(qof-book-set-option book "arg" '("top" "lvl1b")) | ||
(qof-book-set-option book "baf" '("top" "lvl1c" "lvl2" "lvl3"))) | ||
|
||
(define (teardown) | ||
(gnc-clear-current-session)) | ||
|
||
(define (test-kvp-access) | ||
(define book (gnc-get-current-book)) | ||
(test-begin "kvp-access from guile") | ||
|
||
(setup book) | ||
|
||
(test-equal "top/lvl1a" | ||
"bla" | ||
(qof-book-get-option book '("top" "lvl1a"))) | ||
|
||
(test-equal "top/lvl1b" | ||
"arg" | ||
(qof-book-get-option book '("top" "lvl1b"))) | ||
|
||
(test-equal "top/lvl1c/lvl2/lvl3" | ||
"baf" | ||
(qof-book-get-option book '("top" "lvl1c" "lvl2" "lvl3"))) | ||
|
||
(test-equal "top/lvl1c/lvl2" | ||
'(("lvl3" . "baf")) | ||
(qof-book-get-option book '("top" "lvl1c" "lvl2"))) | ||
|
||
(test-equal "top/lvl1c" | ||
'(("lvl2" ("lvl3" . "baf"))) | ||
(qof-book-get-option book '("top" "lvl1c"))) | ||
|
||
;; this tests the reading & writing of KvpFrame, copying branch | ||
;; from top/lvl1c to top/lvl1d | ||
(qof-book-set-option book | ||
(qof-book-get-option book '("top" "lvl1c")) | ||
'("top" "lvl1d")) | ||
|
||
(test-equal "top/lvl1d, after copying from top/lvl1c" | ||
'(("lvl2" ("lvl3" . "baf"))) | ||
(qof-book-get-option book '("top" "lvl1d"))) | ||
|
||
(test-equal "top/lvl1c/lvl2/error" | ||
#f | ||
(qof-book-get-option book '("top" "lvl1c" "lvl2" "error"))) | ||
|
||
(test-end "kvp-access from guile") | ||
(teardown)) |