all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Testing library for C code
@ 2015-10-08 11:36 Przemysław Wojnowski
  2015-10-08 14:44 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Przemysław Wojnowski @ 2015-10-08 11:36 UTC (permalink / raw)
  To: emacs-devel

Hello everybody,

I'm looking at libraries for testing C code and I'm wondering
if it's acceptable to use C++ to write the tests for Emacs' C code?

Simply there are more choices when C++ can be used (for example 
googletest, cppunit).
But if not, then there are C-only options too (for example 
https://cmocka.org/).

The important part is breaking dependencies, which allow
to run tests in isolation. Mocks are standard way do do it.

Thanks,
Przemysław



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Testing library for C code
  2015-10-08 11:36 Testing library for C code Przemysław Wojnowski
@ 2015-10-08 14:44 ` Eli Zaretskii
  2015-10-08 16:43   ` Przemysław Wojnowski
  0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2015-10-08 14:44 UTC (permalink / raw)
  To: Przemysław Wojnowski; +Cc: emacs-devel

> Date: Thu, 08 Oct 2015 13:36:30 +0200
> From: Przemysław Wojnowski <esperanto@cumego.com>
> 
> I'm looking at libraries for testing C code and I'm wondering
> if it's acceptable to use C++ to write the tests for Emacs' C code?
> 
> Simply there are more choices when C++ can be used (for example 
> googletest, cppunit).
> But if not, then there are C-only options too (for example 
> https://cmocka.org/).

In the Free Software world, the person who does the job gets to choose
the tools.  Emacs is no different.

So yes, C++ would be acceptable, IMO, as would any other tool that is
wide spread enough, if they are a good tool for the job.  The only
requirements I'd think we should insist on is (a) if a C++ compiler is
not available, the tests should be skipped without producing errors,
and (b) the tools should be free and portable.

Please note, however, that any dependency on external libraries is in
general a nuisance, however small: people need to install it.  So I
would suggest to show a few examples of tests for Emacs code using
whatever method you'd like to use, so we could see whether these
libraries indeed get us some significant advantages that justify their
use.  Making a scratch/something branch would be a good start.

Thanks.

(Btw, cppunit hints that you are looking for unit-testing frameworks,
which I'm not sure is what we want.)




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Testing library for C code
  2015-10-08 14:44 ` Eli Zaretskii
@ 2015-10-08 16:43   ` Przemysław Wojnowski
  0 siblings, 0 replies; 3+ messages in thread
From: Przemysław Wojnowski @ 2015-10-08 16:43 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

W dniu 08.10.2015 o 16:44, Eli Zaretskii pisze:
> So yes, C++ would be acceptable, IMO, as would any other tool that is
> wide spread enough, if they are a good tool for the job.  The only
> requirements I'd think we should insist on is (a) if a C++ compiler is
> not available, the tests should be skipped without producing errors,
> and (b) the tools should be free and portable.
Ok.

> [...] So I
> would suggest to show a few examples of tests for Emacs code using
> whatever method you'd like to use, so we could see whether these
> libraries indeed get us some significant advantages that justify their
> use.
That is my plan. I just didn't want to spend time on libs that are
automatically excluded, because of language.

>  Making a scratch/something branch would be a good start.
I don't have commit access, but can fork it on GH 
(https://github.com/emacs-mirror/emacs) and will send a link.

> (Btw, cppunit hints that you are looking for unit-testing frameworks,
> which I'm not sure is what we want.)
I haven't used it yet, but not sure what can be against it.

Anyway, I'll write a few tests with different libraries and send a link.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-10-08 16:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-08 11:36 Testing library for C code Przemysław Wojnowski
2015-10-08 14:44 ` Eli Zaretskii
2015-10-08 16:43   ` Przemysław Wojnowski

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.