使用Emacs在elisp中运行测试时,如何评估代码? [英] How do I eval the code when run its test in elisp with Emacs?
本文介绍了使用Emacs在elisp中运行测试时,如何评估代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
然而,我目前的工作流程太繁琐了:
- 更改代码
-
eval-region
或eval-buffer
代码 - 更改测试
-
eval-region
或eval-buffer
测试代码 -
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 :
- change the code
eval-region
oreval-buffer
code- change the test
eval-region
oreval-buffer
test codeM-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屋!
查看全文