File: use-value.lsp

package info (click to toggle)
cl-ansi-tests 20071218-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 7,000 kB
  • ctags: 22,025
  • sloc: lisp: 134,798; makefile: 144
file content (53 lines) | stat: -rw-r--r-- 1,243 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Sun Mar 23 09:13:59 2003
;;;; Contains: Tests for USE-VALUE restart and function

(in-package :cl-test)

(deftest use-value.1
  (restart-case
   (progn (use-value 10) 'bad)
   (use-value (x) (list x 'good)))
  (10 good))

(deftest use-value.2
  (let ((c1 (make-condition 'error))
	(c2 (make-condition 'error)))
    (restart-case
     (with-condition-restarts
      c1
      (list (first (compute-restarts)))
      (use-value 17 c2))
     (use-value (x) (list x 'bad))
     (use-value (x) (list x 'good))))
  (17 good))

(deftest use-value.3
  (restart-case
   (progn (use-value 11 nil) 'bad)
   (use-value (x) (list x 'good)))
  (11 good))

(deftest use-value.4
  (let ((c1 (make-condition 'error))
	(c2 (make-condition 'error)))
    (restart-case
     (with-condition-restarts
      c1
      (list (first (compute-restarts)))
      (use-value 18 nil))
     (use-value (x) (list x 'good))
     (use-value (x) (list x 'bad))))
  (18 good))

(deftest use-value.5
  (let ((c1 (make-condition 'error))
	(c2 (make-condition 'error)))
     (with-condition-restarts
      c1
      (compute-restarts)
      ;; All conditions are now associated with c1
      (use-value 21 c2)))
  nil)