diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2021-02-27 16:16:14 +0100 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2021-02-27 16:16:14 +0100 |
| commit | 632f88fd315626bf3196024f2a67c5288ea56333 (patch) | |
| tree | a041d430ac73cb6d14d61370b168b7ea1c28a2a6 /minishell_test/test/captured.py | |
| parent | 86355a6fd7375f954bf92cb49a14c718610c4d60 (diff) | |
| parent | 820d1ee00975d2e7859e4b2aded88dbf56a3b347 (diff) | |
| download | minishell_test-632f88fd315626bf3196024f2a67c5288ea56333.tar.gz minishell_test-632f88fd315626bf3196024f2a67c5288ea56333.tar.bz2 minishell_test-632f88fd315626bf3196024f2a67c5288ea56333.zip | |
Merge branch 'config'
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 |
