From 7081b93b8ed4f98c628400e05d22d0523f41a842 Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Sat, 27 Feb 2021 12:24:37 +0100 Subject: Fixing #16 - Adding support for custom config file in user directory --- minishell_test/test/captured.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'minishell_test/test/captured.py') diff --git a/minishell_test/test/captured.py b/minishell_test/test/captured.py index 7db9739..a6141e8 100644 --- a/minishell_test/test/captured.py +++ b/minishell_test/test/captured.py @@ -6,13 +6,13 @@ # By: charles +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/09/11 12:16:25 by charles #+# #+# # -# Updated: 2021/02/05 17:47:10 by charles ### ########.fr # +# Updated: 2021/02/27 12:20:00 by cacharle ### ########.fr # # # # ############################################################################ # from typing import List, Optional -import minishell_test.config as config +# from minishell_test import config class Captured: @@ -29,13 +29,15 @@ class Captured: files_content: content of the files altered by the command is_timeout: the command has timed out """ - lines = output.split('\n') - for i, l in enumerate(lines): - if l.find(config.REFERENCE_ERROR_BEGIN) == 0: - lines[i] = l.replace(config.REFERENCE_ERROR_BEGIN, config.MINISHELL_ERROR_BEGIN, 1) - elif l.find(config.REFERENCE_PATH + ": ") == 0: - lines[i] = l.replace(config.REFERENCE_PATH + ": ", config.MINISHELL_ERROR_BEGIN, 1) - self.output = '\n'.join(lines) + + # lines = output.split('\n') + # for i, l in enumerate(lines): + # if l.find(config.REFERENCE_ERROR_BEGIN) == 0: + # lines[i] = l.replace(config.REFERENCE_ERROR_BEGIN, config.MINISHELL_ERROR_BEGIN, 1) + # elif l.find(config.REFERENCE_PATH + ": ") == 0: + # lines[i] = l.replace(config.REFERENCE_PATH + ": ", config.MINISHELL_ERROR_BEGIN, 1) + + self.output = output # '\n'.join(lines) self.status = status self.files_content = files_content -- cgit From 0cf5f137f886bd4e80868dcf2cf74b3f3b2c28d3 Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Sat, 27 Feb 2021 15:43:07 +0100 Subject: Fixing #10 - bash error line with number 0 or 1 --- minishell_test/test/captured.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'minishell_test/test/captured.py') diff --git a/minishell_test/test/captured.py b/minishell_test/test/captured.py index a6141e8..e1ef29a 100644 --- a/minishell_test/test/captured.py +++ b/minishell_test/test/captured.py @@ -6,13 +6,14 @@ # By: charles +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/09/11 12:16:25 by charles #+# #+# # -# Updated: 2021/02/27 12:20:00 by cacharle ### ########.fr # +# Updated: 2021/02/27 15:25:58 by cacharle ### ########.fr # # # # ############################################################################ # +import re from typing import List, Optional -# from minishell_test import config +from minishell_test import config class Captured: @@ -30,14 +31,12 @@ class Captured: is_timeout: the command has timed out """ - # lines = output.split('\n') - # for i, l in enumerate(lines): - # if l.find(config.REFERENCE_ERROR_BEGIN) == 0: - # lines[i] = l.replace(config.REFERENCE_ERROR_BEGIN, config.MINISHELL_ERROR_BEGIN, 1) - # elif l.find(config.REFERENCE_PATH + ": ") == 0: - # lines[i] = l.replace(config.REFERENCE_PATH + ": ", config.MINISHELL_ERROR_BEGIN, 1) - - self.output = output # '\n'.join(lines) + lines = output.split('\n') + for i, _ in enumerate(lines): + lines[i] = line = re.sub(f"line [01]: ", "", lines[i], 1) + if line.startswith(config.SHELL_REFERENCE_PREFIX): + lines[i] = config.MINISHELL_PREFIX + line[len(config.SHELL_REFERENCE_PREFIX):] + self.output = '\n'.join(lines) self.status = status self.files_content = files_content -- cgit From 820d1ee00975d2e7859e4b2aded88dbf56a3b347 Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Sat, 27 Feb 2021 16:12:34 +0100 Subject: Added configuration file section/key names check --- minishell_test/test/captured.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'minishell_test/test/captured.py') diff --git a/minishell_test/test/captured.py b/minishell_test/test/captured.py index e1ef29a..d2fda8b 100644 --- a/minishell_test/test/captured.py +++ b/minishell_test/test/captured.py @@ -6,7 +6,7 @@ # By: charles +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/09/11 12:16:25 by charles #+# #+# # -# Updated: 2021/02/27 15:25:58 by cacharle ### ########.fr # +# Updated: 2021/02/27 15:48:30 by cacharle ### ########.fr # # # # ############################################################################ # @@ -32,7 +32,7 @@ class Captured: """ lines = output.split('\n') - for i, _ in enumerate(lines): + for i, line in enumerate(lines): lines[i] = line = re.sub(f"line [01]: ", "", lines[i], 1) if line.startswith(config.SHELL_REFERENCE_PREFIX): lines[i] = config.MINISHELL_PREFIX + line[len(config.SHELL_REFERENCE_PREFIX):] -- cgit