Hedy is a gradual programming language to teach children programming. Gradual languages use different language levels, where each level adds new concepts and syntactic complexity. At the end of the Hedy level sequence, kids master a subset of syntactically valid Python.
def test_for_ifbug(self):
code = textwrap.dedent("""\
for i in range 0 to 10
antwoord is ask Wat is 5*5
if antwoord is 24
print 'fout'
print 'klaar met for loop'""")
expected = textwrap.dedent("""\
for i in range(int(0), int(10)+1):
antwoord = input('Wat is 5*5')
if str(antwoord) == str('24'):
print('fout')
print('klaar met for loop')""")
result = hedy.transpile(code, 8)
self.assertEqual(expected, result)
Gives the following error:
Occurs from level 8 on.
Does not occur when the last print (klaar met for loop, is in the if or in the for)
Only occurs when the print after the loop gets 2 spaces back.
Test that fails:
Gives the following error:
Occurs from level 8 on.
Does not occur when the last print (klaar met for loop, is in the if or in the for)
Only occurs when the print after the loop gets 2 spaces back.