From 4a6fb4b3f1f7209f8d56cd18fdf59860c98dc884 Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Thu, 17 Sep 2020 11:07:24 +0200 Subject: Added hook list, replace double semi-colon hook for ;; errors --- src/test/test.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/test') diff --git a/src/test/test.py b/src/test/test.py index 00e5516..c37a865 100644 --- a/src/test/test.py +++ b/src/test/test.py @@ -6,7 +6,7 @@ # By: charles +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/06/16 21:48:50 by charles #+# #+# # -# Updated: 2020/09/12 17:07:22 by charles ### ########.fr # +# Updated: 2020/09/17 11:05:46 by charles ### ########.fr # # # # ############################################################################ # @@ -29,7 +29,7 @@ class Test: exports: {str: str} = {}, timeout: float = config.TIMEOUT, signal=None, - hook=None): + hook=[]): """Test class cmd: command to execute setup: command to execute before tested command @@ -47,6 +47,8 @@ class Test: self.timeout = timeout self.signal = signal self.hook = hook + if type(self.hook) is not list: + self.hook = [self.hook] def run(self): """Run the test for minishell and the reference shell and print the result out""" @@ -126,6 +128,7 @@ class Test: files_content.append(None) # sandbox.remove() - if self.hook is not None: - output = self.hook(output) + for h in self.hook: + output = h(output) + return Captured(output, process.returncode, files_content) -- cgit