# SOME DESCRIPTIVE TITLE # Copyright (C) YEAR Free Software Foundation, Inc. # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "POT-Creation-Date: 2021-11-07 12:11+0900\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #. type: title #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:4 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:34 #, no-wrap msgid "Emacs Lisp Regression Testing" msgstr "" #. type: include #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:5 #, no-wrap msgid "docstyle.texi" msgstr "" #. type: dircategory #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:12 #, no-wrap msgid "Emacs misc features" msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:15 msgid "ERT: (ert)" msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:15 msgid "Emacs Lisp regression testing tool." msgstr "" #. type: copying #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:19 msgid "Copyright @copyright{} 2008, 2010--2021 Free Software Foundation, Inc." msgstr "" #. type: quotation #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:27 msgid "" "Permission is granted to copy, distribute and/or modify this document under " "the terms of the GNU Free Documentation License, Version 1.3 or any later " "version published by the Free Software Foundation; with no Invariant " "Sections, with the Front-Cover Texts being ``A GNU Manual,'' and with the " "Back-Cover Texts as in (a) below. A copy of the license is included in the " "section entitled ``GNU Free Documentation License''." msgstr "" #. type: quotation #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:30 msgid "" "(a) The FSF's Back-Cover Text is: ``You have the freedom to copy and modify " "this GNU manual.''" msgstr "" #. type: node #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:43 #, no-wrap msgid "Top" msgstr "" #. type: top #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:44 #, no-wrap msgid "ERT: Emacs Lisp Regression Testing" msgstr "" #. type: ifnottex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:51 msgid "" "ERT is a tool for automated testing in Emacs Lisp. Its main features are " "facilities for defining tests, running them and reporting the results, and " "for debugging test failures interactively." msgstr "" #. type: ifnottex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:58 msgid "" "ERT is similar to tools for other environments such as JUnit, but has unique " "features that take advantage of the dynamic and interactive nature of " "Emacs. Despite its name, it works well both for test-driven development " "(see @url{https://en.wikipedia.org/wiki/Test-driven_development}) and for " "traditional software development methods." msgstr "" #. type: chapter #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:68 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:112 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:113 #, no-wrap msgid "Introduction" msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:68 msgid "A simple example of an ERT test." msgstr "" #. type: chapter #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:68 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:73 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:180 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:181 #, no-wrap msgid "How to Run Tests" msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:68 msgid "Run tests in Emacs or from the command line." msgstr "" #. type: chapter #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:68 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:79 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:469 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:470 #, no-wrap msgid "How to Write Tests" msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:68 msgid "How to add tests to your Emacs Lisp code." msgstr "" #. type: chapter #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:68 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:86 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:885 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:886 #, no-wrap msgid "How to Debug Tests" msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:68 msgid "What to do if a test fails." msgstr "" #. type: chapter #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:68 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:91 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:1026 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:1027 #, no-wrap msgid "Extending ERT" msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:68 msgid "ERT is extensible in several ways." msgstr "" #. type: chapter #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:68 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:96 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:1075 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:1076 #, no-wrap msgid "Other Testing Concepts" msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:68 msgid "Features not in ERT." msgstr "" #. type: unnumbered #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:68 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:101 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:103 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:1160 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:1161 #, no-wrap msgid "Index" msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:68 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:103 msgid "Concept, Function and Variable Index" msgstr "" #. type: appendix #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:68 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:107 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:1165 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:1166 #, no-wrap msgid "GNU Free Documentation License" msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:68 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:107 msgid "The license for this documentation." msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:71 msgid "--- The Detailed Node Listing ---" msgstr "" #. type: section #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:77 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:196 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:199 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:200 #, no-wrap msgid "Running Tests Interactively" msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:77 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:196 msgid "Run tests in your current Emacs." msgstr "" #. type: section #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:77 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:196 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:361 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:362 #, no-wrap msgid "Running Tests in Batch Mode" msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:77 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:196 msgid "Run tests in emacs -Q." msgstr "" #. type: section #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:77 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:196 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:422 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:423 #, no-wrap msgid "Test Selectors" msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:77 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:196 msgid "Choose which tests to run." msgstr "" #. type: section #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:84 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:490 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:492 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:493 #, no-wrap msgid "The @code{should} Macro" msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:84 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:490 msgid "A powerful way to express assertions." msgstr "" #. type: section #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:84 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:490 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:559 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:560 #, no-wrap msgid "Expected Failures" msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:84 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:490 msgid "Tests for known bugs." msgstr "" #. type: section #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:84 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:490 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:615 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:616 #, no-wrap msgid "Tests and Their Environment" msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:84 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:490 msgid "Don't depend on customizations; no side effects." msgstr "" #. type: node #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:84 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:490 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:687 #, no-wrap msgid "Useful Techniques" msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:84 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:490 msgid "Some examples." msgstr "" #. type: section #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:89 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:895 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:898 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:899 #, no-wrap msgid "Understanding Explanations" msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:89 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:895 msgid "How ERT gives details on why an assertion failed." msgstr "" #. type: section #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:89 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:895 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:967 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:968 #, no-wrap msgid "Interactive Debugging" msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:89 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:895 msgid "Tools available in the ERT results buffer." msgstr "" #. type: section #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:94 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:1035 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:1038 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:1039 #, no-wrap msgid "Defining Explanation Functions" msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:94 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:1035 msgid "Teach ERT about more predicates." msgstr "" #. type: section #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:94 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:1035 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:1058 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:1059 #, no-wrap msgid "Low-Level Functions for Working with Tests" msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:94 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:1035 msgid "Use ERT's data for your purposes." msgstr "" #. type: node #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:99 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:1084 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:1086 #, no-wrap msgid "Mocks and Stubs" msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:99 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:1084 msgid "Stubbing out code that is irrelevant to the test." msgstr "" #. type: section #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:99 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:1084 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:1100 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:1101 #, no-wrap msgid "Fixtures and Test Suites" msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:99 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:1084 msgid "How ERT differs from tools for other languages." msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:105 msgid "Appendix" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:114 #, no-wrap msgid "introduction to ERT" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:120 msgid "" "ERT allows you to define @emph{tests} in addition to functions, macros, " "variables, and the other usual Lisp constructs. Tests are simply Lisp code: " "code that invokes other code and checks whether it behaves as expected." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:124 msgid "" "ERT keeps track of the tests that are defined and provides convenient " "commands to run them to verify whether the definitions that are currently " "loaded in Emacs pass the tests." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:127 msgid "" "Some Lisp files have comments like the following (adapted from the package " "@code{pp.el}):" msgstr "" #. type: lisp #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:132 #, no-wrap msgid "" ";; (pp-to-string '(quote quote)) ; expected: \"'quote\"\n" ";; (pp-to-string '((quote a) (quote b))) ; expected: \"('a 'b)\\n\"\n" ";; (pp-to-string '('a 'b)) ; same as above\n" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:139 msgid "" "The code contained in these comments can be evaluated from time to time to " "compare the output with the expected output. ERT formalizes this and " "introduces a common convention, which simplifies Emacs development, since " "programmers no longer have to manually find and evaluate such comments." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:141 msgid "An ERT test definition equivalent to the above comments is this:" msgstr "" #. type: lisp #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:148 #, no-wrap msgid "" "(ert-deftest pp-test-quote ()\n" " \"Tests the rendering of `quote' symbols in `pp-to-string'.\"\n" " (should (equal (pp-to-string '(quote quote)) \"'quote\"))\n" " (should (equal (pp-to-string '((quote a) (quote b))) \"('a 'b)\\n\"))\n" " (should (equal (pp-to-string '('a 'b)) \"('a 'b)\\n\")))\n" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:153 msgid "" "If you know @code{defun}, the syntax of @code{ert-deftest} should look " "familiar: This example defines a test named @code{pp-test-quote} that will " "pass if the three calls to @code{equal} all return non-@code{nil}." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:156 msgid "" "@code{should} is a macro with the same meaning as @code{cl-assert} but " "better error reporting. @xref{The @code{should} Macro}." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:163 msgid "" "Each test should have a name that describes what functionality it tests. " "Test names can be chosen arbitrarily---they are in a namespace separate from " "functions and variables---but should follow the usual Emacs Lisp convention " "of having a prefix that indicates which package they belong to. Test names " "are displayed by ERT when reporting failures and can be used when selecting " "which tests to run." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:167 msgid "" "The empty parentheses @code{()} in the first line don't currently have any " "meaning and are reserved for future extension. They also make the syntax of " "@code{ert-deftest} more similar to that of @code{defun}." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:172 msgid "" "The docstring describes what feature this test tests. When running tests " "interactively, the first line of the docstring is displayed for tests that " "fail, so it is good if the first line makes sense on its own." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:178 msgid "" "The body of a test can be arbitrary Lisp code. It should have as few side " "effects as possible; each test should be written to clean up after itself, " "leaving Emacs in the same state as it was before the test. Tests should " "clean up even if they fail. @xref{Tests and Their Environment}." msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:182 #, no-wrap msgid "how to run ert tests" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:191 msgid "" "You can run tests either in the Emacs you are working in, or on the command " "line in a separate Emacs process in batch mode (i.e., with no user " "interface). The former mode is convenient during interactive development, " "the latter is useful to make sure that tests pass independently of your " "customizations; and it allows you to invoke tests from makefiles, and to " "write scripts that run tests in several different Emacs versions." msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:201 #, no-wrap msgid "running tests interactively" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:202 #, no-wrap msgid "interactive testing" msgstr "" #. type: findex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:204 #, no-wrap msgid "ert" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:210 msgid "" "You can run the tests that are currently defined in your Emacs with the " "command @kbd{M-x ert @key{RET} t @key{RET}}. (For an explanation of the " "@code{t} argument, @pxref{Test Selectors}.) ERT will pop up a new buffer, " "the ERT results buffer, showing the results of the tests run. It looks like " "this:" msgstr "" #. type: example #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:217 #, no-wrap msgid "" "Selector: t\n" "Passed: 31\n" "Skipped: 0\n" "Failed: 2 (2 unexpected)\n" "Total: 33/33\n" "\n" msgstr "" #. type: example #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:221 #, no-wrap msgid "" "Started at: 2008-09-11 08:39:25-0700\n" "Finished.\n" "Finished at: 2008-09-11 08:39:27-0700\n" "\n" msgstr "" #. type: example #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:223 #, no-wrap msgid "" "FF...............................\n" "\n" msgstr "" #. type: example #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:233 #, no-wrap msgid "" "F addition-test\n" " (ert-test-failed\n" " ((should\n" " (=\n" " (+ 1 2)\n" " 4))\n" " :form\n" " (= 3 4)\n" " :value nil))\n" "\n" msgstr "" #. type: example #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:247 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:941 #, no-wrap msgid "" "F list-test\n" " (ert-test-failed\n" " ((should\n" " (equal\n" " (list 'a 'b 'c)\n" " '(a b d)))\n" " :form\n" " (equal\n" " (a b c)\n" " (a b d))\n" " :value nil :explanation\n" " (list-elt 2\n" " (different-atoms c d))))\n" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:249 #, no-wrap msgid "test results buffer" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:254 msgid "" "At the top, there is a summary of the results: we ran all tests defined in " "the current Emacs (@code{Selector: t}), 31 of them passed, and 2 failed " "unexpectedly. @xref{Expected Failures}, for an explanation of the term " "@emph{unexpected} in this context." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:262 msgid "" "The line of dots and @code{F}s is a progress bar where each character " "represents one test; it fills while the tests are running. A dot means that " "the test passed, an @code{F} means that it failed. Below the progress bar, " "ERT shows details about each test that had an unexpected result. In the " "example above, there are two failures, both due to failed @code{should} " "forms. @xref{Understanding Explanations}, for more details." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:264 msgid "The following key bindings are available in the ERT results buffer:" msgstr "" #. type: key{#1} #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:267 #, no-wrap msgid "RET" msgstr "" #. type: kindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:268 #, no-wrap msgid "RET@r{, in ert results buffer}" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:271 msgid "" "Each name of a function or macro in this buffer is a button; moving point to " "it and typing @kbd{@key{RET}} jumps to its definition." msgstr "" #. type: key{#1} #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:272 #, no-wrap msgid "TAB" msgstr "" #. type: itemx #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:273 #, no-wrap msgid "S-@key{TAB}" msgstr "" #. type: kindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:274 #, no-wrap msgid "TAB@r{, in ert results buffer}" msgstr "" #. type: kindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:275 #, no-wrap msgid "S-TAB@r{, in ert results buffer}" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:278 msgid "" "Cycle between buttons forward (@code{forward-button}) and backward " "(@code{backward-button})." msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:279 #, no-wrap msgid "r" msgstr "" #. type: kindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:280 #, no-wrap msgid "r@r{, in ert results buffer}" msgstr "" #. type: findex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:281 #, no-wrap msgid "ert-results-rerun-test-at-point" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:284 msgid "" "Re-run the test near point on its own " "(@code{ert-results-rerun-test-at-point})." msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:285 #, no-wrap msgid "d" msgstr "" #. type: kindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:286 #, no-wrap msgid "d@r{, in ert results buffer}" msgstr "" #. type: findex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:287 #, no-wrap msgid "ert-results-rerun-test-at-point-debugging-errors" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:290 msgid "" "Re-run the test near point on its own with the debugger enabled " "(@code{ert-results-rerun-test-at-point-debugging-errors})." msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:291 #, no-wrap msgid "R" msgstr "" #. type: kindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:292 #, no-wrap msgid "R@r{, in ert results buffer}" msgstr "" #. type: findex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:293 #, no-wrap msgid "ert-results-rerun-all-tests" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:295 msgid "Re-run all tests (@code{ert-results-rerun-all-tests})." msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:296 #, no-wrap msgid "." msgstr "" #. type: kindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:297 #, no-wrap msgid ".@r{, in ert results buffer}" msgstr "" #. type: findex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:298 #, no-wrap msgid "ert-results-find-test-at-point-other-window" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:303 msgid "" "Jump to the definition of the test near point " "(@code{ert-results-find-test-at-point-other-window}). This has the same " "effect as @kbd{@key{RET}}, but does not require point to be on the name of " "the test." msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:304 #, no-wrap msgid "b" msgstr "" #. type: kindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:305 #, no-wrap msgid "b@r{, in ert results buffer}" msgstr "" #. type: findex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:306 #, no-wrap msgid "ert-results-pop-to-backtrace-for-test-at-point" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:307 #, no-wrap msgid "backtrace of a failed test" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:312 msgid "" "Show the backtrace of a failed test " "(@code{ert-results-pop-to-backtrace-for-test-at-point}). @xref{Debugging,, " "Backtraces, elisp, GNU Emacs Lisp Reference Manual}, for more information " "about backtraces." msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:313 #, no-wrap msgid "l" msgstr "" #. type: kindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:314 #, no-wrap msgid "l@r{, in ert results buffer}" msgstr "" #. type: findex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:315 #, no-wrap msgid "ert-results-pop-to-should-forms-for-test-at-point" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:318 msgid "" "Show the list of @code{should} forms executed in the test " "(@code{ert-results-pop-to-should-forms-for-test-at-point})." msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:319 #, no-wrap msgid "m" msgstr "" #. type: kindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:320 #, no-wrap msgid "m@r{, in ert results buffer}" msgstr "" #. type: findex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:321 #, no-wrap msgid "ert-results-pop-to-messages-for-test-at-point" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:325 msgid "" "Show any messages that were generated (with the Lisp function " "@code{message}) in in a test or any of the code that it invoked " "(@code{ert-results-pop-to-messages-for-test-at-point})." msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:326 #, no-wrap msgid "L" msgstr "" #. type: kindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:327 #, no-wrap msgid "L@r{, in ert results buffer}" msgstr "" #. type: findex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:328 #, no-wrap msgid "ert-results-toggle-printer-limits-for-test-at-point" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:333 msgid "" "By default, long expressions in the failure details are abbreviated using " "@code{print-length} and @code{print-level}. Increase the limits to show " "more of the expression by moving point to a test failure with this command " "(@code{ert-results-toggle-printer-limits-for-test-at-point})." msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:334 #, no-wrap msgid "D" msgstr "" #. type: kindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:335 #, no-wrap msgid "D@r{, in ert results buffer}" msgstr "" #. type: findex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:336 #, no-wrap msgid "ert-delete-test" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:337 #, no-wrap msgid "delete test" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:339 msgid "Delete a test from the running Emacs session (@code{ert-delete-test})." msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:340 #, no-wrap msgid "h" msgstr "" #. type: kindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:341 #, no-wrap msgid "h@r{, in ert results buffer}" msgstr "" #. type: findex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:342 #, no-wrap msgid "ert-describe-test" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:344 msgid "Show the documentation of a test (@code{ert-describe-test})." msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:345 #, no-wrap msgid "T" msgstr "" #. type: kindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:346 #, no-wrap msgid "T@r{, in ert results buffer}" msgstr "" #. type: findex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:347 #, no-wrap msgid "ert-results-pop-to-timings" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:349 msgid "Display test timings for the last run (@code{ert-results-pop-to-timings})." msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:350 #, no-wrap msgid "M-x ert-delete-all-tests" msgstr "" #. type: findex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:351 #, no-wrap msgid "ert-delete-all-tests" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:352 #, no-wrap msgid "delete all tests" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:354 msgid "Delete all tests from the running session." msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:355 #, no-wrap msgid "M-x ert-describe-test" msgstr "" #. type: findex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:356 #, no-wrap msgid "ert-results-describe-test-at-point" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:358 msgid "Prompt for a test and then show its documentation." msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:363 #, no-wrap msgid "running tests in batch mode" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:364 #, no-wrap msgid "batch-mode testing" msgstr "" #. type: findex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:366 #, no-wrap msgid "ert-run-tests-batch" msgstr "" #. type: findex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:367 #, no-wrap msgid "ert-run-tests-batch-and-exit" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:372 msgid "" "ERT supports automated invocations from the command line or from scripts or " "makefiles. There are two functions for this purpose, " "@code{ert-run-tests-batch} and @code{ert-run-tests-batch-and-exit}. They " "can be used like this:" msgstr "" #. type: example #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:375 #, no-wrap msgid "emacs -batch -l ert -l my-tests.el -f ert-run-tests-batch-and-exit\n" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:382 msgid "" "This command will start up Emacs in batch mode, load ERT, load " "@code{my-tests.el}, and run all tests defined in it. It will exit with a " "zero exit status if all tests passed, or nonzero if any tests failed or if " "anything else went wrong. It will also print progress messages and error " "diagnostics to standard output." msgstr "" #. type: findex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:383 #, no-wrap msgid "ert-summarize-tests-batch-and-exit" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:388 msgid "" "You can also redirect the above output to a log file, say @file{output.log}, " "and use the @code{ert-summarize-tests-batch-and-exit} function to produce a " "neat summary as shown below:" msgstr "" #. type: example #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:391 #, no-wrap msgid "emacs -batch -l ert -f ert-summarize-tests-batch-and-exit output.log\n" msgstr "" #. type: vindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:393 #, no-wrap msgid "ert-quiet" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:399 msgid "" "By default, ERT in batch mode is quite verbose, printing a line with result " "after each test. This gives you progress information: how many tests have " "been executed and how many there are. However, in some cases this much " "output may be undesirable. In this case, set @code{ert-quiet} variable to a " "non-nil value:" msgstr "" #. type: example #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:403 #, no-wrap msgid "" "emacs -batch -l ert -l my-tests.el \\\n" " --eval \"(let ((ert-quiet t)) (ert-run-tests-batch-and-exit))\"\n" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:406 msgid "In quiet mode ERT prints only unexpected results and summary." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:411 msgid "" "You can specify selectors to only run a subset of your tests (@pxref{Test " "Selectors}). For example, the following would run all tests where the name " "of the test matches the regular expression ``to-match''." msgstr "" #. type: example #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:415 #, no-wrap msgid "" "emacs -batch -l ert -l my-tests.el \\\n" " -eval '(ert-run-tests-batch-and-exit \"to-match\")'\n" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:421 msgid "" "By default, ERT test failure summaries are quite brief in batch mode---only " "the names of the failed tests are listed. If the EMACS_TEST_VERBOSE " "environment variable is set, the failure summaries will also include the " "data from the failing test." msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:424 #, no-wrap msgid "test selector" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:425 #, no-wrap msgid "selecting tests" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:430 msgid "" "Functions like @code{ert} accept a @emph{test selector}, a Lisp expression " "specifying a set of tests. Test selector syntax is similar to Common Lisp's " "type specifier syntax:" msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:432 #, no-wrap msgid "@code{nil} selects no tests." msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:433 #, no-wrap msgid "@code{t} selects all tests." msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:434 #, no-wrap msgid "@code{:new} selects all tests that have not been run yet." msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:435 #, no-wrap msgid "" "@code{:failed} and @code{:passed} select tests according to their most " "recent result." msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:436 #, no-wrap msgid "" "@code{:expected}, @code{:unexpected} select tests according to their most " "recent result." msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:437 #, no-wrap msgid "A string is a regular expression that selects all tests with matching names." msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:438 #, no-wrap msgid "A test (i.e., an object of @code{ert-test} data type) selects that test." msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:439 #, no-wrap msgid "A symbol selects the test that the symbol names." msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:440 #, no-wrap msgid "@code{(member @var{tests}...)} selects the elements of" msgstr "" #. type: itemize #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:442 msgid "@var{tests}, a list of tests or symbols naming tests." msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:442 #, no-wrap msgid "@code{(eql @var{test})} selects @var{test}, a test or a symbol" msgstr "" #. type: itemize #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:444 msgid "naming a test." msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:444 #, no-wrap msgid "@code{(and @var{selectors}@dots{})} selects the tests that match" msgstr "" #. type: itemize #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:446 msgid "all @var{selectors}." msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:446 #, no-wrap msgid "@code{(or @var{selectors}@dots{})} selects the tests that match" msgstr "" #. type: itemize #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:448 msgid "any of the @var{selectors}." msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:448 #, no-wrap msgid "@code{(not @var{selector})} selects all tests that do not match" msgstr "" #. type: itemize #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:450 msgid "@var{selector}." msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:450 #, no-wrap msgid "@code{(tag @var{tag})} selects all tests that have @var{tag} on" msgstr "" #. type: itemize #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:453 msgid "" "their tags list. (Tags are optional labels you can apply to tests when you " "define them.)" msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:453 #, no-wrap msgid "@code{(satisfies @var{predicate})} selects all tests that" msgstr "" #. type: itemize #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:456 msgid "" "satisfy @var{predicate}, a function that takes a test as argument and " "returns non-@code{nil} if it is selected." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:467 msgid "" "Selectors that are frequently useful when selecting tests to run include " "@code{t} to run all tests that are currently defined in Emacs, " "@code{\"^foo-\"} to run all tests in package @code{foo} (this assumes that " "package @code{foo} uses the prefix @code{foo-} for its test names), " "result-based selectors such as @code{(or :new :unexpected)} to run all tests " "that have either not run yet or that had an unexpected result in the last " "run, and tag-based selectors such as @code{(not (tag :causes-redisplay))} to " "run all tests that are not tagged @code{:causes-redisplay}." msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:471 #, no-wrap msgid "how to write tests" msgstr "" #. type: findex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:473 #, no-wrap msgid "ert-deftest" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:478 msgid "" "ERT lets you define tests in the same way you define functions. You can " "type @code{ert-deftest} forms in a buffer and evaluate them there with " "@code{eval-defun} or @code{compile-defun}, or you can save the file and load " "it, optionally byte-compiling it first." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:482 msgid "" "Just like @code{find-function} is only able to find where a function was " "defined if the function was loaded from a file, ERT is only able to find " "where a test was defined if the test was loaded from a file." msgstr "" #. type: section #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:490 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:771 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:772 #, no-wrap msgid "erts files" msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:490 msgid "Files containing many buffer tests." msgstr "" #. type: findex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:495 #, no-wrap msgid "should@r{, ert macro}" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:503 msgid "" "Test bodies can include arbitrary code; but to be useful, they need to check " "whether the code being tested (or @emph{code under test}) does what it is " "supposed to do. The macro @code{should} is similar to @code{cl-assert} from " "the cl package (@pxref{Assertions,,, cl, Common Lisp Extensions}), but " "analyzes its argument form and records information that ERT can display to " "help debugging." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:505 msgid "This test definition" msgstr "" #. type: lisp #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:509 #, no-wrap msgid "" "(ert-deftest addition-test ()\n" " (should (= (+ 1 2) 4)))\n" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:512 msgid "will produce this output when run via @kbd{M-x ert}:" msgstr "" #. type: example #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:523 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/ert.texi:915 #, no-wrap msgid "" "F addition-test\n" " (ert-test-failed\n" " ((should\n" " (=\n" " (+ 1 2)\n" " 4))\n" " :form\n" " (= 3 4)\n" " :value nil))\n" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:530 msgid "" "In this example, @code{should} recorded the fact that (= (+ 1 2) 4) reduced " "to (= 3 4) before it reduced to @code{nil}. When debugging why the test " "failed, it helps to know that the function @code{+} returned 3 here. ERT " "records the return value for any predicate called directly within " "@code{should}." msgstr "" #. type: findex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:531 #, no-wrap msgid "should-not@r{, ert macro}" msgstr "" #. type: findex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:532 #, no-wrap msgid "should-error@r{, ert macro}" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:537 msgid "" "In addition to @code{should}, ERT provides @code{should-not}, which checks " "that the predicate returns @code{nil}, and @code{should-error}, which checks " "that the form called within it signals an error. An example use of " "@code{should-error}:" msgstr "" #. type: lisp #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:542 #, no-wrap msgid "" "(ert-deftest test-divide-by-zero ()\n" " (should-error (/ 1 0)\n" " :type 'arith-error))\n" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:550 msgid "" "This checks that dividing one by zero signals an error of type " "@code{arith-error}. The @code{:type} argument to @code{should-error} is " "optional; if absent, any type of error is accepted. @code{should-error} " "returns an error description of the error that was signaled, to allow " "additional checks to be made. The error description has the format " "@code{(ERROR-SYMBOL . DATA)}." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:554 msgid "" "There is no @code{should-not-error} macro since tests that signal an error " "fail anyway, so @code{should-not-error} is effectively the default." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:557 msgid "" "@xref{Understanding Explanations}, for more details on what @code{should} " "reports." msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:561 #, no-wrap msgid "expected failures" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:562 #, no-wrap msgid "known bugs" msgstr "" #. type: vindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:564 #, no-wrap msgid ":expected-result" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:571 msgid "" "Some bugs are complicated to fix, or not very important, and are left as " "@emph{known bugs}. If there is a test case that triggers the bug and fails, " "ERT will alert you of this failure every time you run all tests. For known " "bugs, this alert is a distraction. The way to suppress it is to add " "@code{:expected-result :failed} to the test definition:" msgstr "" #. type: lisp #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:578 #, no-wrap msgid "" "(ert-deftest future-bug ()\n" " \"Test `time-forward' with negative arguments.\n" "Since this functionality isn't implemented, the test is known to fail.\"\n" " :expected-result :failed\n" " (time-forward -1))\n" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:583 msgid "" "ERT will still display a small @code{f} in the progress bar as a reminder " "that there is a known bug, and will count the test as failed, but it will be " "quiet about it otherwise." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:588 msgid "" "An alternative to marking the test as a known failure this way is to delete " "the test. This is a good idea if there is no intent to fix it, i.e., if the " "behavior that was formerly considered a bug has become an accepted feature." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:594 msgid "" "In general, however, it can be useful to keep tests that are known to fail. " "If someone wants to fix the bug, they will have a very good starting point: " "an automated test case that reproduces the bug. This makes it much easier " "to fix the bug, demonstrate that it is fixed, and prevent future " "regressions." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:600 msgid "" "ERT displays the same kind of alerts for tests that pass unexpectedly as it " "displays for unexpected failures. This way, if you make code changes that " "happen to fix a bug that you weren't aware of, you will know to remove the " "@code{:expected-result} clause of that test and close the corresponding bug " "report, if any." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:604 msgid "" "Since @code{:expected-result} evaluates its argument when the test is " "loaded, tests can be marked as known failures only on certain Emacs " "versions, specific architectures, etc.:" msgstr "" #. type: lisp #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:612 #, no-wrap msgid "" "(ert-deftest foo ()\n" " \"A test that is expected to fail on Emacs 23 but succeed elsewhere.\"\n" " :expected-result (if (string-match \"GNU Emacs 23[.]\" (emacs-version))\n" " :failed\n" " :passed)\n" " ...)\n" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:618 #, no-wrap msgid "skipping tests" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:619 #, no-wrap msgid "test preconditions" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:620 #, no-wrap msgid "preconditions of a test" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:626 msgid "" "Sometimes, it doesn't make sense to run a test due to missing " "preconditions. A required Emacs feature might not be compiled in, the " "function to be tested could call an external binary which might not be " "available on the test machine, you name it. In this case, the macro " "@code{skip-unless} could be used to skip the test:" msgstr "" #. type: lisp #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:632 #, no-wrap msgid "" "(ert-deftest test-dbus ()\n" " \"A test that checks D-BUS functionality.\"\n" " (skip-unless (featurep 'dbusbind))\n" " ...)\n" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:634 #, no-wrap msgid "tests and their environment" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:642 msgid "" "The outcome of running a test should not depend on the current state of the " "environment, and each test should leave its environment in the same state it " "found it in. In particular, a test should not depend on any Emacs " "customization variables or hooks, and if it has to make any changes to " "Emacs's state or state external to Emacs (such as the file system), it " "should undo these changes before it returns, regardless of whether it passed " "or failed." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:651 msgid "" "Tests should not depend on the environment because any such dependencies can " "make the test brittle or lead to failures that occur only under certain " "circumstances and are hard to reproduce. Of course, the code under test may " "have settings that affect its behavior. In that case, it is best to make " "the test @code{let}-bind all such setting variables to set up a specific " "configuration for the duration of the test. The test can also set up a " "number of different configurations and run the code under test with each." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:663 msgid "" "Tests that have side effects on their environment should restore it to its " "original state because any side effects that persist after the test can " "disrupt the workflow of the programmer running the tests. If the code under " "test has side effects on Emacs's current state, such as on the current " "buffer or window configuration, the test should create a temporary buffer " "for the code to manipulate (using @code{with-temp-buffer}), or save and " "restore the window configuration (using @code{save-window-excursion}), " "respectively. For aspects of the state that can not be preserved with such " "macros, cleanup should be performed with @code{unwind-protect}, to ensure " "that the cleanup occurs even if the test fails." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:667 msgid "" "An exception to this are messages that the code under test prints with " "@code{message} and similar logging; tests should not bother restoring the " "@file{*Message*} buffer to its original state." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:679 msgid "" "The above guidelines imply that tests should avoid calling highly " "customizable commands such as @code{find-file}, except, of course, if such " "commands are what they want to test. The exact behavior of @code{find-file} " "depends on many settings such as @code{find-file-wildcards}, " "@code{enable-local-variables}, and @code{auto-mode-alist}. It is difficult " "to write a meaningful test if its behavior can be affected by so many " "external factors. Also, @code{find-file} has side effects that are hard to " "predict and thus hard to undo: It may create a new buffer or reuse an " "existing buffer if one is already visiting the requested file; and it runs " "@code{find-file-hook}, which can have arbitrary side effects." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:685 msgid "" "Instead, it is better to use lower-level mechanisms with simple and " "predictable semantics like @code{with-temp-buffer}, @code{insert} or " "@code{insert-file-contents-literally}, and to activate any desired mode by " "calling the corresponding function directly, after binding the hook " "variables to @code{nil}. This avoids the above problems." msgstr "" #. type: section #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:688 #, no-wrap msgid "Useful Techniques when Writing Tests" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:689 #, no-wrap msgid "useful techniques" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:690 #, no-wrap msgid "tips and tricks" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:694 msgid "" "Testing simple functions that have no side effects and no dependencies on " "their environment is easy. Such tests often look like this:" msgstr "" #. type: lisp #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:703 #, no-wrap msgid "" "(ert-deftest ert-test-mismatch ()\n" " (should (eql (cl-mismatch \"\" \"\") nil))\n" " (should (eql (cl-mismatch \"\" \"a\") 0))\n" " (should (eql (cl-mismatch \"a\" \"a\") nil))\n" " (should (eql (cl-mismatch \"ab\" \"a\") 1))\n" " (should (eql (cl-mismatch \"Aa\" \"aA\") 0))\n" " (should (eql (cl-mismatch '(a b c) '(a b d)) 2)))\n" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:710 msgid "" "This test calls the function @code{cl-mismatch} several times with various " "combinations of arguments and compares the return value to the expected " "return value. (Some programmers prefer @code{(should (eql EXPECTED " "ACTUAL))} over the @code{(should (eql ACTUAL EXPECTED))} shown here. ERT " "works either way.)" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:712 msgid "Here's a more complicated test:" msgstr "" #. type: lisp #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:726 #, no-wrap msgid "" "(ert-deftest ert-test-record-backtrace ()\n" " (let ((test (make-ert-test :body (lambda () (ert-fail \"foo\")))))\n" " (let ((result (ert-run-test test)))\n" " (should (ert-test-failed-p result))\n" " (with-temp-buffer\n" " (ert--print-backtrace (ert-test-failed-backtrace result))\n" " (goto-char (point-min))\n" " (end-of-line)\n" " (let ((first-line (buffer-substring-no-properties\n" " (point-min) (point))))\n" " (should (equal first-line\n" " \" signal(ert-test-failed " "(\\\"foo\\\"))\")))))))\n" msgstr "" #. type: findex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:728 #, no-wrap msgid "make-ert-test" msgstr "" #. type: findex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:729 #, no-wrap msgid "ert-equal-including-properties" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:740 msgid "" "This test creates a test object using @code{make-ert-test} whose body will " "immediately signal failure. It then runs that test and asserts that it " "fails. Then, it creates a temporary buffer and invokes " "@code{ert--print-backtrace} to print the backtrace of the failed test to the " "current buffer. Finally, it extracts the first line from the buffer and " "asserts that it matches what we expect. It uses " "@code{buffer-substring-no-properties} and @code{equal} to ignore text " "properties; for a test that takes properties into account, " "@code{buffer-substring} and @code{ert-equal-including-properties} could be " "used instead." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:747 msgid "" "The reason why this test only checks the first line of the backtrace is that " "the remainder of the backtrace is dependent on ERT's internals as well as " "whether the code is running interpreted or compiled. By looking only at the " "first line, the test checks a useful property---that the backtrace correctly " "captures the call to @code{signal} that results from the call to " "@code{ert-fail}---without being brittle." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:750 msgid "" "This example also shows that writing tests is much easier if the code under " "test was structured with testing in mind." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:757 msgid "" "For example, if @code{ert-run-test} accepted only symbols that name tests " "rather than test objects, the test would need a name for the failing test, " "which would have to be a temporary symbol generated with @code{make-symbol}, " "to avoid side effects on Emacs's state. Choosing the right interface for " "@code{ert-run-tests} allows the test to be simpler." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:764 msgid "" "Similarly, if @code{ert--print-backtrace} printed the backtrace to a buffer " "with a fixed name rather than the current buffer, it would be much harder " "for the test to undo the side effect. Of course, some code somewhere needs " "to pick the buffer name. But that logic is independent of the logic that " "prints backtraces, and keeping them in separate functions allows us to test " "them independently." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:770 msgid "" "A lot of code that you will encounter in Emacs was not written with testing " "in mind. Sometimes, the easiest way to write tests for such code is to " "restructure the code slightly to provide better interfaces for testing. " "Usually, this makes the interfaces easier to use as well." msgstr "" #. type: findex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:774 #, no-wrap msgid "ert-test-erts-file" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:782 msgid "" "Many relevant Emacs tests depend on comparing the contents of a buffer " "before and after executing a particular function. These tests can be " "written the normal way---making a temporary buffer, inserting the ``before'' " "text, running the function, and then comparing with the expected ``after'' " "text. However, this often leads to test code that's pretty difficult to " "read and write, especially when the text in question is multi-line." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:786 msgid "" "So ert provides a function called @code{ert-test-erts-file} that takes two " "parameters: The name of a specially-formatted @dfn{erts} file, and " "(optionally) a function that performs the transform." msgstr "" #. type: findex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:787 #, no-wrap msgid "erts-mode" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:789 msgid "These erts files can be edited with the @code{erts-mode} major mode." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:791 msgid "An erts file is divided into sections by the (@samp{=-=}) separator." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:793 msgid "Here's an example file containing two tests:" msgstr "" #. type: example #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:796 #, no-wrap msgid "" "Name: flet\n" "\n" msgstr "" #. type: example #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:806 #, no-wrap msgid "" "=-=\n" "(cl-flet ((bla (x)\n" "(* x x)))\n" "(bla 42))\n" "=-=\n" "(cl-flet ((bla (x)\n" " (* x x)))\n" " (bla 42))\n" "=-=-=\n" "\n" msgstr "" #. type: example #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:808 #, no-wrap msgid "" "Name: defun\n" "\n" msgstr "" #. type: example #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:814 #, no-wrap msgid "" "=-=\n" "(defun x ()\n" " (print (quote ( thingy great\n" " stuff))))\n" "=-=-=\n" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:820 msgid "" "A test starts with a line containing just @samp{=-=} and ends with a line " "containing just @samp{=-=-=}. The test may be preceded by freeform text " "(for instance, comments), and also name/value pairs (see below for a list of " "them)." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:825 msgid "" "If there is a line with @samp{=-=} inside the test, that designates the " "start of the ``after'' text. Otherwise, the ``before'' and ``after'' texts " "are assumed to be identical, which you typically see when writing " "indentation tests." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:829 msgid "" "@code{ert-test-erts-file} puts the ``before'' section into a temporary " "buffer, calls the transform function, and then compares with the ``after'' " "section." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:831 msgid "Here's an example usage:" msgstr "" #. type: lisp #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:837 #, no-wrap msgid "" "(ert-test-erts-file \"elisp.erts\"\n" " (lambda ()\n" " (emacs-lisp-mode)\n" " (indent-region (point-min) (point-max))))\n" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:843 msgid "" "A list of the name/value specifications that can appear before a test " "follows. The general syntax is @samp{Name: Value}, but continuation lines " "can be used (along the same lines as in mail---subsequent lines that start " "with a space are part of the value)." msgstr "" #. type: example #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:848 #, no-wrap msgid "" "Name: foo\n" "Code: (indent-region\n" " (point-min) (point-max))\n" msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:851 #, no-wrap msgid "Name" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:854 msgid "" "All tests should have a name. This name will appear in ERT output if the " "test fails, and helps to identify the failing test." msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:855 #, no-wrap msgid "Code" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:861 msgid "" "This is the code that will be run to do the transform. This can also be " "passed in via the @code{ert-test-erts-file} call, but @samp{Code} overrides " "that. It's used not only in the following test, but in all subsequent tests " "in the file (until overridden by another @samp{Code} specification)." msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:862 #, no-wrap msgid "No-Before-Newline" msgstr "" #. type: itemx #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:863 #, no-wrap msgid "No-After-Newline" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:867 msgid "" "These specifications say whether the ``before'' or ``after'' portions have a " "newline at the end. (This would otherwise be impossible to specify.)" msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:868 #, no-wrap msgid "Point-Char" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:876 msgid "" "Sometimes it's useful to be able to put point at a specific place before " "executing the transform function. @samp{Point-Char: |} will make " "@code{ert-test-erts-file} place point where @samp{|} is in the ``before'' " "form (and remove that character), and will check that it's where the " "@samp{|} character is in the ``after'' form (and issue a test failure if " "that isn't the case). (This is used in all subsequent tests, unless " "overridden by a new @samp{Point-Char} spec.)" msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:877 #, no-wrap msgid "Skip" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:880 msgid "" "If this is present and value is a form that evaluates to a non-@code{nil} " "value, the test will be skipped." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:884 msgid "" "If you need to use the literal line single line @samp{=-=} in a test " "section, you can quote it with a @samp{\\} character." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:890 msgid "" "This section describes how to use ERT's features to understand why a test " "failed." msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:900 #, no-wrap msgid "understanding explanations" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:901 #, no-wrap msgid "explanations, understanding" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:904 msgid "Failed @code{should} forms are reported like this:" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:923 msgid "" "ERT shows what the @code{should} expression looked like and what values its " "subexpressions had: The source code of the assertion was @code{(should (= (+ " "1 2) 4))}, which applied the function @code{=} to the arguments @code{3} and " "@code{4}, resulting in the value @code{nil}. In this case, the test is " "wrong; it should expect 3 rather than 4." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:926 msgid "" "If a predicate like @code{equal} is used with @code{should}, ERT provides a " "so-called @emph{explanation}:" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:947 msgid "" "In this case, the function @code{equal} was applied to the arguments " "@code{(a b c)} and @code{(a b d)}. ERT's explanation shows that the item at " "index 2 differs between the two lists; in one list, it is the atom c, in the " "other, it is the atom d." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:951 msgid "" "In simple examples like the above, the explanation is unnecessary. But in " "cases where the difference is not immediately apparent, it can save time:" msgstr "" #. type: example #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:961 #, no-wrap msgid "" "F test1\n" " (ert-test-failed\n" " ((should\n" " (equal x y))\n" " :form\n" " (equal a a)\n" " :value nil :explanation\n" " (different-symbols-with-the-same-name a a)))\n" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:965 msgid "" "ERT only provides explanations for predicates that have an explanation " "function registered. @xref{Defining Explanation Functions}." msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:969 #, no-wrap msgid "interactive debugging" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:970 #, no-wrap msgid "debugging failed tests" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:975 msgid "" "Debugging failed tests essentially works the same way as debugging any other " "problems with Lisp code. Here are a few tricks specific to tests:" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:977 #, no-wrap msgid "re-running a failed test" msgstr "" #. type: itemize #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:983 msgid "" "Re-run the failed test a few times to see if it fails in the same way each " "time. It's good to find out whether the behavior is deterministic before " "spending any time looking for a cause. In the ERT results buffer, @kbd{r} " "re-runs the selected test." msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:984 #, no-wrap msgid "jump to the test source code" msgstr "" #. type: itemize #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:989 msgid "" "Use @kbd{.} to jump to the source code of the test to find out exactly what " "it does. Perhaps the test is broken rather than the code under test." msgstr "" #. type: itemize #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:994 msgid "" "If the test contains a series of @code{should} forms and you can't tell " "which one failed, use @kbd{l}, which shows you the list of all @code{should} " "forms executed during the test before it failed." msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:995 #, no-wrap msgid "show backtrace of failed test" msgstr "" #. type: itemize #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:1002 msgid "" "Use @kbd{b} to view the backtrace. You can also use @kbd{d} to re-run the " "test with debugging enabled, this will enter the debugger and show the " "backtrace as well; but the top few frames shown there will not be relevant " "to you since they are ERT's own debugger hook. @kbd{b} strips them out, so " "it is more convenient." msgstr "" #. type: itemize #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:1007 msgid "" "If the test or the code under testing prints messages using @code{message}, " "use @kbd{m} to see what messages it printed before it failed. This can be " "useful to figure out how far it got." msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:1008 #, no-wrap msgid "instrumenting test for Edebug" msgstr "" #. type: itemize #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:1014 msgid "" "You can instrument tests for debugging the same way you instrument " "@code{defun}s for debugging: go to the source code of the test and type " "@kbd{C-u C-M-x}. Then, go back to the ERT buffer and re-run the test with " "@kbd{r} or @kbd{d}." msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:1015 #, no-wrap msgid "discard obsolete test results" msgstr "" #. type: itemize #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:1023 msgid "" "If you have been editing and rearranging tests, it is possible that ERT " "remembers an old test that you have since renamed or removed: renamings or " "removals of definitions in the source code leave around a stray definition " "under the old name in the running process (this is a common problem in " "Lisp). In such a situation, hit @kbd{D} to let ERT forget about the " "obsolete test." msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:1028 #, no-wrap msgid "extending ert" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:1031 msgid "There are several ways to add functionality to ERT." msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:1040 #, no-wrap msgid "defining explanation functions" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:1050 msgid "" "The explanation function for a predicate is a function that takes the same " "arguments as the predicate and returns an @emph{explanation}. The " "explanation should explain why the predicate, when invoked with the " "arguments given to the explanation function, returns the value that it " "returns. The explanation can be any object but should have a comprehensible " "printed representation. If the return value of the predicate needs no " "explanation for a given list of arguments, the explanation function should " "return @code{nil}." msgstr "" #. type: vindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:1051 #, no-wrap msgid "ert-explainer@r{, property}" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:1056 msgid "" "To associate an explanation function with a predicate, add the property " "@code{ert-explainer} to the symbol that names the predicate. The value of " "the property should be the symbol that names the explanation function." msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:1060 #, no-wrap msgid "low-level functions" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:1066 msgid "" "Both @code{ert-run-tests-interactively} and @code{ert-run-tests-batch} are " "implemented on top of the lower-level test handling code in the sections of " "@file{ert.el} labeled ``Facilities for running a single test'', ``Test " "selectors'', and ``Facilities for running a whole set of tests''." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:1071 msgid "" "If you want to write code that works with ERT tests, you should take a look " "at this lower-level code. Symbols that start with @code{ert--} are internal " "to ERT, whereas those that start with @code{ert-} are meant to be usable by " "other code. But there is no mature API yet." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:1073 msgid "Contributions to ERT are welcome." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:1079 msgid "For information on mocks, stubs, fixtures, or test suites, see below." msgstr "" #. type: section #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:1087 #, no-wrap msgid "Other Tools for Emacs Lisp" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:1088 #, no-wrap msgid "mocks and stubs" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:1094 msgid "" "Stubbing out functions or using so-called @emph{mocks} can make it easier to " "write tests. See @url{https://en.wikipedia.org/wiki/Mock_object} for an " "explanation of the corresponding concepts in object-oriented languages." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:1098 msgid "" "ERT does not have built-in support for mocks or stubs. The package " "@code{el-mock} (see @url{https://www.emacswiki.org/emacs/el-mock.el}) " "offers mocks for Emacs Lisp and can be used in conjunction with ERT." msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:1102 #, no-wrap msgid "fixtures" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:1107 msgid "" "In many ways, ERT is similar to frameworks for other languages like SUnit or " "JUnit. However, two features commonly found in such frameworks are notably " "absent from ERT: fixtures and test suites." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:1111 msgid "" "Fixtures are mainly used (e.g., in SUnit or JUnit) to provide an environment " "for a set of tests, and consist of set-up and tear-down functions." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:1116 msgid "" "While fixtures are a useful syntactic simplification in other languages, " "this does not apply to Lisp, where higher-order functions and " "@code{unwind-protect} are available. One way to implement and use a fixture " "in ERT is" msgstr "" #. type: lisp #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:1123 #, no-wrap msgid "" "(defun my-fixture (body)\n" " (unwind-protect\n" " (progn [set up]\n" " (funcall body))\n" " [tear down]))\n" "\n" msgstr "" #. type: lisp #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:1128 #, no-wrap msgid "" "(ert-deftest my-test ()\n" " (my-fixture\n" " (lambda ()\n" " [test code])))\n" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:1134 msgid "" "(Another way would be a @code{with-my-fixture} macro.) This solves the " "set-up and tear-down part, and additionally allows any test to use any " "combination of fixtures, so it is more flexible than what other tools " "typically allow." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:1137 msgid "" "If the test needs access to the environment the fixture sets up, the fixture " "can be modified to pass arguments to the body." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:1140 msgid "" "These are well-known Lisp techniques. Special syntax for them could be " "added but would provide only a minor simplification." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:1146 msgid "" "(If you are interested in such syntax, note that splitting set-up and " "tear-down into separate functions, like *Unit tools usually do, makes it " "impossible to establish dynamic @code{let} bindings as part of the fixture. " "So, blindly imitating the way fixtures are implemented in other languages " "would be counter-productive in Lisp.)" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:1148 msgid "The purpose of test suites is to group related tests together." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:1154 msgid "" "The most common use of this is to run just the tests for one particular " "module. Since symbol prefixes are the usual way of separating module " "namespaces in Emacs Lisp, test selectors already solve this by allowing " "regexp matching on test names; e.g., the selector @code{\"^ert-\"} selects " "ERT's self-tests." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:1159 msgid "" "Other uses include grouping tests by their expected execution time, e.g., to " "run quick tests during interactive development and slow tests less often. " "This can be achieved with the @code{:tag} argument to @code{ert-deftest} and " "@code{tag} test selectors." msgstr "" #. type: include #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/ert.texi:1167 #, no-wrap msgid "doclicense.texi" msgstr ""