aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès2009-05-26 18:33:59 +0200
committerLudovic Courtès2009-05-26 18:33:59 +0200
commitce8f50fbd147864d795eb3d4869ce01ed82dcb1a (patch)
treefd60ae735f2406cd6428a9d87999997504618fe6 /tests
parent9a8581b9b056efed763fb6beff15f9d36cf07ee0 (diff)
downloadskribilo-ce8f50fbd147864d795eb3d4869ce01ed82dcb1a.tar.gz
skribilo-ce8f50fbd147864d795eb3d4869ce01ed82dcb1a.tar.lz
skribilo-ce8f50fbd147864d795eb3d4869ce01ed82dcb1a.zip
Fix node binding in sub-documents returned from unresolved nodes.
* src/guile/skribilo/resolve.scm (do-resolve!<unresolved>): Bind sub-nodes of RES in the innermost document rather than in the root document. * tests/resolve.test ("resolved nested document bindings"): New test.
Diffstat (limited to 'tests')
-rw-r--r--tests/resolve.test18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/resolve.test b/tests/resolve.test
index bfbdd27..027b191 100644
--- a/tests/resolve.test
+++ b/tests/resolve.test
@@ -174,6 +174,24 @@
(and (is-markup? x 'chapter)
(eq? (ast-document x) sub))))))
+(test-assert "resolved nested document bindings"
+ ;; Prior to 0.9.2, nodes of a sub-document returned by an `unresolved' node
+ ;; would be bound in the root document.
+ (let* ((doc (document #:title "Doc"
+ (resolve (lambda (n e env)
+ (document #:title "Nested Doc"
+ (chapter #:ident "inner")))))))
+ (resolve! doc %engine '())
+ (and (not (document-lookup-node doc "inner"))
+ (let* ((sub (car (markup-body doc)))
+ (ch (car (markup-body sub)))
+ (x (document-lookup-node sub "inner")))
+ (and (document? sub)
+ (is-markup? x 'chapter)
+ (eq? x ch)
+ (eq? (ast-parent x) sub)
+ (eq? (ast-document x) sub))))))
+
(test-end "resolve")