diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2021-02-28 18:22:56 +0100 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2021-02-28 18:22:56 +0100 |
| commit | ed231c21894da3520929fc385027d57bbe0485a2 (patch) | |
| tree | 78cad4d2b85ac3baf951292225752ccd14acc2c3 /docs/index.rst | |
| parent | b1e0674c4f91c39c426a145686c1c37f57528b46 (diff) | |
| download | minishell_test-ed231c21894da3520929fc385027d57bbe0485a2.tar.gz minishell_test-ed231c21894da3520929fc385027d57bbe0485a2.tar.bz2 minishell_test-ed231c21894da3520929fc385027d57bbe0485a2.zip | |
Merging common content between README.rst and index.rst in gettingstarted.rst
Diffstat (limited to 'docs/index.rst')
| -rw-r--r-- | docs/index.rst | 102 |
1 files changed, 41 insertions, 61 deletions
diff --git a/docs/index.rst b/docs/index.rst index 7726f0a..043c7a2 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,73 +1,16 @@ .. program:: minishell_test -minishell_test -============== - -Test for 42 school's minishell project. - -.. .. image:: https://i.imgur.com/98xh2xY.gif - -Getting Started ---------------- - -Installation -++++++++++++ - -.. code-block:: - - $ pip3 install minishell-test - $ pip3 install --user minishell-test # if you don't have root access - -Compatibility -+++++++++++++ - -Your executable **must** support the ``-c`` option which allow to pass command as string. - -.. code-block:: - - $ bash -c 'echo bonjour je suis | cat -e' - bonjour je suis$ - $ ./minishell -c 'echo bonjour je suis | cat -e' - bonjour je suis$ - - -.. note:: - With this setup ``argv[2]`` is what you would usually get in ``line`` from ``get_next_line``. - -Usage -+++++ - -Run all the predefined tests: - -.. code-block:: - - $ cd <MINISHELL> - $ minishell_test - -.. warning:: - If you get ``command not found``, do either of those things: - - * ``~/.local/bin`` to your ``PATH`` environment variable. - * run ``$ python3 -m minishell_test`` instead of ``$ minishell_test`` - - -Documentation -------------- +minishell_test documentation +============================ .. toctree:: - :maxdepth: 2 + :maxdepth: 1 config options developers - -.. code-block:: - - $ minishell_test --help - -The options are explained in more details in :ref:`options <options>`. - +.. include:: gettingstarted.rst Environement variables ---------------------- @@ -94,3 +37,40 @@ Linux ----- It will try to convert to output/status code of ``bash`` on Linux to the one on Mac. + +.. Add individual test +.. ------------------- +.. +.. In your suite function you can use the `test` function. With the following arguments: +.. +.. 1. Command to be tested (output and status will be compared to bash) +.. 2. A command to setup the sandbox directory where the tested command will be run +.. 3. List of files to watch (the content of each file will be compared) +.. +.. ```python +.. test("echo bonjour je suis") # simple command +.. test("cat < somefile", setup="echo file content > somefile") # setup +.. test("ls > somefile", setup="", files=["somefile"]) # watch a file +.. test("echo $A", exports={"A": "a"}) # export variables +.. # in the environment +.. test("echo bonjour", hook=lambda s: s.replace("o", "a")) # pass the shell output +.. # through a hook function +.. +.. test("cat < somefile > otherfile", +.. setup="echo file content > somefile", +.. files=["otherfile"]) +.. ``` +.. +.. ### Add Suite +.. +.. A test suite is a group of related tests. +.. +.. ```python +.. @suite() # @suite(bonus=True) if it's a bonus suite +.. def suite_yoursuitename(test): +.. """ a description of the suite """ +.. test(...) +.. test(...) +.. test(...) +.. ``` +.. |
