aboutsummaryrefslogtreecommitdiff
path: root/unittest/test_bindings.py
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2016-08-04 11:24:17 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2016-08-05 10:17:30 +0200
commitfd95d2ec8b0160657709f1655887739191f33932 (patch)
treeed80a086ac0da394b2a17fa9c999c3abe4aa99c9 /unittest/test_bindings.py
parent7d98b54afa3f2276c058dccf38bcfa34a35ed4bb (diff)
downloadlibnitrokey-fd95d2ec8b0160657709f1655887739191f33932.tar.gz
libnitrokey-fd95d2ec8b0160657709f1655887739191f33932.tar.bz2
Handle C API declarations done in multiple lines
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'unittest/test_bindings.py')
-rw-r--r--unittest/test_bindings.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/unittest/test_bindings.py b/unittest/test_bindings.py
index d65eeaf..fa78409 100644
--- a/unittest/test_bindings.py
+++ b/unittest/test_bindings.py
@@ -30,10 +30,13 @@ def C(request):
with open(fp, 'r') as f:
declarations = f.readlines()
- for declaration in declarations:
+ a = iter(declarations)
+ for declaration in a:
# extern int NK_write_totp_slot(int slot_number, char* secret, int time_window);
- if 'extern' in declaration and not '"C"' in declaration:
+ if declaration.startswith('extern') and not '"C"' in declaration:
declaration = declaration.replace('extern', '').strip()
+ while not ';' in declaration:
+ declaration += (next(a)).strip()
print(declaration)
ffi.cdef(declaration)