diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2021-02-27 15:43:07 +0100 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2021-02-27 15:43:07 +0100 |
| commit | 0cf5f137f886bd4e80868dcf2cf74b3f3b2c28d3 (patch) | |
| tree | 47116c98f2be78bf6b1f528e7af75ffc8289cd1f /minishell_test/test/captured.py | |
| parent | c92f2be21c6be2d44cd836dd7f362e545b9a1a90 (diff) | |
| download | minishell_test-0cf5f137f886bd4e80868dcf2cf74b3f3b2c28d3.tar.gz minishell_test-0cf5f137f886bd4e80868dcf2cf74b3f3b2c28d3.tar.bz2 minishell_test-0cf5f137f886bd4e80868dcf2cf74b3f3b2c28d3.zip | |
Fixing #10 - bash error line with number 0 or 1
Diffstat (limited to 'minishell_test/test/captured.py')
| -rw-r--r-- | minishell_test/test/captured.py | 19 |
1 files changed, 9 insertions, 10 deletions
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 <me@cacharle.xyz> +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # 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 |
