all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: "Przemysław Wojnowski" <esperanto@cumego.com>
Cc: emacs-devel@gnu.org
Subject: Re: [PATCH] A few cl-lib tests
Date: Sat, 21 Feb 2015 15:18:46 -0500	[thread overview]
Message-ID: <jwvlhjrjahu.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <54E7C046.2050908@cumego.com> ("Przemysław Wojnowski"'s message of "Sat, 21 Feb 2015 00:16:22 +0100")

> 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



  reply	other threads:[~2015-02-21 20:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-20 23:16 [PATCH] A few cl-lib tests Przemysław Wojnowski
2015-02-21 20:18 ` Stefan Monnier [this message]
2015-02-21 21:06   ` Drew Adams
2015-02-21 23:24   ` Przemysław Wojnowski
2015-02-22 21:22     ` Przemysław Wojnowski
2015-03-10  2:30     ` Stefan Monnier
2015-03-10  3:19       ` Stefan Monnier
2015-03-10 11:44       ` Przemysław Wojnowski
2015-03-11  0:39         ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvlhjrjahu.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=esperanto@cumego.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.