diff --git a/ansi-tests/defconstant.lsp b/ansi-tests/defconstant.lsp new file mode 100644 index 0000000000000000000000000000000000000000..825226c9561c3735ae9b3c40603a1111c32fe217 --- /dev/null +++ b/ansi-tests/defconstant.lsp @@ -0,0 +1,35 @@ +;-*- Mode: Lisp -*- +;;;; Author: Paul Dietz +;;;; Created: Thu Oct 10 23:05:39 2002 +;;;; Contains: Tests of DEFCONSTANT + +(in-package :cl-test) + +(defconstant test-constant-1 17) + +(deftest defconstant.1 + (symbol-value 'test-constant-1) + 17) + +(deftest defconstant.2 + (not (constantp 'test-constant-1)) + nil) + +(deftest defconstant.3 + (documentation 'test-constant-1 'variable) + nil) + +(defconstant test-constant-2 'a "This is the documentation.") + +(deftest defconstant.4 + (documentation 'test-constant-2 'variable) + "This is the documentation.") + +(deftest defconstant.5 + (defconstant test-constant-3 0) + test-constant-3) + + + + + diff --git a/ansi-tests/defparameter.lsp b/ansi-tests/defparameter.lsp new file mode 100644 index 0000000000000000000000000000000000000000..6b0caac7b6961a71b51fb0b282a349c1f4d07465 --- /dev/null +++ b/ansi-tests/defparameter.lsp @@ -0,0 +1,54 @@ +;-*- Mode: Lisp -*- +;;;; Author: Paul Dietz +;;;; Created: Thu Oct 10 23:13:22 2002 +;;;; Contains: Tests of DEFPARAMETER + +(in-package :cl-test) + +(defparameter *defparameter-test-var-1* 100) + +(deftest defparameter.1 + *defparameter-test-var-1* + 100) + +(deftest defparameter.2 + (documentation '*defparameter-test-var-1* 'variable) + nil) + +;;; Show that it's declared special. +(deftest defparameter.3 + (flet ((%f () *defparameter-test-var-1*)) + (let ((*defparameter-test-var-1* 29)) + (%f))) + 29) + +(deftest defparameter.4 + (values + (makunbound '*defparameter-test-var-2*) + (defparameter *defparameter-test-var-2* 200 "Whatever.") + (documentation '*defparameter-test-var-2* 'variable) + *defparameter-test-var-2*) + *defparameter-test-var-2* + *defparameter-test-var-2* + "Whatever." + 200) + +(deftest defparameter.5 + (values + (makunbound '*defparameter-test-var-2*) + (defparameter *defparameter-test-var-2* 200 "Whatever.") + (documentation '*defparameter-test-var-2* 'variable) + *defparameter-test-var-2* + (defparameter *defparameter-test-var-2* 300 "And ever.") + (documentation '*defparameter-test-var-2* 'variable) + *defparameter-test-var-2* + ) + *defparameter-test-var-2* + *defparameter-test-var-2* + "Whatever." + 200 + *defparameter-test-var-2* + "And ever." + 300) + + diff --git a/ansi-tests/defvar.lsp b/ansi-tests/defvar.lsp new file mode 100644 index 0000000000000000000000000000000000000000..696bdfe32461710a4b9a4ce11541253543bb59eb --- /dev/null +++ b/ansi-tests/defvar.lsp @@ -0,0 +1,55 @@ +;-*- Mode: Lisp -*- +;;;; Author: Paul Dietz +;;;; Created: Thu Oct 10 23:21:50 2002 +;;;; Contains: Tests for DEFVAR + +(in-package :cl-test) + +(defvar *defvar-test-var-1* 100) + +(deftest defvar.1 + *defvar-test-var-1* + 100) + +(deftest defvar.2 + (documentation '*defvar-test-var-1* 'variable) + nil) + +;;; Show that it's declared special. +(deftest defvar.3 + (flet ((%f () *defvar-test-var-1*)) + (let ((*defvar-test-var-1* 29)) + (%f))) + 29) + +(deftest defvar.4 + (values + (makunbound '*defvar-test-var-2*) + (defvar *defvar-test-var-2* 200 "Whatever.") + (documentation '*defvar-test-var-2* 'variable) + *defvar-test-var-2*) + *defvar-test-var-2* + *defvar-test-var-2* + "Whatever." + 200) + +(deftest defvar.5 + (let ((x 0)) + (values + (makunbound '*defvar-test-var-2*) + (defvar *defvar-test-var-2* 200 "Whatever.") + (documentation '*defvar-test-var-2* 'variable) + *defvar-test-var-2* + (defvar *defvar-test-var-2* (incf x) "And ever.") + (documentation '*defvar-test-var-2* 'variable) + *defvar-test-var-2* + x + )) + *defvar-test-var-2* + *defvar-test-var-2* + "Whatever." + 200 + *defvar-test-var-2* + "And ever." + 200 + 0) diff --git a/ansi-tests/destructuring-bind.lsp b/ansi-tests/destructuring-bind.lsp new file mode 100644 index 0000000000000000000000000000000000000000..25fe37a5c1519887aac5fa0c51aa285947159419 --- /dev/null +++ b/ansi-tests/destructuring-bind.lsp @@ -0,0 +1,91 @@ +;-*- Mode: Lisp -*- +;;;; Author: Paul Dietz +;;;; Created: Thu Oct 10 23:25:50 2002 +;;;; Contains: Tests for DESTRUCTURING-BIND + +(in-package :cl-test) + +;;; See the page for this in section 5.3 +;;; Also, see destructuring lambda lists in section 3.4.5 + +(deftest destructuring-bind.1 + (destructuring-bind (x y z) '(a b c) (values x y z)) + a b c) + +(deftest destructuring-bind.2 + (destructuring-bind (x y &rest z) '(a b c d) (values x y z)) + a b (c d)) + +(deftest destructuring-bind.3 + (destructuring-bind (x y &optional z) '(a b c) (values x y z)) + a b c) + +(deftest destructuring-bind.4 + (destructuring-bind (x y &optional z) '(a b) (values x y z)) + a b nil) + +(deftest destructuring-bind.5 + (destructuring-bind (x y &optional (z 'w)) '(a b) (values x y z)) + a b w) + +(deftest destructuring-bind.6 + (destructuring-bind (x y &optional (z 'w z-p)) '(a b) (values x y z z-p)) + a b w nil) + +(deftest destructuring-bind.7 + (destructuring-bind (x y &optional (z 'w z-p)) '(a b c) (values x y z z-p)) + a b c t) + +(deftest destructuring-bind.8 + (destructuring-bind (x y &optional z w) '(a b c) (values x y z w)) + a b c nil) + +(deftest destructuring-bind.9 + (destructuring-bind ((x y)) '((a b)) (values x y)) + a b) + +(deftest destructuring-bind.10 + (destructuring-bind (&whole w (x y)) '((a b)) (values x y w)) + a b ((a b))) + +(deftest destructuring-bind.11 + (destructuring-bind ((x . y) . w) '((a b) c) (values x y w)) + a (b) (c)) + +(deftest destructuring-bind.12 + (destructuring-bind (x y &body z) '(a b c d) (values x y z)) + a b (c d)) + +(deftest destructuring-bind.13 + (destructuring-bind (&whole x y z) '(a b) (values x y z)) + (a b) a b) + +(deftest destructuring-bind.14 + (destructuring-bind (w (&whole x y z)) '(1 (a b)) (values w x y z)) + 1 (a b) a b) + +(deftest destructuring-bind.15 + (destructuring-bind (&key a b c) '(:a 1) (values a b c)) + 1 nil nil) + +(deftest destructuring-bind.16 + (destructuring-bind (&key a b c) '(:b 1) (values a b c)) + nil 1 nil) + +(deftest destructuring-bind.17 + (destructuring-bind (&key a b c) '(:c 1) (values a b c)) + nil nil 1) + +(deftest destructuring-bind.18 + (destructuring-bind ((&key a b c)) '((:c 1 :b 2)) (values a b c)) + nil 2 1) + + + + + + + + + + diff --git a/ansi-tests/gclload2.lsp b/ansi-tests/gclload2.lsp index 61ad81154521c5a18eab830671e14aac1f545715..58053b2f6f027f5d0ea50beacdc32d077d5170d1 100644 --- a/ansi-tests/gclload2.lsp +++ b/ansi-tests/gclload2.lsp @@ -12,6 +12,10 @@ (load "call-arguments-limit.lsp") (load "constantly.lsp") (load "complement.lsp") +(load "defconstant.lsp") +(load "defparameter.lsp") +(load "defvar.lsp") +(load "destructuring-bind.lsp") (load "fboundp.lsp") (load "flet.lsp") (load "fmakunbound.lsp")