aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2018-12-29 14:02:04 -0800
committerTimothee Cour <timothee.cour2@gmail.com>2018-12-29 14:15:34 -0800
commit9f7d2ca95637e6026336c9b1e264b321784737f4 (patch)
tree173a2d9f2c1627b79c3951d8d4276ec6a6d7cf55
parent1e086d59595c24ee8ec3f1dcc02b55d97fe9e2ec (diff)
downloadnimterop-9f7d2ca95637e6026336c9b1e264b321784737f4.tar.gz
nimterop-9f7d2ca95637e6026336c9b1e264b321784737f4.zip
add failing tests; add a test at CT
-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