Skip to content

Commit

Permalink
Test for MR marcoheisig#9 issue.
Browse files Browse the repository at this point in the history
Verify that the previous version of cl4py would experience errors because the python readtable was used to read *all* input to the lisp process (instead of only input from the Python process).
  • Loading branch information
rpgoldman committed Aug 18, 2020
1 parent 6e54abe commit a887be4
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/sample-program.lisp
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
(in-package :common-lisp-user)

(defun foo-{a7lkj9lakj} ()
nil)
39 changes: 39 additions & 0 deletions test/test_for_readtable.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
from pytest import fixture
import cl4py
import os

# pytest forces violation of this pylint rule
# pylint: disable=redefined-outer-name


@fixture(scope="module")
def lisp():
return cl4py.Lisp()


@fixture(scope="module")
def cl(lisp):
return lisp.function("find-package")("CL")


# This test verifies issue underlying MR #9
def test_readtable_problem(cl):
retval = cl.compile_file(
os.path.join(os.path.dirname(__file__), "sample-program.lisp")
)
outfile = os.path.join(os.path.dirname(__file__), "sample-program.fasl")
try:
assert retval[0] == outfile
assert os.path.exists(retval[0])
assert retval[1] == ()
assert retval[2] == ()
finally:
cleanup(outfile)
cleanup(outfile)

def cleanup(outfile):
if os.path.exists(outfile):
try:
os.remove(outfile)
except: # pylint: disable=bare-except
pass

0 comments on commit a887be4

Please sign in to comment.