aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGanesh Viswanathan <dev@genotrance.com>2020-04-20 12:28:14 -0500
committerGanesh Viswanathan <dev@genotrance.com>2020-04-20 12:28:14 -0500
commitab0439e60eab40a4e21d95261a8699690984b6a2 (patch)
treeea7ea1bb6b68888f9e584c45bd3e406e9b757496 /tests
parent485c2f1ab2436094c28eabd97a3a1c02abcddf82 (diff)
downloadnimterop-ab0439e60eab40a4e21d95261a8699690984b6a2.tar.gz
nimterop-ab0439e60eab40a4e21d95261a8699690984b6a2.zip
ast2 static inline with -H, fix #188, --replace support
Diffstat (limited to 'tests')
-rw-r--r--tests/include/tast2.h8
-rw-r--r--tests/tast2.nim15
2 files changed, 18 insertions, 5 deletions
diff --git a/tests/include/tast2.h b/tests/include/tast2.h
index 1c1e935..bdf8823 100644
--- a/tests/include/tast2.h
+++ b/tests/include/tast2.h
@@ -198,6 +198,10 @@ typedef struct {
enum { NEV6 = 8 * 8, NEV7 } f8;
} nested;
+static inline int sitest1(int f1) {
+ return f1 * 2;
+}
+
// DUPLICATES
@@ -390,6 +394,10 @@ typedef struct {
enum { NEV6 = 8 * 8, NEV7 } f8;
} nested;
+static inline int sitest1(int f1) {
+ return f1 * 2;
+}
+
#endif
diff --git a/tests/tast2.nim b/tests/tast2.nim
index c49c008..e9d9ced 100644
--- a/tests/tast2.nim
+++ b/tests/tast2.nim
@@ -32,7 +32,7 @@ cOverride:
type
A1* = A0
-cImport(path, flags="-f:ast2 -ENK_,SDL_" & flags)
+cImport(path, flags="-f:ast2 -ENK_,SDL_ -GVICE=SLICE" & flags)
proc getPragmas(n: NimNode): HashSet[string] =
# Find all pragmas in AST, return as "name" or "name:value" in set
@@ -355,9 +355,10 @@ testFields(fieldfuncfunc,
assert func2 is proc (f1: cint; sfunc2: proc (f1: cint; ssfunc2: proc (f1: cint): ptr cint {.cdecl.}): ptr cint {.cdecl.}): ptr cint {.cdecl.}
-assert BASS_DEVICEINFO is object
-testFields(BASS_DEVICEINFO, "name|driver|flags!cstring|cstring|cint")
-checkPragmas(BASS_DEVICEINFO, pHeaderImpBy)
+# Test --replace VICE=SLICE
+assert BASS_DESLICEINFO is object
+testFields(BASS_DESLICEINFO, "name|driver|flags!cstring|cstring|cint")
+checkPragmas(BASS_DESLICEINFO, pHeaderImpBy)
# Issue #183
assert GPU_Target is object
@@ -419,4 +420,8 @@ assert NEV7 == 65
assert nested is object
testFields(nested, "f1|f2|f3|f4|f5|f6|f7|f8!NT1|Type_tast2h1|NT3|Type_tast2h3|NU2|Union_tast2h1|NE1|Enum_tast2h2")
-checkPragmas(nested, pHeaderImpBy) \ No newline at end of file
+checkPragmas(nested, pHeaderImpBy)
+
+when defined(HEADER):
+ assert sitest1(5) == 10
+ assert sitest1(10) == 20 \ No newline at end of file