diff --git a/test.scm b/test.scm index 67689a4..c223887 100644 --- a/test.scm +++ b/test.scm @@ -199,4 +199,17 @@ (define get-solution (?- (zebra ? ?water-drinker ?zebra-owner))) (define solution (get-solution)) (assert-equal 'norwegian (assq-ref solution '?water-drinker)) - (assert-equal 'japanese (assq-ref solution '?zebra-owner)))) + (assert-equal 'japanese (assq-ref solution '?zebra-owner))) + (define-test "with-db" + (define my-db '()) + (define get-solution #f) + (define solution #f) + (with-db my-db + (<- (foo bar))) + (set! get-solution (?- (foo ?x))) + (set! solution (get-solution)) + (assert-equal #f (assq-ref solution '?x)) + (with-db my-db + (set! get-solution (?- (foo ?x))) + (set! solution (get-solution))) + (assert-equal 'bar (assq-ref solution '?x))))