[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#76446: [PATCH v2 1/5] tests: Move helper and wrapper functions into
From: |
Michael Albinus |
Subject: |
bug#76446: [PATCH v2 1/5] tests: Move helper and wrapper functions into their own file |
Date: |
Sat, 22 Feb 2025 16:56:09 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Morgan Smith <morgan.j.smith@outlook.com> writes:
>> We might be better with
>>
>> --8<---------------cut here---------------start------------->8---
>> @$(EMACS) -Q --batch -L . -L ./test -l $(TESTSOURCE) -f
>> ert-run-tests-batch-and-exit
>> --8<---------------cut here---------------end--------------->8---
>>
>
> I did the '-L ./test' part but I kept the foreach.
>
> Without the foreach the command looks like "... -l file1.el file2.el
> file3.el ..." and emacs only actually loads the first file. The command
> needs to look like "... -l file1.el -l file2.el -l file3.el ..."
My point is, that we have only the make target 'check', which runs all
ert tests located in different files. But I would also like to run only
the tests in, say for example, debbugs-tests.el. So we need an own
target for every *-tests.el file.
>>> --- /dev/null
>>> +++ b/test/debbugs-test-helpers.el
>>> @@ -0,0 +1,146 @@
>>> +(defconst debbugs-test--bug-status-soap-return
>>> +(defconst debbugs-test--bug-status
>>
>> Perhaps we should move these data into an ert-resource file (or two).
>>
>
> I read the info manual and source code pertaining to 'ert-resource' and
> I fail to see any benefit from using it.
Both defconsts contain data. Those data belong into a ressource file,
and shall be read from there. Something like
--8<---------------cut here---------------start------------->8---
;; -*- lisp-data -*-
(((cache_time . 5000) (source . "unknown") (unarchived)
(keywords "patch") (blocks) (pending . "done") (severity . "normal")
(done . "Michael Albinus <michael.albinus@gmx.de>") (location . "archive")
(log_modified . 1689593050) (subject . "[PATCH 0/4] debbugs improvements")
(last_modified . 1689593050) (found) (tags "patch") (package "emacs")
(originator . "Morgan Smith <Morgan.J.Smith@outlook.com>") (archived . t)
(blockedby) (affects) (mergedwith) (summary) (date . 1686745022)
(fixed_versions) (id . 64064) (fixed) (found_date) (forwarded)
(msgid
.
"<DM5PR03MB31632E3A4FE170C62E7D4B0CC55AA@DM5PR03MB3163.namprd03.prod.outlook.com>")
(owner) (found_versions) (fixed_date) (bug_num . 64064)))
--8<---------------cut here---------------end--------------->8---
With this, we could reuse tests with the sam logic, but different data
files. In the future.
> --- /dev/null
> +++ b/test/debbugs-test-helpers.el
> +(defconst debbugs-test--bug-status-soap-return
> + '(((item
> + (key . 64064)
> + (value
> + (package . "emacs") (found_date) (last_modified . 1689593050)
> + (affects) (date . 1686745022) (fixed_versions)
> + (originator . "Morgan Smith <Morgan.J.Smith@outlook.com>")
> + (blocks) (archived . 1) (found) (unarchived) (tags . "patch")
> + (severity . "normal") (location . "archive") (owner) (fixed)
> + (blockedby) (pending . "done") (keywords . "patch") (id . 64064)
> + (found_versions) (mergedwith) (summary) (forwarded)
> + (log_modified . 1689593050)
> + (done . "Michael Albinus <michael.albinus@gmx.de>")
> + (source . "unknown")
> + (msgid
> + .
> "<DM5PR03MB31632E3A4FE170C62E7D4B0CC55AA@DM5PR03MB3163.namprd03.prod.outlook.com>")
> + (bug_num . 64064) (subject . "[PATCH 0/4] debbugs improvements")
> + (fixed_date)))))
> + "Mock result from `soap-invoke' for bug 64064.")
Read from ressource file.
> +(defconst debbugs-test--bug-status
> + '(((cache_time . 5000) (source . "unknown") (unarchived)
> + (keywords "patch") (blocks) (pending . "done") (severity . "normal")
> + (done . "Michael Albinus <michael.albinus@gmx.de>") (location .
> "archive")
> + (log_modified . 1689593050) (subject . "[PATCH 0/4] debbugs
> improvements")
> + (last_modified . 1689593050) (found) (tags "patch") (package "emacs")
> + (originator . "Morgan Smith <Morgan.J.Smith@outlook.com>") (archived .
> t)
> + (blockedby) (affects) (mergedwith) (summary) (date . 1686745022)
> + (fixed_versions) (id . 64064) (fixed) (found_date) (forwarded)
> + (msgid
> + .
> "<DM5PR03MB31632E3A4FE170C62E7D4B0CC55AA@DM5PR03MB3163.namprd03.prod.outlook.com>")
> + (owner) (found_versions) (fixed_date) (bug_num . 64064)))
> + "Mock result from `debbugs-get-status' for bug 64064.")
Read from ressource file.
bug#76446: 0002-tests-Add-tests-for-debbugs-gnu.patch, Michael Albinus, 2025/02/21
bug#76446: 0003-Makefile-Add-target-to-run-checkdoc-on-all-files.patch, Michael Albinus, 2025/02/21