Skip to content

Commit

Permalink
[TESTING] Adds tests for unquoted strings in loop body (#4825)
Browse files Browse the repository at this point in the history
I was adding tests to fix #4355 but it turned out the error is already fixed! (I suspect by #4786?)

So let's just add some tests.

**How to test**
The tests pass :)
  • Loading branch information
Felienne authored Nov 30, 2023
1 parent b8a67da commit c45b78d
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/test_level/test_level_08.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,30 @@ def test_if_2_vars_equality_print(self):

self.multi_level_tester(max_level=11, code=code, expected=expected, output='gelijkspel!')

def test_unquoted_print_in_body(self):
code = textwrap.dedent("""\
svar = ask 'Vad är 5 plus 5?'
if svar is 10
print 'Bra jobbat!
print 'Svaret var faktiskt ' svar""")

self.multi_level_tester(code=code,
skip_faulty=False,
exception=hedy.exceptions.UnquotedTextException,
max_level=16)

def test_wrongly_quoted_print_in_body(self):
code = textwrap.dedent("""\
svar = ask 'Vad är 5 plus 5?'
if svar is 10
print 'Bra jobbat!"
print 'Svaret var faktiskt ' svar""")

self.multi_level_tester(code=code,
skip_faulty=False,
exception=hedy.exceptions.UnquotedTextException,
max_level=16)

def test_if_in_list_print(self):
code = textwrap.dedent("""\
items is red, green
Expand Down

0 comments on commit c45b78d

Please sign in to comment.