aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nimterop.nimble2
-rw-r--r--tests/include/test.h3
-rw-r--r--tests/tnimterop_c.nim11
3 files changed, 15 insertions, 1 deletions
diff --git a/nimterop.nimble b/nimterop.nimble
index 13bafae..0510abf 100644
--- a/nimterop.nimble
+++ b/nimterop.nimble
@@ -18,7 +18,7 @@ proc execCmd(cmd:string)=
task test, "Test":
execCmd "nim c -r tests/tnimterop_c.nim"
- #execCmd "nim cpp -r tests/tnimterop_c.nim"
+ # execCmd "nim cpp -r tests/tnimterop_c.nim"
execCmd "nim cpp -r tests/tnimterop_cpp.nim"
# when defined(windows):
# execCmd "nim c -r tests/tmath.nim"
diff --git a/tests/include/test.h b/tests/include/test.h
index 741fa97..8a8c579 100644
--- a/tests/include/test.h
+++ b/tests/include/test.h
@@ -20,6 +20,9 @@ extern "C" {
#define OSDEF 30
#endif
+#define foobar1(x) OSDEF * x
+#define foobar2(x) x + 1
+
typedef uint8_t PRIMTYPE;
typedef PRIMTYPE CUSTTYPE;
diff --git a/tests/tnimterop_c.nim b/tests/tnimterop_c.nim
index 74e1afa..1fd92b5 100644
--- a/tests/tnimterop_c.nim
+++ b/tests/tnimterop_c.nim
@@ -20,6 +20,10 @@ elif defined(windows):
else:
check OSDEF == 30
+block:
+ # workaround for https://github.com/nim-lang/Nim/issues/10129
+ const ok = OSDEF
+
var
pt: PRIMTYPE
ct: CUSTTYPE
@@ -79,3 +83,10 @@ check e3 == enum7
check e4 == enum11
cAddStdDir()
+
+## failing tests
+when false:
+ static: # Error: undeclared identifier: 'foobar1'
+ doAssert foobar1(3) == OSDEF * 3
+when false: # Error: undeclared identifier: 'foobar2'
+ doAssert foobar2(3) == 3 + 1