GNU bug report logs -
#75633
[PATCH] New unit-tests for cl-lib
Previous Next
Reported by: Ahmed Khanzada <me <at> enzu.ru>
Date: Fri, 17 Jan 2025 14:53:01 UTC
Severity: wishlist
Tags: patch
Fixed in version 31.1
Done: "Basil L. Contovounesios" <basil <at> contovou.net>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 75633 in the body.
You can then email your comments to 75633 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75633
; Package
emacs
.
(Fri, 17 Jan 2025 14:53:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Ahmed Khanzada <me <at> enzu.ru>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Fri, 17 Jan 2025 14:53:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Tags: patch
In response to the concerns about cl-lib last year (or was it the year
before that?), I have written new unit tests that cover almost all cl-lib
functions without tests in the cl-lib.el, cl-extra.el, and cl-seq.el
files, with the notable exception of the tree functions. (I'll probably
do those later).
In GNU Emacs 29.4 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.41,
cairo version 1.18.0)
Windowing system distributor 'The X.Org Foundation', version 11.0.12101012
System Description: Guix System
Configured using:
'configure
CONFIG_SHELL=/gnu/store/6nqyia3ra10sgd1ppzk2047ncbzjwhff-bash-minimal-5.1.16/bin/bash
SHELL=/gnu/store/6nqyia3ra10sgd1ppzk2047ncbzjwhff-bash-minimal-5.1.16/bin/bash
--prefix=/gnu/store/i4cnvwb1hm21yd27mwb03hqwd14hck99-emacs-29.4
--enable-fast-install --with-cairo --with-modules
--with-native-compilation=aot --disable-build-details'
[0001-New-unit-tests-for-cl-lib.patch (text/patch, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75633
; Package
emacs
.
(Sat, 18 Jan 2025 11:15:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 75633 <at> debbugs.gnu.org (full text, mbox):
> From: Ahmed Khanzada <me <at> enzu.ru>
> Date: Fri, 17 Jan 2025 09:52:32 -0500
>
> In response to the concerns about cl-lib last year (or was it the year
> before that?), I have written new unit tests that cover almost all cl-lib
> functions without tests in the cl-lib.el, cl-extra.el, and cl-seq.el
> files, with the notable exception of the tree functions. (I'll probably
> do those later).
Thanks, additions to the test suite are always welcome.
I've installed this on the master branch, but I found a couple of
problems with the new tests:
. they use 'oddp' and 'evenp', which don't exist; I replaced them
with 'cl-oddp' and 'cl-evenp' -- if that is incorrect, please
submit followup patches to fix my changes
. cl-seq-tests.el emits warnings when byte compiling it (shown
below); could you please fix those?
ELC lisp/emacs-lisp/cl-seq-tests.elc
In toplevel form:
lisp/emacs-lisp/cl-seq-tests.el:179:6: Warning: value from call to `cl-delete-if' is unused
lisp/emacs-lisp/cl-seq-tests.el:249:49: Warning: Unused lexical argument `n'
lisp/emacs-lisp/cl-seq-tests.el:393:39: Warning: Unused lexical argument `x'
lisp/emacs-lisp/cl-seq-tests.el:395:39: Warning: Unused lexical argument `x'
lisp/emacs-lisp/cl-seq-tests.el:415:43: Warning: Unused lexical argument `x'
lisp/emacs-lisp/cl-seq-tests.el:417:43: Warning: Unused lexical argument `x'
lisp/emacs-lisp/cl-seq-tests.el:491:18: Warning: `cl-sort' on constant list (arg 1)
lisp/emacs-lisp/cl-seq-tests.el:493:18: Warning: `cl-sort' on constant list (arg 1)
lisp/emacs-lisp/cl-seq-tests.el:495:18: Warning: `cl-sort' on constant list (arg 1)
lisp/emacs-lisp/cl-seq-tests.el:497:18: Warning: `cl-sort' on constant list (arg 1)
lisp/emacs-lisp/cl-seq-tests.el:501:18: Warning: `cl-sort' on constant list (arg 1)
lisp/emacs-lisp/cl-seq-tests.el:503:18: Warning: `cl-sort' on constant list (arg 1)
lisp/emacs-lisp/cl-seq-tests.el:505:18: Warning: `cl-sort' on constant list (arg 1)
lisp/emacs-lisp/cl-seq-tests.el:509:18: Warning: `cl-sort' on constant list (arg 1)
lisp/emacs-lisp/cl-seq-tests.el:513:18: Warning: `cl-stable-sort' on constant list (arg 1)
lisp/emacs-lisp/cl-seq-tests.el:515:18: Warning: `cl-stable-sort' on constant list (arg 1)
lisp/emacs-lisp/cl-seq-tests.el:517:18: Warning: `cl-stable-sort' on constant list (arg 1)
lisp/emacs-lisp/cl-seq-tests.el:519:18: Warning: `cl-stable-sort' on constant list (arg 1)
lisp/emacs-lisp/cl-seq-tests.el:523:18: Warning: `cl-stable-sort' on constant list (arg 1)
lisp/emacs-lisp/cl-seq-tests.el:525:18: Warning: `cl-stable-sort' on constant list (arg 1)
lisp/emacs-lisp/cl-seq-tests.el:527:18: Warning: `cl-stable-sort' on constant list (arg 1)
lisp/emacs-lisp/cl-seq-tests.el:531:18: Warning: `cl-stable-sort' on constant list (arg 1)
lisp/emacs-lisp/cl-seq-tests.el:535:18: Warning: `cl-merge' on constant list (arg 2)
lisp/emacs-lisp/cl-seq-tests.el:535:18: Warning: `cl-merge' on constant list (arg 3)
lisp/emacs-lisp/cl-seq-tests.el:537:18: Warning: `cl-merge' on constant list (arg 2)
lisp/emacs-lisp/cl-seq-tests.el:537:18: Warning: `cl-merge' on constant list (arg 3)
lisp/emacs-lisp/cl-seq-tests.el:539:18: Warning: `cl-merge' on constant list (arg 3)
lisp/emacs-lisp/cl-seq-tests.el:541:18: Warning: `cl-merge' on constant list (arg 2)
lisp/emacs-lisp/cl-seq-tests.el:545:18: Warning: `cl-merge' on constant list (arg 2)
lisp/emacs-lisp/cl-seq-tests.el:545:18: Warning: `cl-merge' on constant list (arg 3)
lisp/emacs-lisp/cl-seq-tests.el:549:18: Warning: `cl-merge' on constant list (arg 2)
lisp/emacs-lisp/cl-seq-tests.el:549:18: Warning: `cl-merge' on constant list (arg 3)
lisp/emacs-lisp/cl-seq-tests.el:551:18: Warning: `cl-merge' on constant list (arg 2)
lisp/emacs-lisp/cl-seq-tests.el:551:18: Warning: `cl-merge' on constant list (arg 3)
lisp/emacs-lisp/cl-seq-tests.el:553:18: Warning: `cl-merge' on constant list (arg 2)
lisp/emacs-lisp/cl-seq-tests.el:553:18: Warning: `cl-merge' on constant list (arg 3)
lisp/emacs-lisp/cl-seq-tests.el:555:18: Warning: `cl-merge' on constant list (arg 2)
lisp/emacs-lisp/cl-seq-tests.el:555:18: Warning: `cl-merge' on constant list (arg 3)
lisp/emacs-lisp/cl-seq-tests.el:557:18: Warning: `cl-merge' on constant list (arg 2)
lisp/emacs-lisp/cl-seq-tests.el:557:18: Warning: `cl-merge' on constant list (arg 3)
lisp/emacs-lisp/cl-seq-tests.el:559:18: Warning: `cl-merge' on constant list (arg 2)
lisp/emacs-lisp/cl-seq-tests.el:559:18: Warning: `cl-merge' on constant list (arg 3)
lisp/emacs-lisp/cl-seq-tests.el:589:42: Warning: Unused lexical argument `x'
lisp/emacs-lisp/cl-seq-tests.el:591:42: Warning: Unused lexical argument `x'
lisp/emacs-lisp/cl-seq-tests.el:617:46: Warning: Unused lexical argument `x'
lisp/emacs-lisp/cl-seq-tests.el:779:20: Warning: `cl-nintersection' on constant list (arg 1)
lisp/emacs-lisp/cl-seq-tests.el:779:20: Warning: `cl-nintersection' on constant list (arg 2)
lisp/emacs-lisp/cl-seq-tests.el:785:20: Warning: `cl-nintersection' on constant list (arg 1)
lisp/emacs-lisp/cl-seq-tests.el:785:20: Warning: `cl-nintersection' on constant list (arg 2)
lisp/emacs-lisp/cl-seq-tests.el:791:20: Warning: `cl-nintersection' on constant list (arg 1)
lisp/emacs-lisp/cl-seq-tests.el:791:20: Warning: `cl-nintersection' on constant list (arg 2)
lisp/emacs-lisp/cl-seq-tests.el:797:20: Warning: `cl-nintersection' on constant list (arg 1)
lisp/emacs-lisp/cl-seq-tests.el:797:20: Warning: `cl-nintersection' on constant list (arg 2)
lisp/emacs-lisp/cl-seq-tests.el:803:20: Warning: `cl-nintersection' on constant list (arg 1)
lisp/emacs-lisp/cl-seq-tests.el:803:20: Warning: `cl-nintersection' on constant list (arg 2)
lisp/emacs-lisp/cl-seq-tests.el:809:20: Warning: `cl-nintersection' on constant list (arg 1)
lisp/emacs-lisp/cl-seq-tests.el:809:20: Warning: `cl-nintersection' on constant list (arg 2)
lisp/emacs-lisp/cl-seq-tests.el:815:20: Warning: `cl-nintersection' on constant list (arg 2)
lisp/emacs-lisp/cl-seq-tests.el:849:6: Warning: value from call to `cl-set-difference' is unused
lisp/emacs-lisp/cl-seq-tests.el:856:20: Warning: `cl-nset-difference' on constant list (arg 1)
lisp/emacs-lisp/cl-seq-tests.el:856:20: Warning: `cl-nset-difference' on constant list (arg 2)
lisp/emacs-lisp/cl-seq-tests.el:862:20: Warning: `cl-nset-difference' on constant list (arg 1)
lisp/emacs-lisp/cl-seq-tests.el:868:20: Warning: `cl-nset-difference' on constant list (arg 1)
lisp/emacs-lisp/cl-seq-tests.el:868:20: Warning: `cl-nset-difference' on constant list (arg 2)
lisp/emacs-lisp/cl-seq-tests.el:874:20: Warning: `cl-nset-difference' on constant list (arg 1)
lisp/emacs-lisp/cl-seq-tests.el:874:20: Warning: `cl-nset-difference' on constant list (arg 2)
lisp/emacs-lisp/cl-seq-tests.el:880:20: Warning: `cl-nset-difference' on constant list (arg 1)
lisp/emacs-lisp/cl-seq-tests.el:880:20: Warning: `cl-nset-difference' on constant list (arg 2)
lisp/emacs-lisp/cl-seq-tests.el:886:20: Warning: `cl-nset-difference' on constant list (arg 1)
lisp/emacs-lisp/cl-seq-tests.el:886:20: Warning: `cl-nset-difference' on constant list (arg 2)
lisp/emacs-lisp/cl-seq-tests.el:892:22: Warning: `cl-nset-difference' on constant list (arg 2)
lisp/emacs-lisp/cl-seq-tests.el:902:20: Warning: `cl-nset-difference' on constant list (arg 1)
lisp/emacs-lisp/cl-seq-tests.el:902:20: Warning: `cl-nset-difference' on constant list (arg 2)
lisp/emacs-lisp/cl-seq-tests.el:936:20: Warning: `cl-nset-exclusive-or' on constant list (arg 1)
lisp/emacs-lisp/cl-seq-tests.el:936:20: Warning: `cl-nset-exclusive-or' on constant list (arg 2)
lisp/emacs-lisp/cl-seq-tests.el:942:20: Warning: `cl-nset-exclusive-or' on constant list (arg 1)
lisp/emacs-lisp/cl-seq-tests.el:948:20: Warning: `cl-nset-exclusive-or' on constant list (arg 1)
lisp/emacs-lisp/cl-seq-tests.el:948:20: Warning: `cl-nset-exclusive-or' on constant list (arg 2)
lisp/emacs-lisp/cl-seq-tests.el:954:20: Warning: `cl-nset-exclusive-or' on constant list (arg 1)
lisp/emacs-lisp/cl-seq-tests.el:954:20: Warning: `cl-nset-exclusive-or' on constant list (arg 2)
lisp/emacs-lisp/cl-seq-tests.el:960:20: Warning: `cl-nset-exclusive-or' on constant list (arg 1)
lisp/emacs-lisp/cl-seq-tests.el:960:20: Warning: `cl-nset-exclusive-or' on constant list (arg 2)
lisp/emacs-lisp/cl-seq-tests.el:966:20: Warning: `cl-nset-exclusive-or' on constant list (arg 1)
lisp/emacs-lisp/cl-seq-tests.el:966:20: Warning: `cl-nset-exclusive-or' on constant list (arg 2)
lisp/emacs-lisp/cl-seq-tests.el:972:20: Warning: `cl-nset-exclusive-or' on constant list (arg 1)
lisp/emacs-lisp/cl-seq-tests.el:972:20: Warning: `cl-nset-exclusive-or' on constant list (arg 2)
lisp/emacs-lisp/cl-seq-tests.el:978:20: Warning: `cl-nset-exclusive-or' on constant list (arg 2)
lisp/emacs-lisp/cl-seq-tests.el:988:20: Warning: `cl-nset-exclusive-or' on constant list (arg 1)
lisp/emacs-lisp/cl-seq-tests.el:988:20: Warning: `cl-nset-exclusive-or' on constant list (arg 2)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75633
; Package
emacs
.
(Sat, 18 Jan 2025 14:20:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 75633 <at> debbugs.gnu.org (full text, mbox):
Thanks for catching oddp and evenp, I suppose I must still have an
outdated cl library without the prefix floating in my Emacs
instance. Some packages still use it unfortunately, even after I submit
patches updating them to cl-lib.
Yes, I will look into the cl-seq-tests byecompiling warnings and fix them.
Thank you,
Ahmed
Eli Zaretskii <eliz <at> gnu.org> writes:
>> From: Ahmed Khanzada <me <at> enzu.ru>
>> Date: Fri, 17 Jan 2025 09:52:32 -0500
>>
>> In response to the concerns about cl-lib last year (or was it the year
>> before that?), I have written new unit tests that cover almost all cl-lib
>> functions without tests in the cl-lib.el, cl-extra.el, and cl-seq.el
>> files, with the notable exception of the tree functions. (I'll probably
>> do those later).
>
> Thanks, additions to the test suite are always welcome.
>
> I've installed this on the master branch, but I found a couple of
> problems with the new tests:
>
> . they use 'oddp' and 'evenp', which don't exist; I replaced them
> with 'cl-oddp' and 'cl-evenp' -- if that is incorrect, please
> submit followup patches to fix my changes
> . cl-seq-tests.el emits warnings when byte compiling it (shown
> below); could you please fix those?
>
> ELC lisp/emacs-lisp/cl-seq-tests.elc
>
> In toplevel form:
> lisp/emacs-lisp/cl-seq-tests.el:179:6: Warning: value from call to `cl-delete-if' is unused
> lisp/emacs-lisp/cl-seq-tests.el:249:49: Warning: Unused lexical argument `n'
> lisp/emacs-lisp/cl-seq-tests.el:393:39: Warning: Unused lexical argument `x'
> lisp/emacs-lisp/cl-seq-tests.el:395:39: Warning: Unused lexical argument `x'
> lisp/emacs-lisp/cl-seq-tests.el:415:43: Warning: Unused lexical argument `x'
> lisp/emacs-lisp/cl-seq-tests.el:417:43: Warning: Unused lexical argument `x'
> lisp/emacs-lisp/cl-seq-tests.el:491:18: Warning: `cl-sort' on constant list (arg 1)
>
> lisp/emacs-lisp/cl-seq-tests.el:493:18: Warning: `cl-sort' on constant list (arg 1)
>
> lisp/emacs-lisp/cl-seq-tests.el:495:18: Warning: `cl-sort' on constant list (arg 1)
>
> lisp/emacs-lisp/cl-seq-tests.el:497:18: Warning: `cl-sort' on constant list (arg 1)
>
> lisp/emacs-lisp/cl-seq-tests.el:501:18: Warning: `cl-sort' on constant list (arg 1)
>
> lisp/emacs-lisp/cl-seq-tests.el:503:18: Warning: `cl-sort' on constant list (arg 1)
>
> lisp/emacs-lisp/cl-seq-tests.el:505:18: Warning: `cl-sort' on constant list (arg 1)
>
> lisp/emacs-lisp/cl-seq-tests.el:509:18: Warning: `cl-sort' on constant list (arg 1)
>
> lisp/emacs-lisp/cl-seq-tests.el:513:18: Warning: `cl-stable-sort' on constant list (arg 1)
> lisp/emacs-lisp/cl-seq-tests.el:515:18: Warning: `cl-stable-sort' on constant list (arg 1)
> lisp/emacs-lisp/cl-seq-tests.el:517:18: Warning: `cl-stable-sort' on constant list (arg 1)
> lisp/emacs-lisp/cl-seq-tests.el:519:18: Warning: `cl-stable-sort' on constant list (arg 1)
> lisp/emacs-lisp/cl-seq-tests.el:523:18: Warning: `cl-stable-sort' on constant list (arg 1)
> lisp/emacs-lisp/cl-seq-tests.el:525:18: Warning: `cl-stable-sort' on constant list (arg 1)
> lisp/emacs-lisp/cl-seq-tests.el:527:18: Warning: `cl-stable-sort' on constant list (arg 1)
> lisp/emacs-lisp/cl-seq-tests.el:531:18: Warning: `cl-stable-sort' on constant list (arg 1)
> lisp/emacs-lisp/cl-seq-tests.el:535:18: Warning: `cl-merge' on constant list (arg 2)
> lisp/emacs-lisp/cl-seq-tests.el:535:18: Warning: `cl-merge' on constant list (arg 3)
> lisp/emacs-lisp/cl-seq-tests.el:537:18: Warning: `cl-merge' on constant list (arg 2)
> lisp/emacs-lisp/cl-seq-tests.el:537:18: Warning: `cl-merge' on constant list (arg 3)
> lisp/emacs-lisp/cl-seq-tests.el:539:18: Warning: `cl-merge' on constant list (arg 3)
> lisp/emacs-lisp/cl-seq-tests.el:541:18: Warning: `cl-merge' on constant list (arg 2)
> lisp/emacs-lisp/cl-seq-tests.el:545:18: Warning: `cl-merge' on constant list (arg 2)
> lisp/emacs-lisp/cl-seq-tests.el:545:18: Warning: `cl-merge' on constant list (arg 3)
> lisp/emacs-lisp/cl-seq-tests.el:549:18: Warning: `cl-merge' on constant list (arg 2)
> lisp/emacs-lisp/cl-seq-tests.el:549:18: Warning: `cl-merge' on constant list (arg 3)
> lisp/emacs-lisp/cl-seq-tests.el:551:18: Warning: `cl-merge' on constant list (arg 2)
> lisp/emacs-lisp/cl-seq-tests.el:551:18: Warning: `cl-merge' on constant list (arg 3)
> lisp/emacs-lisp/cl-seq-tests.el:553:18: Warning: `cl-merge' on constant list (arg 2)
> lisp/emacs-lisp/cl-seq-tests.el:553:18: Warning: `cl-merge' on constant list (arg 3)
> lisp/emacs-lisp/cl-seq-tests.el:555:18: Warning: `cl-merge' on constant list (arg 2)
> lisp/emacs-lisp/cl-seq-tests.el:555:18: Warning: `cl-merge' on constant list (arg 3)
> lisp/emacs-lisp/cl-seq-tests.el:557:18: Warning: `cl-merge' on constant list (arg 2)
> lisp/emacs-lisp/cl-seq-tests.el:557:18: Warning: `cl-merge' on constant list (arg 3)
> lisp/emacs-lisp/cl-seq-tests.el:559:18: Warning: `cl-merge' on constant list (arg 2)
> lisp/emacs-lisp/cl-seq-tests.el:559:18: Warning: `cl-merge' on constant list (arg 3)
> lisp/emacs-lisp/cl-seq-tests.el:589:42: Warning: Unused lexical argument `x'
> lisp/emacs-lisp/cl-seq-tests.el:591:42: Warning: Unused lexical argument `x'
> lisp/emacs-lisp/cl-seq-tests.el:617:46: Warning: Unused lexical argument `x'
> lisp/emacs-lisp/cl-seq-tests.el:779:20: Warning: `cl-nintersection' on constant list (arg 1)
> lisp/emacs-lisp/cl-seq-tests.el:779:20: Warning: `cl-nintersection' on constant list (arg 2)
> lisp/emacs-lisp/cl-seq-tests.el:785:20: Warning: `cl-nintersection' on constant list (arg 1)
> lisp/emacs-lisp/cl-seq-tests.el:785:20: Warning: `cl-nintersection' on constant list (arg 2)
> lisp/emacs-lisp/cl-seq-tests.el:791:20: Warning: `cl-nintersection' on constant list (arg 1)
> lisp/emacs-lisp/cl-seq-tests.el:791:20: Warning: `cl-nintersection' on constant list (arg 2)
> lisp/emacs-lisp/cl-seq-tests.el:797:20: Warning: `cl-nintersection' on constant list (arg 1)
> lisp/emacs-lisp/cl-seq-tests.el:797:20: Warning: `cl-nintersection' on constant list (arg 2)
> lisp/emacs-lisp/cl-seq-tests.el:803:20: Warning: `cl-nintersection' on constant list (arg 1)
> lisp/emacs-lisp/cl-seq-tests.el:803:20: Warning: `cl-nintersection' on constant list (arg 2)
> lisp/emacs-lisp/cl-seq-tests.el:809:20: Warning: `cl-nintersection' on constant list (arg 1)
> lisp/emacs-lisp/cl-seq-tests.el:809:20: Warning: `cl-nintersection' on constant list (arg 2)
> lisp/emacs-lisp/cl-seq-tests.el:815:20: Warning: `cl-nintersection' on constant list (arg 2)
> lisp/emacs-lisp/cl-seq-tests.el:849:6: Warning: value from call to `cl-set-difference' is unused
> lisp/emacs-lisp/cl-seq-tests.el:856:20: Warning: `cl-nset-difference' on constant list (arg 1)
> lisp/emacs-lisp/cl-seq-tests.el:856:20: Warning: `cl-nset-difference' on constant list (arg 2)
> lisp/emacs-lisp/cl-seq-tests.el:862:20: Warning: `cl-nset-difference' on constant list (arg 1)
> lisp/emacs-lisp/cl-seq-tests.el:868:20: Warning: `cl-nset-difference' on constant list (arg 1)
> lisp/emacs-lisp/cl-seq-tests.el:868:20: Warning: `cl-nset-difference' on constant list (arg 2)
> lisp/emacs-lisp/cl-seq-tests.el:874:20: Warning: `cl-nset-difference' on constant list (arg 1)
> lisp/emacs-lisp/cl-seq-tests.el:874:20: Warning: `cl-nset-difference' on constant list (arg 2)
> lisp/emacs-lisp/cl-seq-tests.el:880:20: Warning: `cl-nset-difference' on constant list (arg 1)
> lisp/emacs-lisp/cl-seq-tests.el:880:20: Warning: `cl-nset-difference' on constant list (arg 2)
> lisp/emacs-lisp/cl-seq-tests.el:886:20: Warning: `cl-nset-difference' on constant list (arg 1)
> lisp/emacs-lisp/cl-seq-tests.el:886:20: Warning: `cl-nset-difference' on constant list (arg 2)
> lisp/emacs-lisp/cl-seq-tests.el:892:22: Warning: `cl-nset-difference' on constant list (arg 2)
> lisp/emacs-lisp/cl-seq-tests.el:902:20: Warning: `cl-nset-difference' on constant list (arg 1)
> lisp/emacs-lisp/cl-seq-tests.el:902:20: Warning: `cl-nset-difference' on constant list (arg 2)
> lisp/emacs-lisp/cl-seq-tests.el:936:20: Warning: `cl-nset-exclusive-or' on constant list (arg 1)
> lisp/emacs-lisp/cl-seq-tests.el:936:20: Warning: `cl-nset-exclusive-or' on constant list (arg 2)
> lisp/emacs-lisp/cl-seq-tests.el:942:20: Warning: `cl-nset-exclusive-or' on constant list (arg 1)
> lisp/emacs-lisp/cl-seq-tests.el:948:20: Warning: `cl-nset-exclusive-or' on constant list (arg 1)
> lisp/emacs-lisp/cl-seq-tests.el:948:20: Warning: `cl-nset-exclusive-or' on constant list (arg 2)
> lisp/emacs-lisp/cl-seq-tests.el:954:20: Warning: `cl-nset-exclusive-or' on constant list (arg 1)
> lisp/emacs-lisp/cl-seq-tests.el:954:20: Warning: `cl-nset-exclusive-or' on constant list (arg 2)
> lisp/emacs-lisp/cl-seq-tests.el:960:20: Warning: `cl-nset-exclusive-or' on constant list (arg 1)
> lisp/emacs-lisp/cl-seq-tests.el:960:20: Warning: `cl-nset-exclusive-or' on constant list (arg 2)
> lisp/emacs-lisp/cl-seq-tests.el:966:20: Warning: `cl-nset-exclusive-or' on constant list (arg 1)
> lisp/emacs-lisp/cl-seq-tests.el:966:20: Warning: `cl-nset-exclusive-or' on constant list (arg 2)
> lisp/emacs-lisp/cl-seq-tests.el:972:20: Warning: `cl-nset-exclusive-or' on constant list (arg 1)
> lisp/emacs-lisp/cl-seq-tests.el:972:20: Warning: `cl-nset-exclusive-or' on constant list (arg 2)
> lisp/emacs-lisp/cl-seq-tests.el:978:20: Warning: `cl-nset-exclusive-or' on constant list (arg 2)
> lisp/emacs-lisp/cl-seq-tests.el:988:20: Warning: `cl-nset-exclusive-or' on constant list (arg 1)
> lisp/emacs-lisp/cl-seq-tests.el:988:20: Warning: `cl-nset-exclusive-or' on constant list (arg 2)
Severity set to 'wishlist' from 'normal'
Request was from
Stefan Kangas <stefankangas <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Tue, 21 Jan 2025 02:27:03 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75633
; Package
emacs
.
(Sat, 25 Jan 2025 18:54:01 GMT)
Full text and
rfc822 format available.
Message #16 received at 75633 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Ahmed Khanzada [2025-01-17 09:52 -0500] wrote:
> Subject: [PATCH] New unit-tests for cl-lib
Thank you for improving the test suite!
I include some comments, nits, and a patch below.
Ahmed Khanzada [2025-01-18 09:19 -0500] wrote:
> Yes, I will look into the cl-seq-tests byecompiling warnings and fix them.
The warnings drew my attention to several preexisting bugs in
cl-seq-tests.el, with us since bug#24264. For example, none of the
tests using cl-seq--with-side-effects were actually being evaluated.
I thus took the liberty of scrutinising the file a bit closer and attach
the resulting patch.
I would like to apply it if there are no objections; otherwise feel free
to use/adapt it as desired.
> + (should (equal '(2) (cl-remove-if-not 'evenp '(2) :key #'(lambda (x) (- x))))))
^^^^^^^^^^^^^^^^^^^^
AKA #'-.
Also, there is no need to #'-quote lambdas, as they are self-quoting.
> +(ert-deftest cl-delete-if-test ()
> + (let ((list (list 1 2 3 4 5)))
Only used once, and unlike the remaining test cases which use no
variable.
> + (cl-delete-if 'evenp list)
It's more robust to check the return value of deletion functions, rather
than rely on their side effects. This would also pacify the
byte-compiler warning.
> +(ert-deftest cl-delete-if-not-test ()
> + (let ((list (list 1 2 3 4 5)))
Ditto re: gratuitous binding.
> + (let ((result (cl-substitute-if 'x #'(lambda (n) t) '(1 2 3 4 5))))
^^^^^^^^^^^^^^^^
AKA (lambda (_) t)
or #'always.
This would also pacify the byte-compiler.
> + (let ((result (cl-count-if (lambda (x) nil) '(1 2 3 4))))
^^^^^^^^^^^^^^^^
AKA (lambda (_) nil)
or (lambda (_))
or #'ignore.
This would also pacify the byte-compiler.
> +(ert-deftest cl-sort-test ()
> + (let ((result (cl-sort '(3 1 4 1 5 9 2 6 5 3 5) '<)))
cl-sort and cl-stable-sort are documented as being destructive
functions, so it's unsafe to pass them an 'immutable' quoted literal;
for details see (info "(elisp) Mutability").
Passing a fresh list would also pacify the byte-compiler.
> + (let ((result (cl-sort '("banana" "fig" "apple" "kiwi") (lambda (x y) (< (length x) (length y))) :key 'identity)))
This and other lines are slightly long.
> + (let ((result (cl-sort (vector 3 1 4 1 5) '<)))
> + (should (equal result (vector 1 1 3 4 5))))
While the argument to cl-sort ought to be fresh/mutable, its result can
safely be compared to a quoted value such as [1 1 3 4 5].
> +(ert-deftest cl-merge-test ()
> + (let ((result (cl-merge 'list '(1 3 5) '(2 4 6) '<)))
Ditto re: passing a fresh value to cl-merge, which is destructive.
> + (let ((result (cl-member-if #'(lambda (x) (< x 0)) '(1 2 3 4 5))))
^^^^^^^^^^^^^^^^^^^^^^
AKA #'cl-minusp.
> + (let ((result (cl-assoc-if-not #'(lambda (x) (> x 0)) '((1 . "one") (2 . "two") (3 . "three")))))
^^^^^^^^^^^^^^^^^^^^^^
AKA #'cl-plusp.
> + (let ((result (cl-intersection '(1 "two" 3) '(3 "two" 4))))
> + (should (equal result '(3))))
This assumes (not (eql "two" "two")), which I'm not sure can always be
guaranteed in the face of optimisations. I would replace at least one
of the string literals with a fresh one.
> +(ert-deftest cl-nintersection-test ()
> + (let ((list1 '(1 2 3 4))
> + (list2 '(3 4 5 6)))
> + (let ((result (cl-nintersection list1 list2)))
Ditto re: passing fresh values to cl-nintersection, which is a
destructive function.
> + (should (equal list1 '(1 2 3 4)))
> + (should (equal list2 '(3 4 5 6)))))
This seems dubious: list1 and list2 are quoted literals which may have
been modified by side effect.
Besides, the docstring of cl-nintersection (and other destructive
functions) explicitly claims to modify its arguments, so I don't
understand why we would want to check that they remain unmodified.
> + (let ((list1 '(1 "two" 3))
> + (list2 '(3 "two" 4)))
> + (let ((result (cl-nintersection list1 list2)))
Ditto re: assuming (not (eql "two" "two")) always holds.
> + (let ((result (cl-set-difference '((1 . "one") (2 . "two") (3 . "three"))
> + '((1 . "uno") (2 . "dos"))
> + :key 'car)))
Indentation.
> + (let ((list1 '(1 2 3))
> + (list2 '(2 3 4)))
> + (cl-set-difference list1 list2)
> + (should (equal list1 '(1 2 3)))
> + (should (equal list2 '(2 3 4)))))
This assumes that modifying the literal '(1 2 3) in the list1 argument's
value will not also modify the same literal in the subsequent
(equal list1 '(1 2 3)), which I'm not sure is robust in the face of
optimisations (and similarly for list2).
To detect (the absence of) modification, I would use fresh arguments.
It also doesn't hurt to check the return value of cl-set-difference,
which would pacify the byte-compiler.
> +(ert-deftest cl-nset-difference-test ()
> + (let ((list1 '(1 2 3 4))
> + (list2 '(3 4 5 6)))
> + (let ((result (cl-nset-difference list1 list2)))
Ditto re: passing fresh values to cl-nset-difference, which is a
destructive function.
> + (let ((result (cl-set-exclusive-or '(1 2 3 4 5) '(3 4 5 6 7)))
> + (list1 '(1 2 3 4 5))
> + (list2 '(3 4 5 6 7)))
> + (should (equal result '(1 2 6 7)))
> + (should (equal list1 '(1 2 3 4 5)))
> + (should (equal list2 '(3 4 5 6 7)))))
Ditto re: detecting modifications to quoted literals.
More importantly, list1 and list2 are not actually used.
> +(ert-deftest cl-nset-exclusive-or-test ()
> + (let ((list1 '(1 2 3))
> + (list2 '(3 4 5)))
> + (let ((result (cl-nset-exclusive-or list1 list2)))
Ditto re: passing fresh values to cl-nset-exclusive-or, which is a
destructive function.
> +(ert-deftest cl-subsetp-test ()
> + (let ((result (cl-subsetp '(1 2) '(1 2 3 4))))
> + (should (equal result t)))
The docstring of cl-subsetp mentions a 'true' return value, and its
entry in the manual says nothing about the return value.
While 'true' generally means t, in the absence of a stronger indication
I would just accept any non-nil return value here.
> +(ert-deftest cl-lib-set-difference ()
> +(ert-deftest cl-nset-difference ()
Why are there tests for cl-set-difference and cl-nset-difference in both
cl-lib-tests.el and cl-seq-tests.el?
Thanks,
--
Basil
[0001-Fix-cl-seq-tests.el.patch (text/x-diff, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75633
; Package
emacs
.
(Tue, 11 Feb 2025 07:45:02 GMT)
Full text and
rfc822 format available.
Message #19 received at 75633 <at> debbugs.gnu.org (full text, mbox):
"Basil L. Contovounesios" <basil <at> contovou.net> writes:
> I would like to apply it if there are no objections; otherwise feel free
> to use/adapt it as desired.
Thanks for working on this.
Can we please apply your patch now? It would be nice not to have to see
those warnings from the tests.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75633
; Package
emacs
.
(Thu, 13 Feb 2025 18:08:02 GMT)
Full text and
rfc822 format available.
Message #22 received at 75633 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Stefan Kangas [2025-02-10 23:43 -0800] wrote:
> Can we please apply your patch now? It would be nice not to have to see
> those warnings from the tests.
Yes, done:
Fix cl-seq-tests.el
52034675a2e 2025-02-13 18:40:26 +0100
https://git.sv.gnu.org/cgit/emacs.git/commit/?id=52034675a2e
I would also like to apply the attached patch that addresses the
aforementioned duplication and organisation of some cl-lib tests.
WDYT?
Thanks,
--
Basil
[0001-Consolidate-some-cl-lib-tests.patch (text/x-diff, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75633
; Package
emacs
.
(Fri, 14 Feb 2025 05:39:02 GMT)
Full text and
rfc822 format available.
Message #25 received at 75633 <at> debbugs.gnu.org (full text, mbox):
"Basil L. Contovounesios" <basil <at> contovou.net> writes:
> I would also like to apply the attached patch that addresses the
> aforementioned duplication and organisation of some cl-lib tests.
> WDYT?
Based on your description and the commit message, I'd say it makes
sense. I skimmed the patch and nothing immediately stood out to me.
If you think it is good to go, then please install. Thanks in advance.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75633
; Package
emacs
.
(Fri, 14 Feb 2025 14:45:03 GMT)
Full text and
rfc822 format available.
Message #28 received at 75633 <at> debbugs.gnu.org (full text, mbox):
Stefan Kangas [2025-02-13 21:38 -0800] wrote:
> "Basil L. Contovounesios" <basil <at> contovou.net> writes:
>
>> I would also like to apply the attached patch that addresses the
>> aforementioned duplication and organisation of some cl-lib tests.
>> WDYT?
>
> Based on your description and the commit message, I'd say it makes
> sense. I skimmed the patch and nothing immediately stood out to me.
>
> If you think it is good to go, then please install.
Done, thanks.
Consolidate some cl-lib tests
0edf094e54c 2025-02-14 15:42:52 +0100
https://git.sv.gnu.org/cgit/emacs.git/commit/?id=0edf094e54c
--
Basil
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75633
; Package
emacs
.
(Fri, 14 Feb 2025 15:54:01 GMT)
Full text and
rfc822 format available.
Message #31 received at 75633 <at> debbugs.gnu.org (full text, mbox):
"Basil L. Contovounesios" <basil <at> contovou.net> writes:
> Stefan Kangas [2025-02-13 21:38 -0800] wrote:
>
>> "Basil L. Contovounesios" <basil <at> contovou.net> writes:
>>
>>> I would also like to apply the attached patch that addresses the
>>> aforementioned duplication and organisation of some cl-lib tests.
>>> WDYT?
>>
>> Based on your description and the commit message, I'd say it makes
>> sense. I skimmed the patch and nothing immediately stood out to me.
>>
>> If you think it is good to go, then please install.
>
> Done, thanks.
>
> Consolidate some cl-lib tests
> 0edf094e54c 2025-02-14 15:42:52 +0100
> https://git.sv.gnu.org/cgit/emacs.git/commit/?id=0edf094e54c
Thanks, does that mean that we can close this bug?
bug marked as fixed in version 31.1, send any further explanations to
75633 <at> debbugs.gnu.org and Ahmed Khanzada <me <at> enzu.ru>
Request was from
"Basil L. Contovounesios" <basil <at> contovou.net>
to
control <at> debbugs.gnu.org
.
(Fri, 14 Feb 2025 17:03:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75633
; Package
emacs
.
(Fri, 14 Feb 2025 17:03:02 GMT)
Full text and
rfc822 format available.
Message #36 received at 75633-done <at> debbugs.gnu.org (full text, mbox):
close 75633 31.1
quit
Stefan Kangas [2025-02-14 09:53 -0600] wrote:
> "Basil L. Contovounesios" <basil <at> contovou.net> writes:
>> Stefan Kangas [2025-02-13 21:38 -0800] wrote:
>>
>> Consolidate some cl-lib tests
>> 0edf094e54c 2025-02-14 15:42:52 +0100
>> https://git.sv.gnu.org/cgit/emacs.git/commit/?id=0edf094e54c
>
> Thanks, does that mean that we can close this bug?
I think pretty much everything was addressed, so I'd say so.
Ahmed, please feel free to reply here (or submit a new report) when you
get to testing the tree functions, and thanks in advance :).
--
Basil
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 15 Mar 2025 11:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 97 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.