aboutsummaryrefslogtreecommitdiff
path: root/suites/operation.py
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-06-19 11:44:44 +0200
committerCharles <sircharlesaze@gmail.com>2020-06-19 11:44:44 +0200
commit9ae06d1ada7828f986b8aa1ab9364ac2f9f0cbd7 (patch)
treef39926c20445abe4822cc37399076b8a6325c501 /suites/operation.py
parentd845a683e67a89c699109dab660f6ec0eb74a2c4 (diff)
downloadminishell_test-9ae06d1ada7828f986b8aa1ab9364ac2f9f0cbd7.tar.gz
minishell_test-9ae06d1ada7828f986b8aa1ab9364ac2f9f0cbd7.tar.bz2
minishell_test-9ae06d1ada7828f986b8aa1ab9364ac2f9f0cbd7.zip
Added operator test, Fixing false positive with cd, export and unset
Diffstat (limited to 'suites/operation.py')
-rw-r--r--suites/operation.py71
1 files changed, 71 insertions, 0 deletions
diff --git a/suites/operation.py b/suites/operation.py
new file mode 100644
index 0000000..7bed096
--- /dev/null
+++ b/suites/operation.py
@@ -0,0 +1,71 @@
+from suite import suite
+
+@suite
+def suite_end(test):
+ test("echo bonjour; echo je")
+ test("echo bonjour ;echo je")
+ test("echo bonjour ; echo je")
+ test("echo bonjour;")
+ test("echo; ")
+ test("echo ; ")
+ test("echo ;")
+ test("echo a; echo b; echo c; echo d; echo e; echo f; echo g; echo h; echo i;" +
+ "echo j; echo k; echo l; echo m; echo c; echo c; echo c; echo c; echo c;" +
+ "echo c; echo c; echo c; echo v; echo w; echo x; echo y; echo z")
+ test("echo a ; echo b; echo c ;echo d ; echo e ;echo f; echo g ;echo h; echo i;" +
+ "echo j ; echo k; echo l; echo m; echo c ; echo c; echo c ; echo c; echo c;" +
+ "echo c; echo c ; echo c; echo v ; echo w; echo x; echo y ; echo z")
+
+ test("ls doesnotexists ; echo bonjour")
+ test("ls doesnotexists; echo bonjour")
+ test("echo bonjour; ls doesnotexists")
+
+@suite
+def suite_and(test):
+ test("echo bonjour&& echo je")
+ test("echo bonjour &&echo je")
+ test("echo bonjour && echo je")
+ test("echo bonjour&&")
+ test("echo&& ")
+ test("echo && ")
+ test("echo &&")
+ test("echo a&& echo b&& echo c&& echo d&& echo e&& echo f&& echo g&& echo h&& echo i&&" +
+ "echo j&& echo k&& echo l&& echo m&& echo c&& echo c&& echo c&& echo c&& echo c&&" +
+ "echo c&& echo c&& echo c&& echo v&& echo w&& echo x&& echo y&& echo z")
+ test("echo a && echo b&& echo c &&echo d && echo e &&echo f&& echo g &&echo h&& echo i&&" +
+ "echo j && echo k&& echo l&& echo m&& echo c && echo c&& echo c && echo c&& echo c&&" +
+ "echo c&& echo c && echo c&& echo v && echo w&& echo x&& echo y && echo z")
+
+ test("ls doesnotexists && echo bonjour")
+ test("ls doesnotexists&& echo bonjour")
+ test("echo bonjour&& ls doesnotexists")
+
+@suite
+def suite_or(test):
+ test("echo bonjour|| echo je")
+ test("echo bonjour ||echo je")
+ test("echo bonjour || echo je")
+ test("echo bonjour||")
+ test("echo|| ")
+ test("echo || ")
+ test("echo ||")
+ test("echo a|| echo b|| echo c|| echo d|| echo e|| echo f|| echo g|| echo h|| echo i||" +
+ "echo j|| echo k|| echo l|| echo m|| echo c|| echo c|| echo c|| echo c|| echo c||" +
+ "echo c|| echo c|| echo c|| echo v|| echo w|| echo x|| echo y|| echo z")
+ test("echo a || echo b|| echo c ||echo d || echo e ||echo f|| echo g ||echo h|| echo i||" +
+ "echo j || echo k|| echo l|| echo m|| echo c || echo c|| echo c || echo c|| echo c||" +
+ "echo c|| echo c || echo c|| echo v || echo w|| echo x|| echo y || echo z")
+
+ test("ls doesnotexists || echo bonjour")
+ test("ls doesnotexists|| echo bonjour")
+ test("echo bonjour|| ls doesnotexists")
+
+@suite
+def suite_pipe(test):
+ test("echo bonjour | cat")
+ test("echo bonjour | cat -e")
+ test("ls | cat -e", setup="touch a b c d; mkdir m1 m2 m3")
+ test("ls -l | cat -e", setup="touch a b c d; mkdir m1 m2 m3")
+ test("ls -l | cat -e | cat | cat | cat", setup="touch a b c d; mkdir m1 m2 m3")
+ test("ls -l | cat -e | cat -e | cat -e | cat -e", setup="touch a b c d; mkdir m1 m2 m3")
+ test("ls -l | cat -e < a", setup="touch a b c d; mkdir m1 m2 m3; echo bonjour > a")