mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-30 06:50:31 +02:00
eval.test work
* test-suite/tests/eval.test ("stacks"): Enable another test, fix to use with-throw-handler, and remove a duplicate test, now that there is no difference between subrs and gsubrs.
This commit is contained in:
parent
46d80cae08
commit
7f622b82a2
1 changed files with 42 additions and 70 deletions
|
@ -330,40 +330,13 @@
|
|||
0))
|
||||
|
||||
(with-test-prefix "stacks"
|
||||
(with-debugging-evaluator
|
||||
|
||||
(pass-if "stack involving a subr"
|
||||
;; The subr involving the error must appear exactly once on the stack.
|
||||
(pass-if "stack involving a primitive"
|
||||
;; The primitive involving the error must appear exactly once on the
|
||||
;; stack.
|
||||
(catch 'result
|
||||
(lambda ()
|
||||
(throw 'unresolved)
|
||||
(start-stack 'foo
|
||||
(lazy-catch 'wrong-type-arg
|
||||
(lambda ()
|
||||
;; Trigger a `wrong-type-arg' exception.
|
||||
(fluid-ref 'not-a-fluid))
|
||||
(lambda _
|
||||
(let* ((stack (make-stack #t))
|
||||
(frames (stack->frames stack)))
|
||||
(throw 'result
|
||||
(count (lambda (frame)
|
||||
(and (frame-procedure? frame)
|
||||
(eq? (frame-procedure frame)
|
||||
fluid-ref)))
|
||||
frames)))))))
|
||||
(lambda (key result)
|
||||
(= 1 result))))
|
||||
|
||||
(pass-if "stack involving a gsubr"
|
||||
;; The gsubr involving the error must appear exactly once on the stack.
|
||||
;; This is less obvious since gsubr application may require an
|
||||
;; additional `SCM_APPLY ()' call, which should not be visible to the
|
||||
;; application.
|
||||
(catch 'result
|
||||
(lambda ()
|
||||
(throw 'unresolved)
|
||||
(start-stack 'foo
|
||||
(lazy-catch 'wrong-type-arg
|
||||
(with-throw-handler 'wrong-type-arg
|
||||
(lambda ()
|
||||
;; Trigger a `wrong-type-arg' exception.
|
||||
(hashq-ref 'wrong 'type 'arg))
|
||||
|
@ -372,20 +345,19 @@
|
|||
(frames (stack->frames stack)))
|
||||
(throw 'result
|
||||
(count (lambda (frame)
|
||||
(and (frame-procedure? frame)
|
||||
(eq? (frame-procedure frame)
|
||||
hashq-ref)))
|
||||
hashq-ref))
|
||||
frames)))))))
|
||||
(lambda (key result)
|
||||
(= 1 result))))
|
||||
|
||||
(pass-if "arguments of a gsubr stack frame"
|
||||
;; Create a stack with two gsubr frames and make sure the arguments are
|
||||
;; correct.
|
||||
(pass-if "arguments of a primitive stack frame"
|
||||
;; Create a stack with two primitive frames and make sure the
|
||||
;; arguments are correct.
|
||||
(catch 'result
|
||||
(lambda ()
|
||||
(start-stack 'foo
|
||||
(lazy-catch 'wrong-type-arg
|
||||
(with-throw-handler 'wrong-type-arg
|
||||
(lambda ()
|
||||
;; Trigger a `wrong-type-arg' exception.
|
||||
(substring 'wrong 'type 'arg))
|
||||
|
@ -400,7 +372,7 @@
|
|||
(lambda (key result)
|
||||
(and (equal? (car result) `(,make-stack #t))
|
||||
(pair? (member `(,substring wrong type arg)
|
||||
(cdr result)))))))))
|
||||
(cdr result))))))))
|
||||
|
||||
;;;
|
||||
;;; letrec init evaluation
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue