emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: unit test framework


From: Nikolaj Schumacher
Subject: Re: unit test framework
Date: Sat, 20 Mar 2010 12:01:45 +0100
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3

On 2010-03-18 15:56 , Lennart Borgman wrote:

>    elk-test: Nikolaj Schumacher

elk-test might look more complicated than it is. Most of the code is for the user interface. The testing framework itself is just a thin wrapper around Emacs' error signaling with better readability.

While
  (assert (equal "yy" foo))
causes
  (cl-assertion-failed (equal "yy" foo))
the macro
  (assert-equal "yy" foo)
will cause the more readable:
  (error "assert-equal for <foo> failed: expected <yy>, was <xx>")

`assert-that' can take care of the formatting for custom tests, and `assert-error' fails when a specific error isn't thrown.

The nice thing about these macros is that they work in any evaluation context. I'd vote to include such macros at the least.

The
  (deftest "test name" ...
macro just provides an name anchor for running individual tests. And the test runner will just catch errors and display them as text, highlight where the error occurred, and mark the buffer as "red". This GUI is more designed for test-driven development than automatic regression tests, but the macros would work fine for that, I suppose.


kind regards,
Nikolaj Schumacher







reply via email to

[Prev in Thread] Current Thread [Next in Thread]