diff options
Diffstat (limited to 'src/suites/builtin.py')
| -rw-r--r-- | src/suites/builtin.py | 79 |
1 files changed, 38 insertions, 41 deletions
diff --git a/src/suites/builtin.py b/src/suites/builtin.py index e9ac3a2..95e9ed5 100644 --- a/src/suites/builtin.py +++ b/src/suites/builtin.py @@ -6,6 +6,7 @@ # By: juligonz <juligonz@student.42.fr> +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/07/15 18:24:43 by charles #+# #+# # +# Updated: 2020/09/11 18:45:03 by charles ### ########.fr # # Updated: 2020/09/11 18:01:27 by juligonz ### ########.fr # # # # **************************************************************************** # @@ -23,18 +24,15 @@ def suite_echo(test): test("echo lalalala lalalalal alalalalal alalalala") test("echo lalalala lalalalal alalalalal alalalala") test("echo " + config.LOREM) - test("echo -n") test("echo -n bonjour") test("echo -n lalalala lalalalal alalalalal alalalala") test("echo -n lalalala lalalalal alalalalal alalalala") test("echo -n " + config.LOREM) - test("echo bonjour -n") test("echo -n bonjour -n") test(" echo bonjour je") test(" echo -n bonjour je") - test("echo a '' b '' c '' d") test('echo a "" b "" c "" d') test("echo -n a '' b '' c '' d") @@ -43,9 +41,12 @@ def suite_echo(test): @suite() def suite_export(test): - test("export", hook=hooks.sort_lines) - # test("export A=; env | grep A=; echo $A") - # test("export A; env | grep A; echo $A") + test("export", hook=hooks.export_singleton) + test("export", exports={"A": ""}, hook=hooks.export_singleton) + test("export", exports={"A": "\""}, hook=hooks.export_singleton) + test("export", exports={"A": "\t"}, hook=hooks.export_singleton) + test("export", exports={"A": "'"}, hook=hooks.export_singleton) + test("export", exports={"A": "a"}, hook=hooks.export_singleton) test("export A=a; echo $A") test("export A=a B=b C=c; echo $A$B$C") test("export A=a B=b C=c D=d E=e F=f G=g H=h I=i J=j K=k L=l" + @@ -88,8 +89,6 @@ 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 'AH@'=nop") test("export \"AH'\"=nop") test("export 'AH\"'=nop") @@ -99,8 +98,17 @@ def suite_export(test): test("export 'AH;'=nop") test("export 'AH&'=nop") test("export 'AH\\'=nop") - test("export $TEST", exports={"TEST": "A=a"}) + test(r"export BONJOUR\\JESUIS") + test(r"export BONJOUR\'JESUIS") + test(r'export BONJOUR\"JESUIS') + test(r"export BONJOUR\$JESUIS") + test(r"export BONJOUR\&JESUIS") + test(r"export BONJOUR\|JESUIS") + test(r"export BONJOUR\;JESUIS") + test(r"export BONJOUR\_JESUIS") + test(r"export BONJOUR\0JESUIS") + @suite() def suite_cd(test): @@ -117,16 +125,11 @@ def suite_cd(test): test("cd '' ''; pwd; echo $PWD"); test("cd '' '' ''; pwd; echo $PWD"); test("cd ' '; pwd; echo $PWD"); - # test("cd '\t'; pwd; echo $PWD"); - # test("cd '\t \t\t\t '; pwd; echo $PWD"); test("cd d ''; pwd; echo $PWD", setup="mkdir d") test("cd d d; pwd; echo $PWD", setup="mkdir d") test("cd d ' '; pwd; echo $PWD", setup="mkdir d") test("cd $HOME; pwd; echo $PWD"); test("cd $HOME; pwd; echo $PWD", exports={"HOME": os.getenv("HOME")}); - # test("cd ~; pwd; echo $PWD"); # do we have to handle ~ ? - # test("cd ~/..; pwd; echo $PWD"); - # test("cd ~/../..; pwd; echo $PWD"); test("cd /; pwd; echo $PWD"); test("cd /.; pwd; echo $PWD"); test("cd /./; pwd; echo $PWD"); @@ -136,17 +139,14 @@ def suite_cd(test): test("cd ////; pwd; echo $PWD"); test("cd //////////////////////////////////////////////////////; pwd; echo $PWD"); test("cd") - test("cd ' /'; pwd; echo $PWD") test("cd ' / '; pwd; echo $PWD") test("cd ' /'; pwd; echo $PWD") test("cd ' / '; pwd; echo $PWD") test("cd ' // '; pwd; echo $PWD") - test("cd //home; pwd; echo $PWD") test("cd ' //home'; pwd; echo $PWD") test("cd ' //home '; pwd; echo $PWD") - test("cd d", setup="mkdir -m 000 d") test("cd d", setup="mkdir -m 001 d") test("cd d", setup="mkdir -m 002 d") @@ -169,14 +169,12 @@ def suite_cd(test): test("cd d", setup="mkdir -m 500 d") test("cd d", setup="mkdir -m 600 d") test("cd d", setup="mkdir -m 700 d") - test("cd d", setup="mkdir -m 755 d") test("cd d", setup="mkdir -m 644 d") test("cd d", setup="mkdir -m 311 d") test("cd d", setup="mkdir -m 111 d") test("cd d", setup="mkdir -m 222 d") test("cd d", setup="mkdir -m 333 d") - test("cd d", setup="mkdir -m 0777 d") test("cd d", setup="mkdir -m 1000 d") test("cd d", setup="mkdir -m 2000 d") @@ -193,31 +191,36 @@ def suite_cd(test): test("cd d", setup="mkdir -m 6777 d") test("cd d", setup="mkdir -m 7777 d") test("cd d", setup="mkdir -m 0000 d") + # test("cd '\t'; pwd; echo $PWD"); + # test("cd '\t \t\t\t '; pwd; echo $PWD"); + # test("cd ~; pwd; echo $PWD"); # do we have to handle ~ ? + # test("cd ~/..; pwd; echo $PWD"); + # test("cd ~/../..; pwd; echo $PWD"); + @suite() def suite_unset(test): test("unset") - test("unset A; echo $A", setup="export A=a") - test("unset 'A '; echo $A", setup="export A=a") - test("unset 'A='; echo $A", setup="export A=a") - test("unset A B C; echo $A$B$C", setup="export A=a B=b C=c") + test("unset A; echo $A", exports={"A": "a"}) + test("unset 'A '; echo $A", exports={"A": "a"}) + test("unset 'A='; echo $A", exports={"A": "a"}) + test("unset A B C; echo $A$B$C", exports={"A": "a", "B": "b", "C": "c"}) test("unset A 'asdf ' B ' asdf asdf asd f' ' asdf ' '' 'asdf ' C; echo $A$B$C", - setup="export A=a B=b C=c") + exports={"A": "a", "B": "b", "C": "c"}) test("unset 'asdf ' B ' asdf asdf asd f' ' asdf ' '' 'asdf ' C; echo $A$B$C", - setup="export A=a B=b C=c") + exports={"A": "a", "B": "b", "C": "c"}) test("unset A 'asdf ' B ' asdf asdf asd f' ' asdf ' '' 'asdf '; echo $A$B$C", - setup="export A=a B=b C=c") - test("unset A; echo $A$B$C", setup="export A=a B=b C=c") - test("unset C; echo $A$B$C", setup="export A=a B=b C=c") - - test("unset A B C", setup="export A=a B=b C=c") + exports={"A": "a", "B": "b", "C": "c"}) + test("unset A; echo $A$B$C", exports={"A": "a", "B": "b", "C": "c"}) + test("unset C; echo $A$B$C", exports={"A": "a", "B": "b", "C": "c"}) + test("unset A B C", exports={"A": "a", "B": "b", "C": "c"}) test("unset A 'asdf ' B ' asdf asdf asd f' ' asdf ' '' 'asdf ' C", - setup="export A=a B=b C=c") + exports={"A": "a", "B": "b", "C": "c"}) test("unset 'asdf ' B ' asdf asdf asd f' ' asdf ' '' 'asdf ' C", - setup="export A=a B=b C=c") + exports={"A": "a", "B": "b", "C": "c"}) test("unset A 'asdf ' B ' asdf asdf asd f' ' asdf ' '' 'asdf '", - setup="export A=a B=b C=c") - test("unset A", setup="export A=a B=b C=c") + exports={"A": "a", "B": "b", "C": "c"}) + test("unset A", exports={"A": "a", "B": "b", "C": "c"}) test("unset 'AH@'=nop") test("unset \"AH'\"=nop") @@ -238,7 +241,7 @@ def suite_pwd(test): test("pwd", setup="cd /") test("pwd", setup="cd $HOME") test("pwd | cat -e") - test("cd lnk; rmdir ../d; pwd", setup="mkdir d; ln -s d lnk") + # test("cd lnk; rmdir ../d; pwd", setup="mkdir d; ln -s d lnk") @suite() def suite_env(test): @@ -283,7 +286,6 @@ def suite_exit(test): test("exit 9223372036854775808") test("exit 18446744073709551615") test("exit 18446744073709551616") - test("exit +1") test("exit +2") test("exit +3") @@ -292,7 +294,6 @@ def suite_exit(test): test("exit +256") test("exit +2000000") test("exit +2147483647") - test("exit ++1") test("exit ++2") test("exit ++3") @@ -301,7 +302,6 @@ def suite_exit(test): test("exit ++256") test("exit ++2000000") test("exit ++2147483647") - test("exit --1") test("exit --2") test("exit --3") @@ -310,7 +310,6 @@ def suite_exit(test): test("exit --256") test("exit --2000000") test("exit --2147483647") - test("exit bonjour") test("exit 0_") test("exit _0") @@ -327,10 +326,8 @@ def suite_exit(test): "99999999999999999999999999999999999999999999") test("exit 99999999999999999999999999999999999999999999" + "99999999999999999999999999999999999999999999") - test("exit 0 bonjour") test("exit bonjour 0") test("exit 0 1") test("exit 0 1 2 3 4 5 6 7 8 9") - test("exit " + config.LOREM) |
