Пример #1
0
 def test_debug(self):
     """Exercise debug statements."""
     with debug.DebugSession() as s:
         s.execute('_dir')
         s.execute('_logprint "test"')
         s.execute('_logwrite "test"')
         s.execute('_showvariables')
         s.execute('_showscreen')
         s.execute('_showprogram')
         s.execute('_showplatform')
         s.execute('_python "print(\'--test--\')"')
Пример #2
0
 def test_trace_watch(self):
     """Exercise _trace and _watch."""
     with debug.DebugSession() as s:
         s.execute('_trace')
         # string
         s.execute('_watch "a$"')
         # single
         s.execute('_watch "a!"')
         # error
         s.execute('_watch "log(-1)"')
         s.execute('10 a=1:? a')
         s.execute('20 a$="test"')
         s.execute('run')
         s.execute('_trace 0')
         s.execute('run')
Пример #3
0
 def test_exception(self):
     """Test exception in debug statement."""
     with debug.DebugSession() as s:
         # no exception raised
         s.execute('_python "blah"')
Пример #4
0
 def test_exit(self):
     """Test _exit."""
     with debug.DebugSession() as s:
         # Exit exception would be absorbed by the Session context
         with self.assertRaises(error.Exit):
             s.execute('_exit')
Пример #5
0
 def test_restart(self):
     """Test _restart."""
     # Restart exception is not absorbed
     with self.assertRaises(error.Reset):
         with debug.DebugSession() as s:
             s.execute('_restart')
Пример #6
0
 def test_crash(self):
     """Test _crash."""
     with self.assertRaises(debug.DebugException):
         with debug.DebugSession() as s:
             s.execute('_crash')