From 5e1769a49c7e65acedc7781f369da3e138d15b7f Mon Sep 17 00:00:00 2001 From: pfdietz Date: Sun, 12 Dec 2004 23:22:22 +0000 Subject: [PATCH] Some tests for APROPOS --- ansi-tests/apropos.lsp | 59 +++++++++++++++++++++++++++++++++++++++++ ansi-tests/gclload2.lsp | 1 + 2 files changed, 60 insertions(+) create mode 100644 ansi-tests/apropos.lsp diff --git a/ansi-tests/apropos.lsp b/ansi-tests/apropos.lsp new file mode 100644 index 0000000..0f5c07a --- /dev/null +++ b/ansi-tests/apropos.lsp @@ -0,0 +1,59 @@ +;-*- Mode: Lisp -*- +;;;; Author: Paul Dietz +;;;; Created: Sun Dec 12 16:17:47 2004 +;;;; Contains: Tests for APROPOS + +(in-package :cl-test) + +(deftest apropos.1 + (loop for n from 10 + for x = (coerce (loop repeat n collect (random-from-seq +standard-chars+)) 'string) + unless (apropos-list x) + return (with-output-to-string (*standard-output*) + (assert (null (multiple-value-list (apropos x)))))) + "") + +(deftest apropos.2 + (let ((s (with-output-to-string + (*standard-output*) + (assert (null (multiple-value-list (apropos "CAR"))))))) + (notnot (search "CAR" s :test #'string-equal))) + t) + +(deftest apropos.3 + (let ((s (with-output-to-string + (*standard-output*) + (assert (null (multiple-value-list (apropos "CAR" (find-package "CL")))))))) + (notnot (search "CAR" s :test #'string-equal))) + t) + +(deftest apropos.4 + (let ((result nil)) + (do-special-strings + (s "CAR" t) + (setq result (with-output-to-string + (*standard-output*) + (assert (null (multiple-value-list (apropos s)))))) + (assert (search "CAR" result :test #'string-equal)))) + t) + +(deftest apropos.5 + (let ((result nil) + (pkg (find-package "COMMON-LISP"))) + (do-special-strings + (s "APROPOS" t) + (setq result (with-output-to-string + (*standard-output*) + (assert (null (multiple-value-list (apropos s pkg)))))) + (assert (search "APROPOS" result :test #'string-equal)))) + t) + +;;; Error tests + +(deftest apropos.error.1 + (signals-error (apropos) program-error) + t) + +(deftest apropos.error.2 + (signals-error (apropos "SJLJALKSJDKLJASKLDJKLAJDLKJA" (find-package "CL") nil) program-error) + t) diff --git a/ansi-tests/gclload2.lsp b/ansi-tests/gclload2.lsp index fc847e5..03e0795 100644 --- a/ansi-tests/gclload2.lsp +++ b/ansi-tests/gclload2.lsp @@ -68,6 +68,7 @@ (load "load-reader.lsp") ;;; Tests of system construction, environment +(load "apropos.lsp") (load "describe.lsp") (load "disassemble.lsp") (load "environment-functions.lsp") -- GitLab