diff options
| author | Ganesh Viswanathan <dev@genotrance.com> | 2020-04-20 13:24:57 -0500 |
|---|---|---|
| committer | Ganesh Viswanathan <dev@genotrance.com> | 2020-04-20 13:24:57 -0500 |
| commit | e7bf0f61ad3629db7806968526e0f2014bb3a045 (patch) | |
| tree | fa6ed57d9fc7d43a3c07803f027c3bec4232c4ac | |
| parent | ab0439e60eab40a4e21d95261a8699690984b6a2 (diff) | |
| download | nimterop-e7bf0f61ad3629db7806968526e0f2014bb3a045.tar.gz nimterop-e7bf0f61ad3629db7806968526e0f2014bb3a045.zip | |
ast2 fix replace test
| -rw-r--r-- | tests/tast2.nim | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/tests/tast2.nim b/tests/tast2.nim index e9d9ced..e13c4ac 100644 --- a/tests/tast2.nim +++ b/tests/tast2.nim @@ -58,7 +58,7 @@ proc getRecList(n: NimNode): NimNode = return rl macro checkPragmas(t: typed, pragmas: static[seq[string]], istype: static[bool] = true, - prefix: static[string] = ""): untyped = + origname: static[string] = ""): untyped = # Verify that type has expected pragmas defined # `istype` is true when typedef X var @@ -68,9 +68,12 @@ 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 " & $prefix & $t + exprag.incl "importc:union " & $t else: - exprag.incl "importc:struct " & $prefix & $t + exprag.incl "importc:struct " & $t + elif origname.len != 0: + exprag.incl "importc:" & $origname + doAssert symmetricDifference(prag, exprag).len == 0, "\nWrong number of pragmas in " & $t & "\n" & $prag & " vs " & $exprag @@ -358,7 +361,7 @@ assert func2 is proc (f1: cint; sfunc2: proc (f1: cint; ssfunc2: proc (f1: cint) # Test --replace VICE=SLICE assert BASS_DESLICEINFO is object testFields(BASS_DESLICEINFO, "name|driver|flags!cstring|cstring|cint") -checkPragmas(BASS_DESLICEINFO, pHeaderImpBy) +checkPragmas(BASS_DESLICEINFO, pHeaderBy, origname = "BASS_DEVICEINFO") # Issue #183 assert GPU_Target is object @@ -368,7 +371,7 @@ checkPragmas(GPU_Target, pHeaderBy, istype = false) # Issue #185 assert AudioCVT is object testFields(AudioCVT, "needed!cint") -checkPragmas(AudioCVT, pHeaderBy, istype = false, "SDL_") +checkPragmas(AudioCVT, pHeaderBy, origname = "struct SDL_AudioCVT") # Issue #172 assert SomeType is object |
