Skip to content

Commit

Permalink
Fixes hedyorg#744 with test (hedyorg#751)
Browse files Browse the repository at this point in the history
  • Loading branch information
Felienne authored Sep 15, 2021
1 parent f274e0d commit dde93bd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion hedy.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,8 @@ def print(self, args):
return "print(" + '+'.join(args) + ')'
else:
# I would like to raise normally but that is caught by the transformer :(
return f"HedyException:{args[0]}"
first_unquoted_var = unquoted_args[0]
return f"HedyException:{first_unquoted_var}"
#raise HedyException('Var Undefined', name=args[0])

def print_nq(self, args):
Expand Down
11 changes: 11 additions & 0 deletions tests/tests_level_03.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,17 @@ def test_transpile_missing_all_quotes(self):

print(f'{self.test_name()} level {level}')

def test_var_undefined_error_message(self):

code = textwrap.dedent("""\
naam is Hedy
print 'ik heet ' name""")

with self.assertRaises(Exception) as context:
result = hedy.transpile(code, self.level)

self.assertEqual('Var Undefined', context.exception.args[0])
self.assertEqual('name', context.exception.arguments['name'])


def test_transpile_issue_375(self):
Expand Down

0 comments on commit dde93bd

Please sign in to comment.