aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGanesh Viswanathan <dev@genotrance.com>2020-04-02 18:17:36 -0500
committerGanesh Viswanathan <dev@genotrance.com>2020-04-03 14:53:22 -0500
commitced9c148287a50356eb5ace81ef6582cc0660163 (patch)
tree042682a8ba8a8b185ea762105e109a5f81b964e8 /tests
parentad8557d70e5c8ff3220582b7f78a2822f87d2476 (diff)
downloadnimterop-ced9c148287a50356eb5ace81ef6582cc0660163.tar.gz
nimterop-ced9c148287a50356eb5ace81ef6582cc0660163.zip
ast2 test fix for osx, catch parseString errors, handle type field comments
Diffstat (limited to 'tests')
-rw-r--r--tests/include/tast2.h10
-rw-r--r--tests/tnimterop_c.nim13
-rw-r--r--tests/tpcre.nim3
3 files changed, 9 insertions, 17 deletions
diff --git a/tests/include/tast2.h b/tests/include/tast2.h
index 1518a85..84a4604 100644
--- a/tests/include/tast2.h
+++ b/tests/include/tast2.h
@@ -45,11 +45,11 @@ typedef struct { char *a1; int *a2[1]; } A19, *A19p;
typedef struct A20 { char a1; } A20, A21, *A21p;
//Expression
-typedef struct A22 { int **f1; int *f2[123+132]; } A22;
+typedef struct A22 { const int **f1; int *f2[123+132]; } A22;
//Unions
union U1 {int f1; float f2; };
-typedef union U2 { int **f1; int abc[123+132]; } U2;
+typedef union U2 { const int **f1; int abc[123+132]; } U2;
// Enums
@@ -157,11 +157,11 @@ typedef struct { char *a1; int *a2[1]; } A19, *A19p;
typedef struct A20 { char a1; } A20, A21, *A21p;
//Expression
-typedef struct A22 { int **f1; int *f2[123+132]; } A22;
+typedef struct A22 { const int **f1; int *f2[123+132]; } A22;
//Unions
union U1 {int f1; float f2; };
-typedef union U2 { int **f1; int abc[123+132]; } U2;
+typedef union U2 { const int **f1; int abc[123+132]; } U2;
// Enums
@@ -220,4 +220,4 @@ typedef enum VSPresetFormat {
#ifdef __cplusplus
}
-#endif \ No newline at end of file
+#endif
diff --git a/tests/tnimterop_c.nim b/tests/tnimterop_c.nim
index afd73e2..fe4e9ee 100644
--- a/tests/tnimterop_c.nim
+++ b/tests/tnimterop_c.nim
@@ -41,17 +41,8 @@ cOverride:
proc weirdfunc(apple: ptr ptr ptr cchar): int {.importc.}
proc weirdfunc2(mango: ptr ptr cchar): int {.importc.}
-# includeHeader
-const header =
- when defined(HEADER): " -H"
- else: ""
-
-# Test AST2
-const mode =
- when defined(AST2): " -f:ast2"
- else: ""
-
-cImport(cSearchPath("test.h"), flags = header & mode)
+const FLAGS {.strdefine.} = ""
+cImport(cSearchPath("test.h"), flags = FLAGS)
check TEST_INT == 512
check TEST_FLOAT == 5.12
diff --git a/tests/tpcre.nim b/tests/tpcre.nim
index 0aa5a3b..21f3388 100644
--- a/tests/tpcre.nim
+++ b/tests/tpcre.nim
@@ -30,7 +30,8 @@ cPlugin:
proc onSymbol*(sym: var Symbol) {.exportc, dynlib.} =
sym.name = sym.name.replace("pcre_", "")
-cImport(pcreH, dynlib="dynpcre")
+const FLAGS {.strdefine.} = ""
+cImport(pcreH, dynlib="dynpcre", flags = FLAGS)
echo version()