Unit test for the mandatory part of minishell (42cursus project)
Your executable must support the -c
option, which allows you to pass commands as a string (man bash)
- Clone this repository at the root of your minishell project
./unit_test.sh
inside this repository
-
--no-error
or-n
Does not test the stderr output, which is tested by default
You can run tests of a given section by doing:
--<test_section_name>
e.g.--builtins
Only errors in these tests will be written in the log file. Note that you can combine them./unit_test.sh --n --builtins --quotes
will only run the builtins and quotes tests and won't test the stderr output
--help
or-h
Shows the script usage, mainly the names of each test section and its abreviation
-
For each test, stdout and stderr of your minishell and real bash will be compared, along with their return codes. For a test to be passed, you need to have the same return code of bash, as well as the same output in the stdout.
-
If the stderr differs, you will see [FAIL] on the stderr column, but that won't affect the previous result of the test. If the stderr is empty or if it doesn't differs, stderr column will be empty.