diff options
Diffstat (limited to 'minishell_test/test/captured.py')
| -rw-r--r-- | minishell_test/test/captured.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/minishell_test/test/captured.py b/minishell_test/test/captured.py index 7db9739..6ba861b 100644 --- a/minishell_test/test/captured.py +++ b/minishell_test/test/captured.py @@ -6,13 +6,14 @@ # By: charles <me@cacharle.xyz> +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/09/11 12:16:25 by charles #+# #+# # -# Updated: 2021/02/05 17:47:10 by charles ### ########.fr # +# Updated: 2021/02/27 16:15:13 by cacharle ### ########.fr # # # # ############################################################################ # +import re from typing import List, Optional -import minishell_test.config as config +from minishell_test import config class Captured: @@ -29,12 +30,12 @@ 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) + for i, line in enumerate(lines): + lines[i] = line = re.sub("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 |
