diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2020-09-14 21:35:25 +0200 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2020-09-14 21:35:25 +0200 |
| commit | fec33d1621e01e12a7dc64630477318213218ae7 (patch) | |
| tree | beaa18fda09bfc2c13aa1e3a4173370fc9bd15a1 /src/suites | |
| parent | 55fab322485f67112c789a4a529765b5e6635238 (diff) | |
| download | minishell_test-fec33d1621e01e12a7dc64630477318213218ae7.tar.gz minishell_test-fec33d1621e01e12a7dc64630477318213218ae7.tar.bz2 minishell_test-fec33d1621e01e12a7dc64630477318213218ae7.zip | |
Added more flow and path tests
Diffstat (limited to 'src/suites')
| -rw-r--r-- | src/suites/flow.py | 19 | ||||
| -rw-r--r-- | src/suites/path.py | 18 | ||||
| -rw-r--r-- | src/suites/preprocess.py | 4 |
3 files changed, 33 insertions, 8 deletions
diff --git a/src/suites/flow.py b/src/suites/flow.py index 55c5647..f92160a 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/13 17:19:09 by charles ### ########.fr # +# Updated: 2020/09/14 21:33:02 by charles ### ########.fr # # # # ############################################################################ # @@ -36,6 +36,10 @@ def suite_end(test): test("ls doesnotexists; echo bonjour") test("echo bonjour; ls doesnotexists") test("echo a ; ;", hook=hooks.error_line0) + test("ls " + 40 * " ; ls", setup="touch a b c") + test("ls " + 80 * " ; ls", setup="touch a b c") + test("ls " + 40 * " ; ls" + ";", setup="touch a b c") + test("ls " + 80 * " ; ls" + ";", setup="touch a b c") @suite() @@ -60,10 +64,8 @@ def suite_pipe(test): test(" | cat", hook=hooks.error_line0) test("echo a | export A=a; echo $A") test("export A=a | cat; echo $A") - # test("echo a | A=a; echo $A") - # test("A=a | cat; echo $A") - test("ls " + 40 * " | ls") - test("ls " + 80 * " | ls") + test("ls " + 40 * " | ls", setup="touch a b c") + test("ls " + 80 * " | ls", setup="touch a b c") test("echo bonjour " + 40 * " | cat -e") test("echo bonjour " + 80 * " | cat -e") test("echo bonjour | | cat -e", hook=hooks.error_line0) @@ -90,6 +92,8 @@ def suite_and(test): test("ls doesnotexists && echo bonjour") test("ls doesnotexists&& echo bonjour") test("echo bonjour&& ls doesnotexists") + test("ls " + 40 * " && ls", setup="touch a b c") + test("ls " + 80 * " && ls", setup="touch a b c") @suite(bonus=True) @@ -113,6 +117,8 @@ def suite_or(test): test("ls doesnotexists || echo bonjour") test("ls doesnotexists|| echo bonjour") test("echo bonjour|| ls doesnotexists") + test("ls asdf" + 40 * " || ls asdf", setup="touch a b c") + test("ls asdf" + 80 * " || ls asdf", setup="touch a b c") @suite(bonus=True) @@ -157,4 +163,5 @@ 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 bonjour ; echo aurevoir) | (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") diff --git a/src/suites/path.py b/src/suites/path.py index 0e143dd..d2c9272 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/11 20:13:09 by charles ### ########.fr # +# Updated: 2020/09/14 19:28:30 by charles ### ########.fr # # # # ############################################################################ # @@ -67,3 +67,19 @@ def suite_path(test): test("ls", exports={"PATH": " "}) test("ls", exports={"PATH": " : "}) test("ls", exports={"PATH": " /bin "}) + test("ls", exports={"PATH": "/bin:/bin:/bin:/bin"}) + test("ls", exports={"PATH": ""}) + test("ls", exports={"PATH": ":"}) + test("ls", exports={"PATH": ":::::::::::::::::::"}) + test("ls", exports={"PATH": "/asdfasdf"}) + test("ls", exports={"PATH": "/usr/asdf:/usr/lib/asdfasdf"}) + test("ls", setup="unset PATH") + test("somecmd", setup="echo '#!/bin/sh\necho bonjour' > somecmd; chmod +x somecmd", exports={"PATH": ""}) + test("somecmd", setup="echo '#!/bin/sh\necho bonjour' > somecmd; chmod +x somecmd", exports={"PATH": ":"}) + test("somecmd", setup="echo '#!/bin/sh\necho bonjour' > somecmd; chmod +x somecmd", exports={"PATH": "::::::::"}) + test("somecmd", setup="echo '#!/bin/sh\necho bonjour' > somecmd; chmod +x somecmd", exports={"PATH": "/asdfasdf"}) + test("somecmd", setup="echo '#!/bin/sh\necho bonjour' > somecmd; chmod +x somecmd", exports={"PATH": "/usr/asdf:/usr/lib/asdfasdf"}) + test("somecmd", setup="echo '#!/bin/sh\necho bonjour' > somecmd; chmod +x somecmd; unset PATH") + test("somecmd", setup="echo '#!/bin/sh\necho bonjour' > somecmd; chmod +x somecmd", exports={"PATH": "/bin:"}) + test("somecmd", setup="echo '#!/bin/sh\necho bonjour' > somecmd; chmod +x somecmd", exports={"PATH": ":/bin"}) + test("somecmd", setup="echo '#!/bin/sh\necho bonjour' > somecmd; chmod +x somecmd", exports={"PATH": ":/bin:"}) diff --git a/src/suites/preprocess.py b/src/suites/preprocess.py index 8dac56b..27a27a4 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/13 12:20:37 by charles ### ########.fr # +# Updated: 2020/09/14 15:15:53 by charles ### ########.fr # # # # **************************************************************************** # @@ -63,6 +63,8 @@ def suite_quote(test): test('echo """""""""""""""""""""""""""""""""""""""""""', hook=hooks.error_line0) test("echo 'AH\\'") test('echo "AH\\"') + test("echo '\\''") + test('echo "\\""') @suite() |
