diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2021-03-03 17:25:46 +0100 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2021-03-03 17:25:46 +0100 |
| commit | 422c56fbc5cd7493aaa96a341ebfff077f7a7de3 (patch) | |
| tree | 199c9dbb084b36b6d85774869076484305dc449a /minishell_test/suites/builtin.py | |
| parent | 820102f9ccdfdfe3ae78c22f803da4db87cb91ba (diff) | |
| download | minishell_test-422c56fbc5cd7493aaa96a341ebfff077f7a7de3.tar.gz minishell_test-422c56fbc5cd7493aaa96a341ebfff077f7a7de3.tar.bz2 minishell_test-422c56fbc5cd7493aaa96a341ebfff077f7a7de3.zip | |
Added config tests
Diffstat (limited to 'minishell_test/suites/builtin.py')
| -rw-r--r-- | minishell_test/suites/builtin.py | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/minishell_test/suites/builtin.py b/minishell_test/suites/builtin.py index 900bd93..8310ce4 100644 --- a/minishell_test/suites/builtin.py +++ b/minishell_test/suites/builtin.py @@ -66,14 +66,14 @@ 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) - 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", hooks=hooks.export_singleton) + test("export", exports={"A": ""}, hooks=hooks.export_singleton) + test("export", exports={"A": "\""}, hooks=hooks.export_singleton) + test("export", exports={"A": "\\"}, hooks=hooks.export_singleton) + test("export", exports={"A": "$"}, hooks=hooks.export_singleton) + test("export", exports={"A": "\t"}, hooks=hooks.export_singleton) + test("export", exports={"A": "'"}, hooks=hooks.export_singleton) + test("export", exports={"A": "a"}, hooks=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" @@ -116,7 +116,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 A B C; env", hooks=hooks.sort_lines) test("export 'AH@'=nop") test("export \"AH'\"=nop") test("export 'AH\"'=nop") @@ -157,18 +157,18 @@ def suite_cd(test): # hard and weird to implement with pwd # test("cd /etc; pwd; echo $PWD") test("echo $PWD; echo $OLDPWD; cd ''; pwd; echo $PWD; echo $OLDPWD") - test("echo $PWD; echo $OLDPWD; cd '' ''; pwd; echo $PWD; echo $OLDPWD", hook=linux_discard) - test("echo $PWD; echo $OLDPWD; cd '' '' ''; pwd; echo $PWD; echo $OLDPWD", hook=linux_discard) + test("echo $PWD; echo $OLDPWD; cd '' ''; pwd; echo $PWD; echo $OLDPWD", hooks=linux_discard) + test("echo $PWD; echo $OLDPWD; cd '' '' ''; pwd; echo $PWD; echo $OLDPWD", hooks=linux_discard) test("echo $PWD; echo $OLDPWD; cd ' '; pwd; echo $PWD; echo $OLDPWD") - test("echo $PWD; echo $OLDPWD; cd d ''; pwd; echo $PWD; echo $OLDPWD", setup="mkdir d", hook=linux_discard) - test("echo $PWD; echo $OLDPWD; cd d d; pwd; echo $PWD; echo $OLDPWD", setup="mkdir d", hook=linux_discard) - test("echo $PWD; echo $OLDPWD; cd d ' '; pwd; echo $PWD; echo $OLDPWD", setup="mkdir d", hook=linux_discard) + test("echo $PWD; echo $OLDPWD; cd d ''; pwd; echo $PWD; echo $OLDPWD", setup="mkdir d", hooks=linux_discard) + test("echo $PWD; echo $OLDPWD; cd d d; pwd; echo $PWD; echo $OLDPWD", setup="mkdir d", hooks=linux_discard) + test("echo $PWD; echo $OLDPWD; cd d ' '; pwd; echo $PWD; echo $OLDPWD", setup="mkdir d", hooks=linux_discard) test("echo $PWD; echo $OLDPWD; cd $HOME; pwd; echo $PWD; echo $OLDPWD", exports={"HOME": os.getenv("HOME")}) test("echo $PWD; echo $OLDPWD; cd /; pwd; echo $PWD; echo $OLDPWD") test("echo $PWD; echo $OLDPWD; cd /.; pwd; echo $PWD; echo $OLDPWD") test("echo $PWD; echo $OLDPWD; cd /./; pwd; echo $PWD; echo $OLDPWD") test("echo $PWD; echo $OLDPWD; cd /././././; pwd; echo $PWD; echo $OLDPWD") - test("echo $PWD; echo $OLDPWD; cd //; pwd; echo $PWD; echo $OLDPWD", hook=hooks.replace_double("/")) + test("echo $PWD; echo $OLDPWD; cd //; pwd; echo $PWD; echo $OLDPWD", hooks=hooks.replace_double("/")) test("echo $PWD; echo $OLDPWD; cd ///; pwd; echo $PWD; echo $OLDPWD") test("echo $PWD; echo $OLDPWD; cd ////; pwd; echo $PWD; echo $OLDPWD") test("echo $PWD; echo $OLDPWD; cd //////////////////////////////////////////////////////; pwd; echo $PWD; echo $OLDPWD") @@ -179,7 +179,7 @@ def suite_cd(test): test("echo $PWD; echo $OLDPWD; cd ' /'; pwd; echo $PWD; echo $OLDPWD") test("echo $PWD; echo $OLDPWD; cd ' / '; pwd; echo $PWD; echo $OLDPWD") test("echo $PWD; echo $OLDPWD; cd ' // '; pwd; echo $PWD; echo $OLDPWD") - test("echo $PWD; echo $OLDPWD; cd //home; pwd; echo $PWD; echo $OLDPWD", hook=hooks.replace_double("/")) + test("echo $PWD; echo $OLDPWD; cd //home; pwd; echo $PWD; echo $OLDPWD", hooks=hooks.replace_double("/")) test("echo $PWD; echo $OLDPWD; cd ' //home'; pwd; echo $PWD; echo $OLDPWD") test("echo $PWD; echo $OLDPWD; cd ' //home '; pwd; echo $PWD; echo $OLDPWD") test("echo $PWD; echo $OLDPWD; cd d; echo $OLDPWD", setup="mkdir -m 000 d") @@ -302,10 +302,10 @@ 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]) - test("env | cat -e", setup="export A=a B=b C=c", hook=[hooks.sort_lines, hooks.shlvl_0_to_1]) + test("env", hooks=[hooks.sort_lines, hooks.shlvl_0_to_1]) + test("env", setup="export A=a", hooks=[hooks.sort_lines, hooks.shlvl_0_to_1]) + test("env", setup="export A=a B=b C=c", hooks=[hooks.sort_lines, hooks.shlvl_0_to_1]) + test("env | cat -e", setup="export A=a B=b C=c", hooks=[hooks.sort_lines, hooks.shlvl_0_to_1]) test("Env") test("enV") test("Env", exports={"PATH": "/bin:/usr/bin"}) |
