aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/snippets_translate/converter.py2
-rw-r--r--tools/snippets_translate/tests/test_converter.py2
2 files changed, 3 insertions, 1 deletions
diff --git a/tools/snippets_translate/converter.py b/tools/snippets_translate/converter.py
index 92c89bdf6..a0650b3af 100644
--- a/tools/snippets_translate/converter.py
+++ b/tools/snippets_translate/converter.py
@@ -128,6 +128,8 @@ def snippet_translate(x):
# that include the string 'new'
if "new " in x:
x = x.replace("new ", "")
+ if not x.endswith(")"): # "new Foo" -> "new Foo()"
+ x += "()"
# Handle 'const'
# Some variables/functions have the word 'const' so we explicitly
diff --git a/tools/snippets_translate/tests/test_converter.py b/tools/snippets_translate/tests/test_converter.py
index d47ab9ef2..28436e846 100644
--- a/tools/snippets_translate/tests/test_converter.py
+++ b/tools/snippets_translate/tests/test_converter.py
@@ -100,7 +100,7 @@ def test_else():
def test_new():
assert st("a = new Something(...);") == "a = Something(...)"
- assert st("a = new Something") == "a = Something"
+ assert st("a = new Something") == "a = Something()"
def test_semicolon():