[Top][All Lists]

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

Re: master 223e7b8: Make CC Mode and electric-pair-mode work together. T

From: João Távora
Subject: Re: master 223e7b8: Make CC Mode and electric-pair-mode work together. This fixes bug #33794
Date: Thu, 17 Jan 2019 15:47:34 +0000

Hi Alan,

On Wed, Jan 16, 2019 at 6:18 PM Alan Mackenzie <address@hidden> wrote:

> Thanks!  Part of the problem is in CC Mode, still.  Another part of the
> problem is electric-tests.el making assumptions about CC Mode's
> implementation (which has recently changed).

Can you be specific as to what "assumptions about CC Mode's
implementation" it is making?  As I read it, the assumptions
are this:

- Create a buffer, assumes the buffer is created
- Enable a specific major mode, assumes major mode is enabled.
  (does not M-x c++-mode RET enable c++-mode?)
- Insert as string, assumes the string is inserted
- Enable electric-pair-mode, assumes it succeeds
- Simulate typing a key such as {, or ', or }
  This is done by by

     (call-interactively (key-binding `[,last-command-event]))

Tests then verify if electric-pair-mode did what it was
supposed to do.  This is not an assumption, it is a verification.

"what is was supposed to do" is given by M-x ert-describe-test,
which basiclly restates the above assumptions in a more readable

> Incidentally, there's a test engine in electric-tests.el which is 100%
> undocumented (no doc string, no comments in functions like
> electric-pair-test-for and electric-pair-define-test-form).  It would be
> appreciated if anybody reading this who understands any of these
> functions could add doc strings to them.

We've already been through this 6+ months ago.
At the time I told you about M-x ert-describe-test and I even improved
it at your request!

  M-x ert-describe-test RET <failed-test-name> RET

Here's an example:

electric-pair-js-mode-braces-at-point-1-in-js-mode is a test defined
in `electric-tests.elc'.

Electricity test in a `js-mode' buffer.

Start with point at 1 in a 0-char-long buffer
like this one:

  ||   (buffer start and end are denoted by `|')

Now call this:

#'(lambda nil
    (electric-pair-mode 1))

Now press the key for: {

The buffer's contents should become:


, and point should be at 2.


reply via email to

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