{"id":9051,"date":"2020-08-03T10:43:04","date_gmt":"2020-08-03T14:43:04","guid":{"rendered":"https:\/\/irreal.org\/blog\/?p=9051"},"modified":"2020-08-03T10:43:04","modified_gmt":"2020-08-03T14:43:04","slug":"a-short-tutorial-on-ert","status":"publish","type":"post","link":"https:\/\/irreal.org\/blog\/?p=9051","title":{"rendered":"A Short Tutorial on ERT"},"content":{"rendered":"<p>Abrochard has an excellent <a href=\"https:\/\/blog.abrochard.com\/ert-tests.html\">short tutorial<\/a> on using <a href=\"https:\/\/www.gnu.org\/software\/emacs\/manual\/html_node\/ert\/index.html\">ERT<\/a> for running regression tests on your Elisp code. Most of us, of course, don\u2019t write enough Elisp to worry about regression tests but if you want to contribute to Emacs or an Emacs related project, it\u2019s worth spending a couple of minutes learning about ERT.<\/p>\n<p>It\u2019s <i>really<\/i> easy to specify a test. In the simplest case you simply make one or more statements of the form<\/p>\n<pre class=\"example\">(should (equal &lt;expected value&gt; (&lt;tested-function&gt; &lt;function-parameters&gt;)))\n<\/pre>\n<p>and call ERT.<\/p>\n<p>ERT can handle more complicated cases, including those that don\u2019t return a value. Abrochard has a nice example of how to mock up a test when a function doesn\u2019t return a value. Take a look at his post to see the particulars. There\u2019s even more information in the <a href=\"https:\/\/www.gnu.org\/software\/emacs\/manual\/html_mono\/ert.html\">ERT manual<\/a> so take a look at that too. It\u2019s really easy to use and there\u2019s no reason not to take advantage of it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Abrochard has an excellent short tutorial on using ERT for running regression tests on your Elisp code. Most of us, of course, don\u2019t write enough Elisp to worry about regression tests but if you want to contribute to Emacs or &hellip; <a href=\"https:\/\/irreal.org\/blog\/?p=9051\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[18],"class_list":["post-9051","post","type-post","status-publish","format-standard","hentry","category-general","tag-emacs"],"_links":{"self":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/9051","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=9051"}],"version-history":[{"count":1,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/9051\/revisions"}],"predecessor-version":[{"id":9052,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/9051\/revisions\/9052"}],"wp:attachment":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=9051"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=9051"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=9051"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}