Changeset 10943


Ignore:
Timestamp:
Oct 3, 2008, 1:34:26 AM (11 years ago)
Author:
gz
Message:

regression tests for duplication definition warnings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/ansi-tests/ccl.lsp

    r10833 r10943  
    55(in-package :cl-test)
    66
     7(defvar *test-source-file-counter* 0)
     8
    79(defun test-source-file (format-string &rest format-args)
    8   (let ((file "temp.dat"))
     10  (let ((file (format nil "temp~s.dat" (incf *test-source-file-counter*))))
    911    (with-open-file (s file :direction :output :if-exists :supersede)
    1012      (apply #'format s format-string format-args)
     
    182184 (defclass ccl.40055-3-class () ())
    183185 (defun ccl.40055-3-cfn () (require-type nil '(or ccl.40055-3-class null)))
    184  (defstruct ccl.40055-3-struct () ())
     186 (defstruct ccl.40055-3-struct)
    185187 (defun ccl.40055-3-rfn () (require-type nil '(or ccl.40055-3-struct null)))")))
    186188      (handler-case
     
    453455        (error (c) c)))
    454456  :no-error)
     457
     458
     459(defun test-dup-warnings (test1 &optional test2)
     460  (let ((warnings nil))
     461    (handler-bind ((warning (lambda (c)
     462                              (let ((msg (format nil "~a" c)))
     463                                (push (if (search "Duplicate" msg :test #'equalp)
     464                                        :duplicate-definition
     465                                        c) warnings)
     466                                (muffle-warning c)))))
     467      (if test2
     468        (with-compilation-unit ()
     469          (test-compile (test-source-file test1) :hide-warnings t)
     470          (test-compile (test-source-file test2) :hide-warnings t))
     471        (test-compile (test-source-file test1 :hide-warnings t))))
     472    warnings))
     473
     474
     475
     476(deftest ccl.41334-1
     477    (test-dup-warnings
     478     "(defun test.ccl-41334-1 (x) x)
     479      (defun test.ccl-41334-1 (x) x)")
     480  (:duplicate-definition))
     481
     482
     483(deftest ccl.41334-2
     484    (test-dup-warnings
     485     "(defmethod test.ccl-41334-2 ((x stream)) x)
     486      (defmethod test.ccl-41334-2 ((x stream)) x)")
     487  (:duplicate-definition))
     488
     489
     490(deftest ccl.41334-3
     491    (test-dup-warnings
     492     "(defmacro test.ccl-41334-3 (x) x)
     493      (defmacro test.ccl-41334-3 (x) x)")
     494  (:duplicate-definition))
     495
     496(deftest ccl.41334-4
     497    (test-dup-warnings
     498     "(defgeneric test.ccl-41334-4 (x))
     499      (defun test.ccl-41334-4 (x) x)")
     500  (:duplicate-definition))
     501
     502
     503(deftest ccl.41334-1a
     504    (test-dup-warnings
     505     "(defun test.ccl-41334-1 (x) x)"
     506     "(defun test.ccl-41334-1 (x) x)")
     507  (:duplicate-definition))
     508
     509
     510(deftest ccl.41334-2a
     511    (test-dup-warnings
     512     "(defmethod test.ccl-41334-2 ((x stream)) x)"
     513     "(defmethod test.ccl-41334-2 ((x stream)) x)")
     514  (:duplicate-definition))
     515
     516
     517(deftest ccl.41334-3a
     518    (test-dup-warnings
     519     "(defmacro test.ccl-41334-3 (x) x)"
     520     "(defmacro test.ccl-41334-3 (x) x)")
     521  (:duplicate-definition))
     522
     523(deftest ccl.41334-4a
     524    (test-dup-warnings
     525     "(defgeneric test.ccl-41334-4 (x &key foo))"
     526     "(defmacro test.ccl-41334-4 (x) x)")
     527  (:duplicate-definition))
     528
     529
     530(deftest ccl.41334-5
     531    (test-dup-warnings
     532     "(defclass test.41334-5 () ((41334-5-slot :accessor test.41334-5-slot)))"
     533     "(defmethod (setf test.41334-5-slot) (v (x test.41334-5)) v)")
     534  (:duplicate-definition))
     535
     536
    455537
    456538
Note: See TracChangeset for help on using the changeset viewer.