From 2ed281af02d9d251a6d20bac9ccbd916275cc966 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Tue, 2 Aug 2022 20:54:35 +0200 Subject: [PATCH] tests: use double quotes instead of simple quotes in ruby script generator This allows to use escaped chars in strings. --- tests/scripts/python/unparse.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/scripts/python/unparse.py b/tests/scripts/python/unparse.py index f3c1066b7..e0991292b 100755 --- a/tests/scripts/python/unparse.py +++ b/tests/scripts/python/unparse.py @@ -523,6 +523,13 @@ class UnparseRuby(UnparsePython): node.attr, ) + def _ast_constant(self, node): + """Add an AST Constant in output.""" + if isinstance(node.value, str): + self.add('"%s"' % node.s.replace('#{', '\\#{')) + else: + self.add(repr(node.s)) + def _ast_dict(self, node): """Add an AST Dict in output.""" self.add(