From fb0a727a9885b80b855f470ae6d5c1bfac614439 Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Sat, 10 Oct 2020 13:49:21 +0200 Subject: Added SHLVL tests --- src/suite/suite.py | 10 +++---- src/suites/misc.py | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/suites/path.py | 3 +- 3 files changed, 91 insertions(+), 6 deletions(-) create mode 100644 src/suites/misc.py diff --git a/src/suite/suite.py b/src/suite/suite.py index 0dfff4e..a3cc8c0 100644 --- a/src/suite/suite.py +++ b/src/suite/suite.py @@ -6,7 +6,7 @@ # By: charles +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/07/15 18:24:29 by charles #+# #+# # -# Updated: 2020/10/09 11:00:32 by cacharle ### ########.fr # +# Updated: 2020/10/10 13:47:48 by cacharle ### ########.fr # # # # ############################################################################ # @@ -159,10 +159,10 @@ class Suite: continue pass_sum += pass_total fail_sum += fail_total - print("{:.<{width}} \033[32m{:3} [PASS]\033[0m \033[31m{:3} [FAIL]\033[0m" - .format(s.name + " ", pass_total, fail_total, width=config.TERM_COLS - 22)) - print("{:.<{width}} \033[32m{:3} [PASS]\033[0m \033[31m{:3} [FAIL]\033[0m" - .format("TOTAL ", pass_sum, fail_sum, width=config.TERM_COLS - 22)) + print("{:.<{width}} \033[32m{:4} [PASS]\033[0m \033[31m{:4} [FAIL]\033[0m" + .format(s.name + " ", pass_total, fail_total, width=config.TERM_COLS - 24)) + print("{:.<{width}} \033[32m{:4} [PASS]\033[0m \033[31m{:4} [FAIL]\033[0m" + .format("TOTAL ", pass_sum, fail_sum, width=config.TERM_COLS - 24)) @classmethod def save_log(cls): diff --git a/src/suites/misc.py b/src/suites/misc.py new file mode 100644 index 0000000..020069a --- /dev/null +++ b/src/suites/misc.py @@ -0,0 +1,84 @@ +# ############################################################################ # +# # +# ::: :::::::: # +# misc.py :+: :+: :+: # +# +:+ +:+ +:+ # +# By: cacharle +#+ +:+ +#+ # +# +#+#+#+#+#+ +#+ # +# Created: 2020/10/10 13:06:19 by cacharle #+# #+# # +# Updated: 2020/10/10 13:48:31 by cacharle ### ########.fr # +# # +# ############################################################################ # + +from suite import suite + +@suite() +def suite_shlvl(test): + """ test for the SHLVL variable """ + test("echo $SHLVL") + test("echo $SHLVL", exports={"SHLVL": ""}) + test("echo $SHLVL", exports={"SHLVL": " 1"}) + test("echo $SHLVL", exports={"SHLVL": " 2"}) + test("echo $SHLVL", exports={"SHLVL": " 3"}) + test("echo $SHLVL", exports={"SHLVL": " ' 3'"}) + test("echo $SHLVL", exports={"SHLVL": " '\t3'"}) + test("echo $SHLVL", exports={"SHLVL": " '\t\f\r 3'"}) + test("echo $SHLVL", exports={"SHLVL": " '3 '"}) + test("echo $SHLVL", exports={"SHLVL": " '3\t'"}) + test("echo $SHLVL", exports={"SHLVL": " '3\r'"}) + test("echo $SHLVL", exports={"SHLVL": " '3\t\f\r '"}) + test("echo $SHLVL", exports={"SHLVL": " '3 a'"}) + test("echo $SHLVL", exports={"SHLVL": " '3\t\t\ta'"}) + test("echo $SHLVL", exports={"SHLVL": " 0"}) + test("echo $SHLVL", exports={"SHLVL": " -0"}) + test("echo $SHLVL", exports={"SHLVL": " -1"}) + test("echo $SHLVL", exports={"SHLVL": " 255"}) + test("echo $SHLVL", exports={"SHLVL": " 256"}) + test("echo $SHLVL", exports={"SHLVL": " 2000000"}) + test("echo $SHLVL", exports={"SHLVL": " -2000000"}) + test("echo $SHLVL", exports={"SHLVL": " 2147483647"}) + test("echo $SHLVL", exports={"SHLVL": " -2147483648"}) + test("echo $SHLVL", exports={"SHLVL": " 2147483648"}) + test("echo $SHLVL", exports={"SHLVL": " -2147483649"}) + test("echo $SHLVL", exports={"SHLVL": " 3147483648"}) + test("echo $SHLVL", exports={"SHLVL": " -3147483649"}) + test("echo $SHLVL", exports={"SHLVL": " 4294967295"}) + test("echo $SHLVL", exports={"SHLVL": " 4294967296"}) + test("echo $SHLVL", exports={"SHLVL": " -9223372036854775808"}) + test("echo $SHLVL", exports={"SHLVL": " 9223372036854775807"}) + test("echo $SHLVL", exports={"SHLVL": " -9223372036854775809"}) + test("echo $SHLVL", exports={"SHLVL": " 9223372036854775808"}) + test("echo $SHLVL", exports={"SHLVL": " 18446744073709551615"}) + test("echo $SHLVL", exports={"SHLVL": " 18446744073709551616"}) + test("echo $SHLVL", exports={"SHLVL": " +1"}) + test("echo $SHLVL", exports={"SHLVL": " +2"}) + test("echo $SHLVL", exports={"SHLVL": " +3"}) + test("echo $SHLVL", exports={"SHLVL": " +0"}) + test("echo $SHLVL", exports={"SHLVL": " +255"}) + test("echo $SHLVL", exports={"SHLVL": " +256"}) + test("echo $SHLVL", exports={"SHLVL": " +2000000"}) + test("echo $SHLVL", exports={"SHLVL": " +2147483647"}) + test("echo $SHLVL", exports={"SHLVL": " ++1"}) + test("echo $SHLVL", exports={"SHLVL": " ++2"}) + test("echo $SHLVL", exports={"SHLVL": " ++3"}) + test("echo $SHLVL", exports={"SHLVL": " ++0"}) + test("echo $SHLVL", exports={"SHLVL": " ++255"}) + test("echo $SHLVL", exports={"SHLVL": " ++256"}) + test("echo $SHLVL", exports={"SHLVL": " ++2000000"}) + test("echo $SHLVL", exports={"SHLVL": " ++2147483647"}) + test("echo $SHLVL", exports={"SHLVL": " --1"}) + test("echo $SHLVL", exports={"SHLVL": " --2"}) + test("echo $SHLVL", exports={"SHLVL": " --3"}) + test("echo $SHLVL", exports={"SHLVL": " --0"}) + test("echo $SHLVL", exports={"SHLVL": " --255"}) + test("echo $SHLVL", exports={"SHLVL": " --256"}) + test("echo $SHLVL", exports={"SHLVL": " --2000000"}) + test("echo $SHLVL", exports={"SHLVL": " --2147483647"}) + test("echo $SHLVL", exports={"SHLVL": " bonjour"}) + test("echo $SHLVL", exports={"SHLVL": " 0_"}) + test("echo $SHLVL", exports={"SHLVL": " _0"}) + test("echo $SHLVL", exports={"SHLVL": " 0123456789"}) + test("echo $SHLVL", exports={"SHLVL": " -0123456789"}) + test("echo $SHLVL", exports={"SHLVL": " 00000000000000000000000000000000000000000000001"}) + test("echo $SHLVL", exports={"SHLVL": " 00000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000001"}) diff --git a/src/suites/path.py b/src/suites/path.py index 5ac25ae..a09c64a 100644 --- a/src/suites/path.py +++ b/src/suites/path.py @@ -6,7 +6,7 @@ # By: charles +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/09/09 15:12:58 by charles #+# #+# # -# Updated: 2020/10/09 11:00:46 by cacharle ### ########.fr # +# Updated: 2020/10/09 12:58:55 by cacharle ### ########.fr # # # # ############################################################################ # @@ -75,6 +75,7 @@ def suite_path(test): # "&& 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"}) + test("a/b", setup="mkdir -p path/a; cp " + whoami_path + " path/a/b", exports={"PATH": "path"}) @suite() -- cgit