aboutsummaryrefslogtreecommitdiff
path: root/src/suites/builtin.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/suites/builtin.py')
-rw-r--r--src/suites/builtin.py78
1 files changed, 38 insertions, 40 deletions
diff --git a/src/suites/builtin.py b/src/suites/builtin.py
index c782f4d..3b342e7 100644
--- a/src/suites/builtin.py
+++ b/src/suites/builtin.py
@@ -6,7 +6,7 @@
# By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2020/07/15 18:24:43 by charles #+# #+# #
-# Updated: 2020/09/11 16:13:26 by charles ### ########.fr #
+# Updated: 2020/09/11 18:26:11 by charles ### ########.fr #
# #
# ############################################################################ #
@@ -23,18 +23,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 +40,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 +88,17 @@ 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 $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):
@@ -106,16 +115,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");
@@ -125,17 +129,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")
@@ -158,14 +159,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")
@@ -182,31 +181,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"})
@suite()
def suite_pwd(test):
@@ -217,7 +221,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):
@@ -262,7 +266,6 @@ def suite_exit(test):
test("exit 9223372036854775808")
test("exit 18446744073709551615")
test("exit 18446744073709551616")
-
test("exit +1")
test("exit +2")
test("exit +3")
@@ -271,7 +274,6 @@ def suite_exit(test):
test("exit +256")
test("exit +2000000")
test("exit +2147483647")
-
test("exit ++1")
test("exit ++2")
test("exit ++3")
@@ -280,7 +282,6 @@ def suite_exit(test):
test("exit ++256")
test("exit ++2000000")
test("exit ++2147483647")
-
test("exit --1")
test("exit --2")
test("exit --3")
@@ -289,7 +290,6 @@ def suite_exit(test):
test("exit --256")
test("exit --2000000")
test("exit --2147483647")
-
test("exit bonjour")
test("exit 0_")
test("exit _0")
@@ -306,10 +306,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)