aboutsummaryrefslogtreecommitdiff
path: root/src/suites
diff options
context:
space:
mode:
Diffstat (limited to 'src/suites')
-rw-r--r--src/suites/builtin.py4
-rw-r--r--src/suites/flow.py6
-rw-r--r--src/suites/path.py17
3 files changed, 17 insertions, 10 deletions
diff --git a/src/suites/builtin.py b/src/suites/builtin.py
index c64a411..64d6ea6 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/09 08:34:18 by cacharle ### ########.fr #
+# Updated: 2020/10/09 08:48:28 by cacharle ### ########.fr #
# Updated: 2020/09/11 18:01:27 by juligonz ### ########.fr #
# #
# **************************************************************************** #
@@ -254,6 +254,8 @@ def suite_pwd(test):
test("pwd", setup="cd $HOME")
test("pwd | cat -e")
test("pwd", exports={"PWD": "/etc"})
+ test("unset PWD; pwd; echo $PWD")
+ test("export PWD=foo; pwd; echo $PWD")
# test("cd lnk; rmdir ../d; pwd", setup="mkdir d; ln -s d lnk")
diff --git a/src/suites/flow.py b/src/suites/flow.py
index a62cd9d..eb9eb30 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/08 17:33:32 by cacharle ### ########.fr #
+# Updated: 2020/10/09 08:51:57 by cacharle ### ########.fr #
# #
# ############################################################################ #
@@ -203,6 +203,10 @@ def suite_parenthesis(test):
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")
+ test("(cat /etc/shells) | (cat -e) | (cat -e) | (cat -e)")
+ test("(cat /etc/shells) | (cat -e) | (cat -e) | (cat -e) | (cat -e) | (cat -e) | (cat -e) | (cat -e) | (cat -e)")
+ test("(cat /etc/shells | (cat -e) | (cat -e) | (cat -e)", hook=[error_line0, error_eof_to_expected_token])
+ test("(cat /etc/shells) | (cat -e) | (cat -e | (cat -e)", hook=[error_line0, error_eof_to_expected_token])
@suite()
diff --git a/src/suites/path.py b/src/suites/path.py
index 13866de..5ac25ae 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/08 08:41:38 by cacharle ### ########.fr #
+# Updated: 2020/10/09 11:00:46 by cacharle ### ########.fr #
# #
# ############################################################################ #
@@ -19,9 +19,9 @@ from suite import 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 +
- " ./path/a && chmod {} ./path/a")
+ mode_fmt = ("mkdir path && cp "
+ + whoami_path
+ + " ./path/a && chmod {} ./path/a")
test("a", setup=mode_fmt.format("000"), exports={"PATH": "path"})
test("a", setup=mode_fmt.format("001"), exports={"PATH": "path"})
test("a", setup=mode_fmt.format("002"), exports={"PATH": "path"})
@@ -66,13 +66,13 @@ def suite_path(test):
test("a", setup=mode_fmt.format("6777"), exports={"PATH": "path"})
test("a", setup=mode_fmt.format("7777"), exports={"PATH": "path"})
test("a", setup=mode_fmt.format("0000"), exports={"PATH": "path"})
- test("b", setup="mkdir path && cp " + whoami_path + " ./path/a && ln -s ./path/a ./path/b",
- exports={"PATH": "path"})
+ # test("b", setup="mkdir path && cp " + whoami_path + " ./path/a && ln -s ./path/a ./path/b",
+ # exports={"PATH": "path"})
test("b", setup="mkdir path && ln -s " + whoami_path + " ./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 " + whoami_path + " path1/a"
- "&& cp " + whoami_path + " path2/a && chmod 000 path1/a", exports={"PATH": "path1:path2"})
+ # test("a", setup="mkdir path1 path2 && cp " + whoami_path + " path1/a"
+ # "&& cp " + whoami_path + " path2/a && chmod 000 path1/a", exports={"PATH": "path1:path2"})
test("a", setup="mkdir path1 path2 && cp " + whoami_path + " path1/a"
"&& cp " + whoami_path + " path2/a && chmod 000 path1/a", exports={"PATH": "path2:path1"})
@@ -106,6 +106,7 @@ def suite_path_variable(test):
test("whoami", exports={"PATH": " /sbin "})
test("whoami", exports={"PATH": "/sbin:/sbin:/sbin:/sbin"})
test("whoami", exports={"PATH": ""}) # error message explicit enough
+ test("unset PATH; whoami") # error message explicit enough
test("whoami", exports={"PATH": ":"})
test("whoami", exports={"PATH": ":::::::::::::::::::"})
test("whoami", exports={"PATH": "/asdfasdf"})