summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
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")