Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
ansi-test
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michał Herda
ansi-test
Commits
2634960b
Commit
2634960b
authored
20 years ago
by
pfdietz
Browse files
Options
Downloads
Patches
Plain Diff
Error handling of calls to user-defined functions
parent
0de3e0e6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ansi-tests/defun.lsp
+53
-17
53 additions, 17 deletions
ansi-tests/defun.lsp
with
53 additions
and
17 deletions
ansi-tests/defun.lsp
+
53
−
17
View file @
2634960b
...
@@ -5,23 +5,6 @@
...
@@ -5,23 +5,6 @@
(in-package :cl-test)
(in-package :cl-test)
(deftest defun.error.1
(signals-error (funcall (macro-function 'defun))
program-error)
t)
(deftest defun.error.2
(signals-error (funcall (macro-function 'defun)
'(defun nonexistent-function ()))
program-error)
t)
(deftest defun.error.3
(signals-error (funcall (macro-function 'defun)
'(defun nonexistent-function ())
nil nil)
program-error)
t)
;;; Tests for implicit blocks
;;; Tests for implicit blocks
...
@@ -60,3 +43,56 @@
...
@@ -60,3 +43,56 @@
(defun (setf defun-test-fun-4) (newval x)
(defun (setf defun-test-fun-4) (newval x)
(return-from defun-test-fun-4 (setf (car x) newval))))
(return-from defun-test-fun-4 (setf (car x) newval))))
;;; Error tests
(deftest defun.error.1
(signals-error (funcall (macro-function 'defun))
program-error)
t)
(deftest defun.error.2
(signals-error (funcall (macro-function 'defun)
'(defun nonexistent-function ()))
program-error)
t)
(deftest defun.error.3
(signals-error (funcall (macro-function 'defun)
'(defun nonexistent-function ())
nil nil)
program-error)
t)
;;; More comprehensive error handling tests of calls to
;;; user-defined functions
(deftest defun.error.4
(let* ((name (gensym)))
(loop for i below (min 100 lambda-parameters-limit)
for params = nil then (cons (gensym) params)
for args = nil then (cons nil args)
for expected = '(1 2 3)
for fn = (eval `(prog2 (proclaim '(optimize (safety 0)))
(defun ,name ,params (values ,@expected))
(proclaim '(optimize safety))))
when
(cond
((not (equal (multiple-value-list (apply fn args)) expected))
(list i :fail1))
((not (equal (multiple-value-list
(apply (symbol-function fn) args))
expected))
(list i :fail2))
((not (equal (multiple-value-list (eval `(,name ,@args)))
expected))
(list i :fail3))
;; Error cases
((and (> i 0)
(let ((val (eval `(signals-error (,name ,@(cdr args)) program-error))))
(and (not (eq val t)) :fail4))))
((and (< i (1- call-arguments-limit))
(let ((val (eval `(signals-error (,name nil ,@args) program-error))))
(and (not (eq val t)) :fail5)))))
collect it))
nil)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment