[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] A few cl-lib tests
From: |
Stefan Monnier |
Subject: |
Re: [PATCH] A few cl-lib tests |
Date: |
Sat, 21 Feb 2015 15:18:46 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
> 1. What should be level of compatibility with Common Lisp?
> Should it be as strict as possible (e.g. missing keywords,
> functions vs macros)?
We mostly try to be faithful to the Common Lisp spec, but we don't try
super hard, because the purpose of cl-lib is not to let you run
Common-Lisp code, but to provide CL-style functionality to Elisp.
So, if there's no good reason to be incompatible, we try to be. But if
performance would unduly suffer, or if it's "too much work" we sometimes
stick to something "close enough".
To take a recent example: in the new cl-generic.el code, I provided
a way to change the method-combination, but in an incompatible way,
because I consider that define-method-combination sucks.
> Usually it is a file named in the same way as the tested
> lib with added postfix "tests".
That's right.
> Is it ok to move incorrectly placed tests to correct files?
Yes, of course. There might be disagreement about what is the correct
place, tho ;-)
> +(ert-deftest cl-lib-test-nth-value ()
> + (should (= 1 (cl-nth-value 0 '(1))))
> + (should (null (cl-nth-value 1 '(1))))
> + (should-error (cl-nth-value 0.0 '(1)) :type 'wrong-type-argument)
> + (should-error (cl-nth-value 0 "only lists") :type 'wrong-type-argument))
IIUC, this tests the current broken approximation of "multiple values",
so those tests would likely fail if we were to try and improve the
implementation of multiple values. So I think these tests are wrong.
They should look more like:
(ert-deftest cl-lib-test-nth-value ()
(should (= 1 (cl-nth-value 0 (values 1))))
(should (null (cl-nth-value 1 (values 1))))
(should-error (cl-nth-value 0.0 (values 1)) :type 'wrong-type-argument))
-- Stefan