blob: 043c7a2d841a1ed2a166a5b190a5a866061247f8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
.. program:: minishell_test
minishell_test documentation
============================
.. toctree::
:maxdepth: 1
config
options
developers
.. include:: gettingstarted.rst
Environement variables
----------------------
This test only gives the ``PATH`` and ``TERM`` environment variables to your minishell by default (see :ref:`config env`).
You can test this quickly with :option:`--try`.
.. warning::
Please check that your project still work with this environment before creating an issue or messaging me on Slack.
Bonus
-----
See :ref:`config bonus`
See :ref:`options bonus`
Memory leaks
------------
See :ref:`options leaks`
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(...)
.. ```
..
|