diff options
| author | Ganesh Viswanathan <dev@genotrance.com> | 2020-04-13 10:18:49 -0500 |
|---|---|---|
| committer | Ganesh Viswanathan <dev@genotrance.com> | 2020-04-13 12:46:41 -0500 |
| commit | f23d17d0b2f2e6bd66b0d685461d9dd1c2070918 (patch) | |
| tree | 59335ce2603518b2512328b758ec29389f0eb2d5 /tests | |
| parent | b2de34328a92c6c9a63e3db12d4f78e7e5831d8c (diff) | |
| download | nimterop-f23d17d0b2f2e6bd66b0d685461d9dd1c2070918.tar.gz nimterop-f23d17d0b2f2e6bd66b0d685461d9dd1c2070918.zip | |
Fix #185 - forward decl symbol change
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/include/tast2.h | 16 | ||||
| -rw-r--r-- | tests/tast2.nim | 16 |
2 files changed, 27 insertions, 5 deletions
diff --git a/tests/include/tast2.h b/tests/include/tast2.h index 4854eb7..76aadc9 100644 --- a/tests/include/tast2.h +++ b/tests/include/tast2.h @@ -162,6 +162,14 @@ struct GPU_Target char *x, y, **z; }; +// Issue #185 +struct SDL_AudioCVT; + +typedef struct SDL_AudioCVT +{ + int needed; +} SDL_AudioCVT; + // DUPLICATES @@ -318,6 +326,14 @@ struct GPU_Target char *x, y, **z; }; +// Issue #185 +struct SDL_AudioCVT; + +typedef struct SDL_AudioCVT +{ + int needed; +} SDL_AudioCVT; + #endif diff --git a/tests/tast2.nim b/tests/tast2.nim index de0e743..4741062 100644 --- a/tests/tast2.nim +++ b/tests/tast2.nim @@ -32,7 +32,7 @@ cOverride: type A1* = A0 -cImport(path, flags="-f:ast2 -ENK_" & flags) +cImport(path, flags="-f:ast2 -ENK_,SDL_" & flags) proc getPragmas(n: NimNode): HashSet[string] = # Find all pragmas in AST, return as "name" or "name:value" in set @@ -57,7 +57,8 @@ proc getRecList(n: NimNode): NimNode = if not rl.isNil: return rl -macro checkPragmas(t: typed, pragmas: static[seq[string]], istype: static[bool] = true): untyped = +macro checkPragmas(t: typed, pragmas: static[seq[string]], istype: static[bool] = true, + prefix: static[string] = ""): untyped = # Verify that type has expected pragmas defined # `istype` is true when typedef X var @@ -67,9 +68,9 @@ macro checkPragmas(t: typed, pragmas: static[seq[string]], istype: static[bool] when defined(HEADER): if not istype: if "union" in exprag: - exprag.incl "importc:union " & $t + exprag.incl "importc:union " & $prefix & $t else: - exprag.incl "importc:struct " & $t + exprag.incl "importc:struct " & $prefix & $t doAssert symmetricDifference(prag, exprag).len == 0, "\nWrong number of pragmas in " & $t & "\n" & $prag & " vs " & $exprag @@ -361,4 +362,9 @@ checkPragmas(BASS_DEVICEINFO, pHeaderImpBy) # Issue #183 assert GPU_Target is object testFields(GPU_Target, "w|h|x|y|z!cint|ptr cint|cstring|cchar|ptr cstring") -checkPragmas(GPU_Target, pHeaderBy, istype = false)
\ No newline at end of file +checkPragmas(GPU_Target, pHeaderBy, istype = false) + +# Issue #185 +assert AudioCVT is object +testFields(AudioCVT, "needed!cint") +checkPragmas(AudioCVT, pHeaderBy, istype = false, "SDL_")
\ No newline at end of file |
