aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-06-16 09:32:35 +0200
committerCharles <sircharlesaze@gmail.com>2020-06-16 09:32:35 +0200
commitffbe2698bab198d8f621a9ad2c62a009b28bad9e (patch)
treeaf3d6f7d993ec1bf3b5ee22c09725f488bbf34d4 /README.md
parentf928d08ceda74011d387e755c12bf0256a572d8d (diff)
downloadminishell_test-ffbe2698bab198d8f621a9ad2c62a009b28bad9e.tar.gz
minishell_test-ffbe2698bab198d8f621a9ad2c62a009b28bad9e.tar.bz2
minishell_test-ffbe2698bab198d8f621a9ad2c62a009b28bad9e.zip
Added file watch and setup command
Diffstat (limited to 'README.md')
-rw-r--r--README.md41
1 files changed, 35 insertions, 6 deletions
diff --git a/README.md b/README.md
index 1da4fc9..ef87c35 100644
--- a/README.md
+++ b/README.md
@@ -4,12 +4,13 @@ Test for the minishell project of school 42.
# Usage
+`> ./main.py --help`
+`> ./main.py`
+
## Test compatibility
Your executable **must** support the `-c` option which allow to pass command as string.
-example:
-
```
> bash -c 'echo bonjour je suis'
bonjour je suis
@@ -26,10 +27,38 @@ The reasons for this:
1. You're free to set the prompt to whatever you want
2. Termcaps would be a nightmare to test
-## Run
+# Configuration
-`> ./main.py`
+The default configuration can be changed in [config.py](config.py)
-# Configuration
+# Add new tests
+
+## 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)
-The default configuration can be changed in <config.py>
+```
+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("cat < somefile > otherfile",
+ setup="echo file content > somefile",
+ files=["otherfile"])
+```
+
+## Add Suite
+
+A test suite is a group of related tests.
+
+```
+@suite
+def suite_yoursuitename():
+ test(...)
+ test(...)
+ test(...)
+```