aboutsummaryrefslogtreecommitdiff
path: root/minishell_test/test
diff options
context:
space:
mode:
Diffstat (limited to 'minishell_test/test')
-rw-r--r--minishell_test/test/result.py2
-rw-r--r--minishell_test/test/test.py16
2 files changed, 15 insertions, 3 deletions
diff --git a/minishell_test/test/result.py b/minishell_test/test/result.py
index 9769527..fe465e5 100644
--- a/minishell_test/test/result.py
+++ b/minishell_test/test/result.py
@@ -6,7 +6,7 @@
# By: charles <me@cacharle.xyz> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2020/09/11 12:17:34 by charles #+# #+# #
-# Updated: 2021/02/05 17:46:30 by charles ### ########.fr #
+# Updated: 2021/02/24 08:56:03 by cacharle ### ########.fr #
# #
# ############################################################################ #
diff --git a/minishell_test/test/test.py b/minishell_test/test/test.py
index ff1f389..ff60522 100644
--- a/minishell_test/test/test.py
+++ b/minishell_test/test/test.py
@@ -6,7 +6,7 @@
# By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2020/06/16 21:48:50 by charles #+# #+# #
-# Updated: 2021/02/05 18:35:12 by charles ### ########.fr #
+# Updated: 2021/02/24 09:09:39 by cacharle ### ########.fr #
# #
# ############################################################################ #
@@ -144,7 +144,7 @@ class Test:
return Captured(output, process.returncode, files_content)
@property
- def full_cmd(self):
+ def full_cmd(self) -> str:
""" Return the command prefixed by the setup and exports """
s = self.cmd
if len(self.exports) != 0:
@@ -153,3 +153,15 @@ class Test:
if self.setup != "":
s = "[SETUP {}] {}".format(self.setup, s)
return s
+
+ @classmethod
+ def try_run(cls, cmd: str) -> str:
+ config.VERBOSE_LEVEL = 2
+ test = Test(cmd)
+ test.run(0)
+ if isinstance(test.result, LeakResult):
+ return test.result.captured.output
+ elif isinstance(test.result, Result):
+ return test.result.actual.output
+ else:
+ return "No output"