forked from joaotavora/sly-stepper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.lisp
111 lines (64 loc) · 1.85 KB
/
test.lisp
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
(defpackage :slepper-tests (:use :cl))
(in-package :slepper-tests)
(in-package :slynk-slepper)
(defun bla ()
(loop repeat 3
do (+ (* 2 3)
(* 4 5))))
(defun blo ()
(function-call
(if foo
bar
baz)))
(defun teste-restarts ()
(format t
(restart-case
(error "bla")
(foo ()
:test (lambda (c)
(format t "~&Checking restart FOO for condition ~a~%" c)
(force-output)
t)))))
;; problem! the atom HMM gets incorrectly stickered
(lambda ()
(let ((hmm (progn
(if thingy
foo
bar))))
hmm
aha))
(format t
(restart-case
(error "bla")
(foo ()
:test shiiz)))
(lambda () (if (foo) (bar) (shod))) ;; OK
(lambda () (if (foo) (bar) (quux (quuz (quuf))))) ;; OK
(defun coiso () (cond ((foo) (bar)) (t (shod))))
(defmacro tricky-maybe (form) `(when bla ,(copy-list form)))
(defmacro maybe (form) `(when (zerop (random 2)) ,form))
(defmacro tricky-maybe (form) `(when (zerop (random 2)) ,(copy-list form)))
(lambda (x) (if (maybe (minusp x)) (- x) x))
(lambda (x) (if (tricky-maybe (minusp x)) (- x) x))
(let ((foo (bar))) (quux))
(let ((foo (bar))) (quux) foo)
(let ((bla b) (+ b b)))
(return (foo))
(delete 'cond agnostic-lizard::*hardwired-operators*)
(lambda () (cond ((foo) (bar)) ((baz) (quux)) (t 42)))
(lambda () (frobnicate foo bar))
(loop repeat (foo) do (bar))
(lambda () (cons #1=(foo 42) . (#1#)))
(lambda () (let ((x (foo))) x))
(lambda (x) x)
(slepper
"")
(defun bla ()
(+ 42 42))
(lambda () (loop for x in (foo) collect x))
;; => ((:FORM (- X) :SOURCE (24 . 29)) (:FORM (MINUSP X) :SOURCE (12 . 22)))
(slepper
"(if (tricky (minusp x)) (- x) x)")
;; => ((:FORM (- X) :SOURCE (24 . 29)))
(defun my-abs (x)
(if (tricky (minusp x)) (- x) x))