使用Emacs在elisp中运行测试时,如何评估代码? [英] How do I eval the code when run its test in elisp with Emacs?

查看:125
本文介绍了使用Emacs在elisp中运行测试时,如何评估代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写一些小谜题来学习Emacs Lisp。



然而,我目前的工作流程太繁琐了:


  1. 更改代码

  2. eval-region eval-buffer 代码

  3. 更改测试

  4. eval-region eval-buffer 测试代码

  5. Mx ert ,然后按Enter运行测试

如何设置Emacs或测试,所以我可以运行测试,Emacs会为我评估所有代码?

解决方案

您可能不应该在Emacs会话中运行测试。相反,在新的Emacs会话中运行测试:

  $ emacs -Q -b -l my-source-file.el -l my-test-file.el -f ert-run-tests-batch-and-exit 

您可以从 Mx编译运行这个。


I'm writing some small puzzles to learn Emacs Lisp.

However, my current workflow is way too tedious :

  1. change the code
  2. eval-region or eval-buffer code
  3. change the test
  4. eval-region or eval-buffer test code
  5. M-x ert, then press enter to run tests

How do I setup Emacs or the tests, so I can just "run the test" and Emacs will eval all codes for me ?

解决方案

You probably should not run your tests within your Emacs session anyway. Rather, run the tests in a fresh Emacs session:

$ emacs -Q -b -l my-source-file.el -l my-test-file.el -f ert-run-tests-batch-and-exit

You can run this from M-x compile.

这篇关于使用Emacs在elisp中运行测试时,如何评估代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆