Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentations about testing #509

Open
mgallego opened this issue May 2, 2019 · 1 comment
Open

Documentations about testing #509

mgallego opened this issue May 2, 2019 · 1 comment

Comments

@mgallego
Copy link

mgallego commented May 2, 2019

Hi,
The first of all: Thank to everybody for the mode, I've been using it for a long time.

At this moment I'm trying to learn some of emacs lisp, and I'm thinking in practice with a mode that I use, for example this one, but I have some doubts with the testing.

What is a php.face file? Exists any documentation about how to test and how you develop this mode?

Thank.

PS: I don't know how to set a "question" tag and if this is the right place to ask.

@zonuexe
Copy link
Member

zonuexe commented May 11, 2019

@mgallego
Hi, I'm sorry I missed your question for a week and a half.

The .php.face file is a serialized list of file contents and "Face".
This is related to code coloring: it is called “Text Property” "Face" in Emacs terms.
In general, major mode for programming is realized by a mechanism called font-lock-mode.

The regression test is realized by comparing this file with the actual rendering result.
Its core feature is php-mode-test--buffer-face-list and php-mode-test--parse-list-file.

From ERT, we just compare the serialized list to the file and the result of actually coloring the PHP script. Therefore, there are some problems with test visibility.


Also, generating .php.face files from PHP files requires some manual work.
I'm generating a “faces list” (list of propertized text) with the following steps:

  1. Load the php-mode-test--buffer-face-list function from php-mode-test.el.
  2. Open the target test file in PHP-mode.
  3. Press M-: (or M-x eval-expression and input (setq x (php-mode-test--buffer-face-list (current-buffer))))
  4. Execute M-x ielm and input x and press RET.
    • I use ielm because its pretty print is the easiest to use and has good visibility
  5. Copy (yank / kill) the output into the .php.faces file.

This is information that should generally be included in CONTRIBUTING.md, but I have neglected to describe it for a long time.

Please feel free to ask any questions about this test method.

zonuexe added a commit that referenced this issue May 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants