all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Testing errors from macros with ERT and byte-compilation
@ 2013-08-18 10:56 David Engster
  2013-08-18 18:55 ` Glenn Morris
  0 siblings, 1 reply; 3+ messages in thread
From: David Engster @ 2013-08-18 10:56 UTC (permalink / raw)
  To: emacs-devel

I have a bit of a hard time porting the EIEIO test suite to use ERT. My
problem is with testing failures from macros and their byte
compilation. An example:

(require 'eieio)
(require 'ert)

(ert-deftest eieio-broken-initform ()
  (should-error
    (defclass broken-init nil
      ((broken :initform 1
	:type string))
      "This class should break.")
   :type 'invalid-slot-type))


While this works fine when eval'ed, I cannot byte-compile this because
the macro expansion fails, obviously:

Compiling file /home/void/foo.el at Sun Aug 18 12:48:13 2013
foo.el:4:1:Error: Invalid slot type: broken, string, 1

Is there some trick I could use? Simply wrapping the defclass in 'progn'
does not work.

Or should I just use 'no-byte-compile: t' for the test suite?

-David



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

* Re: Testing errors from macros with ERT and byte-compilation
  2013-08-18 10:56 Testing errors from macros with ERT and byte-compilation David Engster
@ 2013-08-18 18:55 ` Glenn Morris
  2013-08-18 19:13   ` David Engster
  0 siblings, 1 reply; 3+ messages in thread
From: Glenn Morris @ 2013-08-18 18:55 UTC (permalink / raw)
  To: emacs-devel

David Engster wrote:

> Or should I just use 'no-byte-compile: t' for the test suite?

It would seem overkill to do that for the entire test-suite.
Why not just separate out the things that don't compile into separate
file(s) and mark those no-byte-compile?
How does it work now?

Or use something like:

(ert-deftest eieio-broken-initform ()
  (should-error
    (eval '(defclass broken-init nil
         ((broken :initform 1
                        :type string))
                             "This class should break.")
                               :type 'invalid-slot-type)))

I feel I don't really understand what the problem is (I'm saying that a
lot today, maybe it's me...).



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

* Re: Testing errors from macros with ERT and byte-compilation
  2013-08-18 18:55 ` Glenn Morris
@ 2013-08-18 19:13   ` David Engster
  0 siblings, 0 replies; 3+ messages in thread
From: David Engster @ 2013-08-18 19:13 UTC (permalink / raw)
  To: Glenn Morris; +Cc: emacs-devel

Glenn Morris writes:
> How does it work now?

The test suite upstream is not using ERT, but a lot of `condition-case'.

> Or use something like:
>
> (ert-deftest eieio-broken-initform ()
>   (should-error
>     (eval '(defclass broken-init nil

> I feel I don't really understand what the problem is (I'm saying that a
> lot today, maybe it's me...).

Don't worry, it's me. I didn't think of 'eval'; that's exactly what I
was looking for.

-David



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

end of thread, other threads:[~2013-08-18 19:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-18 10:56 Testing errors from macros with ERT and byte-compilation David Engster
2013-08-18 18:55 ` Glenn Morris
2013-08-18 19:13   ` David Engster

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.