diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2020-09-15 17:54:02 +0200 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2020-09-15 18:36:30 +0200 |
| commit | 12f385695e13bbb0dd65062fa371bd914acd7862 (patch) | |
| tree | 0d039e9308756049d3a3dca232079ac3c75726a4 /src/suites | |
| parent | 572c2e7218a21a6fa711d9b654a8f74163a77e69 (diff) | |
| download | minishell_test-12f385695e13bbb0dd65062fa371bd914acd7862.tar.gz minishell_test-12f385695e13bbb0dd65062fa371bd914acd7862.tar.bz2 minishell_test-12f385695e13bbb0dd65062fa371bd914acd7862.zip | |
Added more parenthesis, pipe, quote tests
Diffstat (limited to 'src/suites')
| -rw-r--r-- | src/suites/builtin.py | 3 | ||||
| -rw-r--r-- | src/suites/flow.py | 19 | ||||
| -rw-r--r-- | src/suites/path.py | 6 | ||||
| -rw-r--r-- | src/suites/preprocess.py | 12 |
4 files changed, 31 insertions, 9 deletions
diff --git a/src/suites/builtin.py b/src/suites/builtin.py index fdc3a08..3aecfb9 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/09/15 11:44:48 by charles ### ########.fr # +# Updated: 2020/09/15 17:29:35 by charles ### ########.fr # # Updated: 2020/09/11 18:01:27 by juligonz ### ########.fr # # # # **************************************************************************** # @@ -91,6 +91,7 @@ def suite_export(test): test("export 'asdf ' B ' asdf asdf asd f' ' asdf ' '' 'asdf ' C; echo $A$B$C") test("export A 'asdf ' B ' asdf asdf asd f' ' asdf ' '' 'asdf '; echo $A$B$C") test("export A B C; echo $A$B$C") + test("export A B C; env", hook=hooks.sort_lines) test("export 'AH@'=nop") test("export \"AH'\"=nop") test("export 'AH\"'=nop") diff --git a/src/suites/flow.py b/src/suites/flow.py index f92160a..ec4167c 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/09/14 21:33:02 by charles ### ########.fr # +# Updated: 2020/09/15 16:45:47 by charles ### ########.fr # # # # ############################################################################ # @@ -48,6 +48,9 @@ def suite_pipe(test): test("cat -e /etc/shells | head -c 10") test("cat -e /etc/shells | cat -e | head -c 10") test("cat -e /etc/shells | cat -e | cat -e | head -c 10") + test("cat -e /dev/random | head -c 10", hook=hooks.discard) + test("cat -e /dev/random | cat -e | head -c 10", hook=hooks.discard) + test("cat -e /dev/random | cat -e | cat -e | head -c 10", hook=hooks.discard) test("echo bonjour | cat") test("echo bonjour | cat -e") test("echo bonjour | cat -e | cat -e | cat -e | cat -e | cat -e | cat -e | cat -e") @@ -163,5 +166,17 @@ def suite_parenthesis(test): test("(echo a; echo b) | cat -e") test("echo bonjour | (cat -e; echo a)") test("echo bonjour | (echo a; cat -e)") + test("(echo a) | (cat -e)") + test("(echo a; echo b) | (cat -e)") + test("(echo a) | (cat -e | cat -e)") + test("(echo a; echo b) | (cat -e | cat -e)") + test("(echo a; echo b) | cat -e | cat -e") + test("(echo a); (echo b) | (cat -e) | (cat -e)") + test("echo a | (cat -e | cat -e | cat -e)") + test("echo a | (cat -e | cat -e | cat -e) | cat -e") + test("(echo a) | (cat -e | cat -e | cat -e) | cat -e") + test("(echo a) | (cat -e | cat -e | cat -e) | (cat -e)") # test("(echo bonjour ; echo aurevoir) | (cat -e | cat -e) | cat -e") - test("( echo salut && echo bonjours ) ; echo comment ca va") + test("( echo salut && echo bonjours ) ; echo comment ca va") + test("(cd /; echo $PWD; pwd); echo $PWD; pwd") + test("(export A=a; echo $A); echo $A") diff --git a/src/suites/path.py b/src/suites/path.py index 2c38c5c..c0d8c91 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/09/15 13:37:17 by charles ### ########.fr # +# Updated: 2020/09/15 14:10:37 by charles ### ########.fr # # # # ############################################################################ # @@ -64,6 +64,10 @@ def suite_path(test): test("b", setup="mkdir path && ln -s /bin/whoami ./path/b", exports={"PATH": "path"}) test("a", setup="mkdir path && mkfifo path/a") test("a", setup="mkdir path && mkfifo path/a && chmod 777 path/a") + test("a", setup="mkdir path1 path2 && cp /bin/whoami path1/a" + "&& cp /bin/whoami path2/a && chmod 000 path1/a", exports={"PATH": "path1:path2"}) + test("a", setup="mkdir path1 path2 && cp /bin/whoami path1/a" + "&& cp /bin/whoami path2/a && chmod 000 path1/a", exports={"PATH": "path2:path1"}) @suite() diff --git a/src/suites/preprocess.py b/src/suites/preprocess.py index 27a27a4..bf88c49 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/09/14 15:15:53 by charles ### ########.fr # +# Updated: 2020/09/15 18:34:34 by charles ### ########.fr # # # # **************************************************************************** # @@ -62,9 +62,11 @@ def suite_quote(test): test("echo '''''''''''''''''''''''''''''''''''''''''''", hook=hooks.error_line0) test('echo """""""""""""""""""""""""""""""""""""""""""', hook=hooks.error_line0) test("echo 'AH\\'") - test('echo "AH\\"') - test("echo '\\''") + test('echo "AH\\"', hook=hooks.error_line0) + test('echo "AH\\""') + test("echo '\\''", hook=hooks.error_line0) test('echo "\\""') + test('echo "\\\\""', hook=hooks.error_line0) @suite() @@ -185,7 +187,6 @@ def suite_escape(test): test(r" \ echo bonjour") test(r" \ echo bonjour") test(r" \ echo bonjour") - test(r'/bin/echo " \ "') test(r'/bin/echo " \" "') test(r'/bin/echo " \' "') @@ -204,7 +205,6 @@ def suite_escape(test): test(r'/bin/echo " \\\\\\ "') test(r'/bin/echo " \\\\\\\ "') test(r'/bin/echo " \\\\\\\\ "') - test(r"/bin/echo ' \ '") test(r"/bin/echo ' \" '") test(r"/bin/echo ' \a '") @@ -217,6 +217,8 @@ def suite_escape(test): test(r"/bin/echo ' \$? '") test(r"/bin/echo ' \\ '") test(r"/bin/echo ' \\\ '") + test("echo \\") + test("echo \"\\\"\"'bonjour'") @suite() |
