summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2018-02-27 19:56:57 +0100
committerArmin Rigo <arigo@tunes.org>2018-02-27 19:56:57 +0100
commitdf3534a0953119d149d7b8cd3665d2e9859d7c2a (patch)
tree9c87135d010b0bd596041943930ccdeb57295a38
parent3c2dfa3b7d65e353e1f3bc6884f0b3ff6ad150ec (diff)
downloadcffi-df3534a0953119d149d7b8cd3665d2e9859d7c2a.tar.gz
Direct tests for close_lib()
-rw-r--r--c/test_c.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/c/test_c.py b/c/test_c.py
index ab3260c..4ff1549 100644
--- a/c/test_c.py
+++ b/c/test_c.py
@@ -406,6 +406,9 @@ def test_load_standard_library():
# the next one is from 'libm', not 'libc', but we assume
# that it is already loaded too, so it should work
assert x.load_function(BVoidP, 'sqrt')
+ #
+ x.close_lib()
+ py.test.raises(ValueError, x.load_function, BVoidP, 'sqrt')
def test_no_len_on_nonarray():
p = new_primitive_type("int")
@@ -1221,6 +1224,9 @@ def test_read_variable():
ll = find_and_load_library('c')
stderr = ll.read_variable(BVoidP, "stderr")
assert stderr == cast(BVoidP, _testfunc(8))
+ #
+ ll.close_lib()
+ py.test.raises(ValueError, ll.read_variable, BVoidP, "stderr")
def test_read_variable_as_unknown_length_array():
## FIXME: this test assumes glibc specific behavior, it's not compliant with C standard
@@ -1247,6 +1253,9 @@ def test_write_variable():
assert not ll.read_variable(BVoidP, "stderr")
ll.write_variable(BVoidP, "stderr", stderr)
assert ll.read_variable(BVoidP, "stderr") == stderr
+ #
+ ll.close_lib()
+ py.test.raises(ValueError, ll.write_variable, BVoidP, "stderr", stderr)
def test_callback():
BInt = new_primitive_type("int")