예제 #1
0
    def test_exits(self):
        mock_stub = MockGDBStub()
        debugger = GDBDebugger(mock_stub)
        num_exits = Counter()
        debugger.add_exit_observer(num_exits.increment)

        debugger.pause()
        self.assertEqual(1, num_exits.value)
        debugger.resume()

        mock_stub.simulate_exit()
        self.assertEqual(2, num_exits.value)
        debugger.resume()

        debugger.add_exit_observer(num_exits.increment)
        mock_stub.simulate_exit()
        self.assertEqual(4, num_exits.value)
        debugger.resume()

        debugger.remove_exit_observer(num_exits.increment)
        mock_stub.simulate_exit()
        self.assertEqual(5, num_exits.value)
        debugger.resume()

        debugger.remove_exit_observer(num_exits.increment)
        mock_stub.simulate_exit()
        self.assertEqual(5, num_exits.value)
        debugger.resume()
예제 #2
0
 def test_basics(self):
     mock_stub = MockGDBStub()
     debugger = GDBDebugger(mock_stub)
     debugger.pause()
     debugger.resume()