diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/hooks.py | 5 | ||||
| -rw-r--r-- | src/suite/suite.py | 13 | ||||
| -rw-r--r-- | src/suites/builtin.py | 14 |
3 files changed, 16 insertions, 16 deletions
diff --git a/src/hooks.py b/src/hooks.py index 770aca8..001b956 100644 --- a/src/hooks.py +++ b/src/hooks.py @@ -6,7 +6,7 @@ # By: charles <me@cacharle.xyz> +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/09/11 16:10:20 by charles #+# #+# # -# Updated: 2020/09/11 22:11:21 by charles ### ########.fr # +# Updated: 2020/09/12 10:37:16 by charles ### ########.fr # # # # ############################################################################ # @@ -38,7 +38,8 @@ def discard(output): def export_singleton(output): """Remove variable that are not set to anything in a call to export without arguments""" + prefix = "export " if ("--posix" in config.REFERENCE_ARGS) else "declare -x " return sort_lines( '\n'.join([line for line in output.split('\n') - if regex.match("^declare -x .+=\".*\"$", line) is not None]) + if regex.match("^{}.+=\".*\"$".format(prefix), line) is not None]) ) diff --git a/src/suite/suite.py b/src/suite/suite.py index b81205e..c482c64 100644 --- a/src/suite/suite.py +++ b/src/suite/suite.py @@ -6,7 +6,7 @@ # By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/07/15 18:24:29 by charles #+# #+# # -# Updated: 2020/09/12 02:14:58 by charles ### ########.fr # +# Updated: 2020/09/12 10:38:16 by charles ### ########.fr # # # # ############################################################################ # @@ -27,11 +27,10 @@ class Suite: @classmethod def setup(cls, asked_names: [str]): """Remove not asked suite from available suites""" - if len(asked_names) == 0: - asked_names = [s.name for s in cls.available] - if not config.BONUS: cls.available = [s for s in cls.available if not s.bonus] + if len(asked_names) == 0: + asked_names = [s.name for s in cls.available] names = [] for i, name in enumerate(asked_names): @@ -41,7 +40,7 @@ class Suite: or s.name.startswith(name)] if len(matches) == 1: names.append(matches[0]) - elif all([n.startswith(name) for n in matches]): + elif len(matches) != 0 and all([n.startswith(name) for n in matches]): names.extend(matches) elif len(matches) > 2: print(("Ambiguous name `{}` match the following suites\n\t{}\n" @@ -49,9 +48,9 @@ class Suite: .format(name, ', '.join(matches))) sys.exit(1) elif len(matches) == 0: - print(("No suite named `{}` found\n\t{}\n" + print(("Name `{}` doesn't match any suite/group name\n\t" "Try to run with -l to see the available suites") - .format(name, ', '.join(matches))) + .format(name)) sys.exit(1) cls.available = list(set( diff --git a/src/suites/builtin.py b/src/suites/builtin.py index ff094e0..0c468d2 100644 --- a/src/suites/builtin.py +++ b/src/suites/builtin.py @@ -6,7 +6,7 @@ # By: juligonz <juligonz@student.42.fr> +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/07/15 18:24:43 by charles #+# #+# # -# Updated: 2020/09/12 01:40:08 by charles ### ########.fr # +# Updated: 2020/09/12 10:37:05 by charles ### ########.fr # # Updated: 2020/09/11 18:01:27 by juligonz ### ########.fr # # # # **************************************************************************** # @@ -43,12 +43,12 @@ def suite_echo(test): @suite() def suite_export(test): - test("export")#, hook=hooks.export_singleton) - test("export", exports={"A": ""})#, hook=hooks.export_singleton) - test("export", exports={"A": "\""})#, hook=hooks.export_singleton) - test("export", exports={"A": "\t"})#, hook=hooks.export_singleton) - test("export", exports={"A": "'"})#, hook=hooks.export_singleton) - test("export", exports={"A": "a"})#, hook=hooks.export_singleton) + test("export", hook=hooks.export_singleton) + test("export", exports={"A": ""}, hook=hooks.export_singleton) + test("export", exports={"A": "\""}, hook=hooks.export_singleton) + test("export", exports={"A": "\t"}, hook=hooks.export_singleton) + test("export", exports={"A": "'"}, hook=hooks.export_singleton) + test("export", exports={"A": "a"}, hook=hooks.export_singleton) test("export A=a; echo $A") test("export A=a B=b C=c; echo $A$B$C") test("export A=a B=b C=c D=d E=e F=f G=g H=h I=i J=j K=k L=l" |
