diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2020-10-08 08:43:12 +0200 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2020-10-08 08:43:12 +0200 |
| commit | c20cbfea9bb878fc88e76f0ba773ded5a7b149ca (patch) | |
| tree | a49139c7f4a85cfab07df1d41be15a0275010fe6 /src/suites | |
| parent | 0cf5d76836a6499de4e30c4066d8709099ff6331 (diff) | |
| download | minishell_test-c20cbfea9bb878fc88e76f0ba773ded5a7b149ca.tar.gz minishell_test-c20cbfea9bb878fc88e76f0ba773ded5a7b149ca.tar.bz2 minishell_test-c20cbfea9bb878fc88e76f0ba773ded5a7b149ca.zip | |
Added suite description for -l option
Diffstat (limited to 'src/suites')
| -rw-r--r-- | src/suites/builtin.py | 9 | ||||
| -rw-r--r-- | src/suites/cmd.py | 6 | ||||
| -rw-r--r-- | src/suites/flow.py | 7 | ||||
| -rw-r--r-- | src/suites/path.py | 4 | ||||
| -rw-r--r-- | src/suites/preprocess.py | 6 |
5 files changed, 27 insertions, 5 deletions
diff --git a/src/suites/builtin.py b/src/suites/builtin.py index e90b798..932375b 100644 --- a/src/suites/builtin.py +++ b/src/suites/builtin.py @@ -6,7 +6,7 @@ # By: juligonz <juligonz@student.42.fr> +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/07/15 18:24:43 by charles #+# #+# # -# Updated: 2020/10/07 11:56:46 by cacharle ### ########.fr # +# Updated: 2020/10/08 08:40:18 by cacharle ### ########.fr # # Updated: 2020/09/11 18:01:27 by juligonz ### ########.fr # # # # **************************************************************************** # @@ -20,6 +20,7 @@ from suite import suite @suite() def suite_echo(test): + """ echo builtin tests """ test("echo") test("echo bonjour") test("echo lalalala lalalalal alalalalal alalalala") @@ -43,6 +44,7 @@ def suite_echo(test): @suite() def suite_export(test): + """ export builtin tests """ test("export", hook=hooks.export_singleton) test("export", exports={"A": ""}, hook=hooks.export_singleton) test("export", exports={"A": "\""}, hook=hooks.export_singleton) @@ -115,6 +117,7 @@ def suite_export(test): @suite() def suite_cd(test): + """ cd builtin tests """ test("cd .; pwd; echo $PWD") test("cd ..; pwd; echo $PWD") test("cd ../..; pwd; echo $PWD") @@ -205,6 +208,7 @@ def suite_cd(test): @suite() def suite_unset(test): + """ unset builtin tests """ test("unset") test("unset A; echo $A", exports={"A": "a"}) test("unset 'A '; echo $A", exports={"A": "a"}) @@ -239,6 +243,7 @@ def suite_unset(test): @suite() def suite_pwd(test): + """ pwd builtin tests """ test("pwd") test("pwd", setup="cd ..") test("pwd", setup="cd ../..") @@ -252,6 +257,7 @@ def suite_pwd(test): @suite() def suite_env(test): + """ env builtin tests """ test("env", hook=[hooks.sort_lines, hooks.shlvl_0_to_1]) test("env", setup="export A=a", hook=[hooks.sort_lines, hooks.shlvl_0_to_1]) test("env", setup="export A=a B=b C=c", hook=[hooks.sort_lines, hooks.shlvl_0_to_1]) @@ -260,6 +266,7 @@ def suite_env(test): @suite() def suite_exit(test): + """ exit builtin tests """ test("exit") test("exit 1") test("exit 2") diff --git a/src/suites/cmd.py b/src/suites/cmd.py index 25ca49b..c4db2a8 100644 --- a/src/suites/cmd.py +++ b/src/suites/cmd.py @@ -6,7 +6,7 @@ # By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/07/15 15:11:46 by charles #+# #+# # -# Updated: 2020/10/07 08:11:04 by charles ### ########.fr # +# Updated: 2020/10/08 08:39:36 by cacharle ### ########.fr # # # # ############################################################################ # @@ -19,6 +19,7 @@ from suite import suite @suite() def suite_redirection(test): + """ append/write/read redirections """ test("echo bonjour > test", setup="", files=["test"]) test("echo > test bonjour", setup="", files=["test"]) test("> test echo bonjour", setup="", files=["test"]) @@ -87,6 +88,7 @@ def suite_redirection(test): @suite() def suite_cmd(test): + """ long cmd, cmd not found tests """ test("notfound") test("notfound a b c") test('echo "\\"" >>a"b""c" ', files=["abc"]) @@ -105,6 +107,7 @@ def suite_cmd(test): @suite() def suite_status(test): + """ $? tests """ test("echo $?") test("echo; echo $?") test("notfound; echo $?") @@ -118,6 +121,7 @@ def suite_status(test): @suite() def suite_cmd_path(test): + """ cmd is a relative path, permissions on executable """ ls_path = distutils.spawn.find_executable("ls") cat_path = distutils.spawn.find_executable("cat") test(ls_path, setup="touch a b c") diff --git a/src/suites/flow.py b/src/suites/flow.py index d1b70d7..bcee31e 100644 --- a/src/suites/flow.py +++ b/src/suites/flow.py @@ -6,7 +6,7 @@ # By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/07/15 18:24:52 by charles #+# #+# # -# Updated: 2020/10/07 11:59:21 by cacharle ### ########.fr # +# Updated: 2020/10/08 08:40:56 by cacharle ### ########.fr # # # # ############################################################################ # @@ -16,6 +16,7 @@ from hooks import error_line0, platform_status, discard, replace_double_semi_col @suite() def suite_end(test): + """ `;` tests """ test("echo bonjour; echo je") test("echo bonjour ;echo je") test("echo bonjour ; echo je") @@ -54,6 +55,7 @@ def suite_end(test): @suite() def suite_pipe(test): + """ `|` tests """ test("cat /etc/shells | head -c 10") test("cat -e /etc/shells | head -c 10") test("cat -e /etc/shells | cat -e | head -c 10") @@ -93,6 +95,7 @@ def suite_pipe(test): @suite(bonus=True) def suite_and(test): + """ `&&` tests """ test("echo bonjour&& echo je") test("echo bonjour &&echo je") test("echo bonjour && echo je") @@ -118,6 +121,7 @@ def suite_and(test): @suite(bonus=True) def suite_or(test): + """ `||` tests """ test("echo bonjour|| echo je") test("echo bonjour ||echo je") test("echo bonjour || echo je") @@ -143,6 +147,7 @@ def suite_or(test): @suite(bonus=True) def suite_parenthesis(test): + """ `(`, `)` tests """ test("(echo bonjour)") test("(echo bonjour )") test("( echo bonjour )") diff --git a/src/suites/path.py b/src/suites/path.py index d5dabb6..13866de 100644 --- a/src/suites/path.py +++ b/src/suites/path.py @@ -6,7 +6,7 @@ # By: charles <me@cacharle.xyz> +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/09/09 15:12:58 by charles #+# #+# # -# Updated: 2020/10/07 15:16:49 by cacharle ### ########.fr # +# Updated: 2020/10/08 08:41:38 by cacharle ### ########.fr # # # # ############################################################################ # @@ -17,6 +17,7 @@ from suite import suite @suite() def suite_path(test): + """ searching a command in the path tests """ whoami_path = distutils.spawn.find_executable("which") mode_fmt = ("mkdir path && cp " + whoami_path + @@ -78,6 +79,7 @@ def suite_path(test): @suite() def suite_path_variable(test): + """ $PATH environment variable tests """ test("echo $PATH", exports={"PATH": "doesnotexits"}) test("echo $PATH", exports={"PATH": "doesnotexits:asdfasdfas"}) test("echo $PATH", exports={"PATH": "a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:p:q:r:s:t:u:v:w:x:y:z"}) diff --git a/src/suites/preprocess.py b/src/suites/preprocess.py index 506cb32..3b70666 100644 --- a/src/suites/preprocess.py +++ b/src/suites/preprocess.py @@ -6,7 +6,7 @@ # By: juligonz <juligonz@student.42.fr> +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/07/15 18:25:00 by charles #+# #+# # -# Updated: 2020/10/07 08:27:57 by charles ### ########.fr # +# Updated: 2020/10/08 08:37:19 by cacharle ### ########.fr # # # # **************************************************************************** # @@ -17,6 +17,7 @@ from suite import suite @suite() def suite_quote(test): + """ double and single quote test, escape in quotes, quote missmatch """ test("'echo' 'bonjour'") test("'echo' 'je' 'suis' 'charles'") test('"echo" "bonjour"') @@ -71,6 +72,7 @@ def suite_quote(test): @suite() def suite_interpolation(test): + """environment variable interpolation tests, valid name, escape in variable""" test("echo $TEST", exports={"TEST": "bonjour"}) test("echo $TES", exports={"TEST": "bonjour"}) test("echo $TEST_", exports={"TEST": "bonjour"}) @@ -168,6 +170,7 @@ def suite_interpolation(test): @suite() def suite_escape(test): + """ escape test, in command, with space, before quote """ test(r"echo \a") test(r"\e\c\h\o bonjour") test(r"echo charles\ ") @@ -223,6 +226,7 @@ def suite_escape(test): @suite() def suite_spaces(test): + """ field splitting with spaces and tabs """ test("echo foo") test("echo foo") test(" echo foo") |
