Skip to content

Commit

Permalink
Fix interruption test
Browse files Browse the repository at this point in the history
  • Loading branch information
Affonso-Gui committed Sep 3, 2020
1 parent 7605da0 commit 61d89cf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/euslime/bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ def stop(self):
log.warn("failed to terminate: %s" % e)

def reset(self):
self.euslime_connection.send("(lisp:reset)" + self.delim)
try:
self.exec_internal("(lisp:reset)" + self.delim, force_repl_socket=True)
except AbortEvaluation:
pass

def ping(self):
log.debug("Ping...")
Expand Down Expand Up @@ -241,6 +244,8 @@ def get_socket_response(self, connection, recursive=False):
raise EuslispError(msg, stack)
if command == 'abort':
msg = loads(data)
if msg:
msg = "'{}'".format(msg) # Better formatting
raise AbortEvaluation(msg)
raise Exception("Unhandled Socket Request Type: %s" % command)

Expand Down
7 changes: 7 additions & 0 deletions tests/eus9-27_slime2-20.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,7 @@ def test_emacs_interrupt_1(self):
'(:emacs-interrupt 0)'],
['(:read-string 0 1)',
'(:read-aborted 0 1)',
'(:new-package "USER" "B1-{}")'.format(self.EUSLISP_PROGRAM_NAME),
'(:return (:abort "\'Keyboard Interrupt\'") 5)'])
self.assertSocket(
'(:emacs-rex (swank-repl:listener-eval "10\n") "USER" :repl-thread 6)',
Expand All @@ -612,6 +613,12 @@ def test_emacs_interrupt_1(self):
'(:write-string "\\n" :repl-result)',
'(:read-aborted 0 1)',
'(:return (:ok nil) 6)')
self.assertSocket(
'(:emacs-rex (swank-repl:listener-eval "(reset)\n") "USER" :repl-thread 7)',
'(:read-string 0 1)',
'(:read-aborted 0 1)',
'(:new-package "USER" "{}")'.format(self.EUSLISP_PROGRAM_NAME),
'(:return (:ok nil) 7)')

# SET PACKAGE
def test_set_package_1(self):
Expand Down

0 comments on commit 61d89cf

Please sign in to comment.