diff --git a/info4/kapitel-8/Interpreter/test_loop_interpreter.py b/info4/kapitel-8/Interpreter/test_loop_interpreter.py index 7f47bced451b943979473eac7ab027674e8365d1..125ffd977884d1ac2c974a12f03991f18386b01f 100644 --- a/info4/kapitel-8/Interpreter/test_loop_interpreter.py +++ b/info4/kapitel-8/Interpreter/test_loop_interpreter.py @@ -132,6 +132,16 @@ class LOOPInterpreterTest(unittest.TestCase): with self.assertRaises(SyntaxError): interpret(';x1:=x1+1') + def test_syntax_unnecessary_end(self): + with self.assertRaises(SyntaxError): + interpret('LOOP x0 DO x1:=x1+1 END END') + with self.assertRaises(SyntaxError): + interpret('LOOP x0 DO x1:=x1+1 END; x1:=x1+1 END') + with self.assertRaises(SyntaxError): + interpret('x1:=x1+1; END x1:=x1+1') + with self.assertRaises(SyntaxError): + interpret('END x1:=x1+1') + def test_syntax_missing_semicolon(self): with self.assertRaises(SyntaxError): interpret('x0:=2 LOOP x0 DO x1:=x1+1 END')