aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-10-08 17:04:32 +0200
committerCharles Cabergs <me@cacharle.xyz>2020-10-08 17:04:32 +0200
commit93ead396473526e5f4849ad2f4194b8cc6c9ce45 (patch)
treef09e5589b96403439d9f9bb81527913fbc5a4afb /src
parentf06e8de42359cff6cb93dad4a89c64078d864790 (diff)
downloadminishell_test-93ead396473526e5f4849ad2f4194b8cc6c9ce45.tar.gz
minishell_test-93ead396473526e5f4849ad2f4194b8cc6c9ce45.tar.bz2
minishell_test-93ead396473526e5f4849ad2f4194b8cc6c9ce45.zip
Added flow syntax error tests
Diffstat (limited to 'src')
-rw-r--r--src/args.py7
-rw-r--r--src/suites/flow.py105
2 files changed, 109 insertions, 3 deletions
diff --git a/src/args.py b/src/args.py
index 5536ff5..7d1f260 100644
--- a/src/args.py
+++ b/src/args.py
@@ -6,7 +6,7 @@
# By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2020/07/15 18:24:32 by charles #+# #+# #
-# Updated: 2020/10/08 09:02:52 by cacharle ### ########.fr #
+# Updated: 2020/10/08 16:29:25 by cacharle ### ########.fr #
# #
# ############################################################################ #
@@ -16,7 +16,10 @@ import argparse
def parse_args():
"""Parse command line arguments"""
- parser = argparse.ArgumentParser(description="Minishell test")
+ parser = argparse.ArgumentParser(
+ description="Minishell test",
+ epilog="Signal handling is not tested"
+ )
parser.add_argument(
"-k", "--check-leaks", action="store_true",
help="Run valgrind on tests (disable usual comparison with bash)"
diff --git a/src/suites/flow.py b/src/suites/flow.py
index bcee31e..eac9459 100644
--- a/src/suites/flow.py
+++ b/src/suites/flow.py
@@ -6,10 +6,11 @@
# By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2020/07/15 18:24:52 by charles #+# #+# #
-# Updated: 2020/10/08 08:40:56 by cacharle ### ########.fr #
+# Updated: 2020/10/08 16:45:19 by cacharle ### ########.fr #
# #
# ############################################################################ #
+import config
from suite import suite
from hooks import error_line0, platform_status, discard, replace_double_semi_colon
@@ -202,3 +203,105 @@ 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")
+
+
+@suite()
+def suite_syntax_error(test):
+ """ separator syntax error test """
+ test("< |", hook=error_line0)
+ test("> |", hook=error_line0)
+ test(">> |", hook=error_line0)
+ test("< ;", hook=error_line0)
+ test("> ;", hook=error_line0)
+ test(">> ;", hook=error_line0)
+ test("; |", hook=error_line0)
+ test("; |", hook=error_line0)
+ test("; |", hook=error_line0)
+ test("; <", hook=error_line0)
+ test("; >", hook=error_line0)
+ test("; >>", hook=error_line0)
+ test("| ;", hook=error_line0)
+ test("| ;", hook=error_line0)
+ test("| ;", hook=error_line0)
+ test("| <", hook=error_line0)
+ test("| >", hook=error_line0)
+ test("| >>", hook=error_line0)
+ test("> a ;", hook=error_line0)
+ test("< a ;", hook=error_line0)
+ test(">> a ;", hook=error_line0)
+ test(config.LOREM + " > >" + config.LOREM, hook=error_line0)
+ test(config.LOREM + " < <" + config.LOREM, hook=error_line0)
+ test(config.LOREM + " ; |" + config.LOREM, hook=error_line0)
+ test(config.LOREM + " | ;" + config.LOREM, hook=error_line0)
+
+
+@suite(bonus=True)
+def suite_syntax_error_bonus(test):
+ """ separator syntax error bonus test """
+ test("< &&", hook=error_line0)
+ test("> &&", hook=error_line0)
+ test(">> &&", hook=error_line0)
+ test("< ||", hook=error_line0)
+ test("> ||", hook=error_line0)
+ test(">> ||", hook=error_line0)
+ test("< (", hook=error_line0)
+ test("> (", hook=error_line0)
+ test(">> (", hook=error_line0)
+ test("< )", hook=error_line0)
+ test("> )", hook=error_line0)
+ test(">> )", hook=error_line0)
+ test("&& <", hook=error_line0)
+ test("&& >", hook=error_line0)
+ test("&& >>", hook=error_line0)
+ test("&& ||", hook=error_line0)
+ test("&& ||", hook=error_line0)
+ test("&& ||", hook=error_line0)
+ test("&& (", hook=error_line0)
+ test("&& (", hook=error_line0)
+ test("&& (", hook=error_line0)
+ test("&& )", hook=error_line0)
+ test("&& )", hook=error_line0)
+ test("&& )", hook=error_line0)
+ test("|| <", hook=error_line0)
+ test("|| >", hook=error_line0)
+ test("|| >>", hook=error_line0)
+ test("|| &&", hook=error_line0)
+ test("|| &&", hook=error_line0)
+ test("|| &&", hook=error_line0)
+ test("|| (", hook=error_line0)
+ test("|| (", hook=error_line0)
+ test("|| (", hook=error_line0)
+ test("|| )", hook=error_line0)
+ test("|| )", hook=error_line0)
+ test("|| )", hook=error_line0)
+ test("( <", hook=error_line0)
+ test("( >", hook=error_line0)
+ test("( >>", hook=error_line0)
+ test("( &&", hook=error_line0)
+ test("( &&", hook=error_line0)
+ test("( &&", hook=error_line0)
+ test("( ||", hook=error_line0)
+ test("( ||", hook=error_line0)
+ test("( ||", hook=error_line0)
+ test("( )", hook=error_line0)
+ test("( )", hook=error_line0)
+ test("( )", hook=error_line0)
+ test(") <", hook=error_line0)
+ test(") >", hook=error_line0)
+ test(") >>", hook=error_line0)
+ test(") &&", hook=error_line0)
+ test(") &&", hook=error_line0)
+ test(") &&", hook=error_line0)
+ test(") ||", hook=error_line0)
+ test(") ||", hook=error_line0)
+ test(") ||", hook=error_line0)
+ test(") (", hook=error_line0)
+ test(") (", hook=error_line0)
+ test(") (", hook=error_line0)
+ test("()", hook=error_line0)
+ test("(", hook=[error_line0, lambda o: o.replace("-c: line 1: ", "")])
+ test(")", hook=error_line0)
+ test(config.LOREM + " && &&" + config.LOREM, hook=error_line0)
+ test(config.LOREM + " || ||" + config.LOREM, hook=error_line0)
+ test(config.LOREM + " ( (" + config.LOREM, hook=error_line0)
+ test(config.LOREM + " ) )" + config.LOREM, hook=error_line0)