aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2019-02-02 16:03:46 -0800
committergenotrance <dev@genotrance.com>2019-02-02 18:03:46 -0600
commit9fe45ac32b9c79ca2265accfdb89e37e91166d68 (patch)
tree2b794e7b0264d30ffc07680e8b3bc3001be331e2 /tests
parent74f4485ecdf09a6446bcdeefcae17f5020324172 (diff)
downloadnimterop-9fe45ac32b9c79ca2265accfdb89e37e91166d68.tar.gz
nimterop-9fe45ac32b9c79ca2265accfdb89e37e91166d68.zip
refs #68; turn some macros to CT procs; fix #112 (doc fixes) (#102)
* refs #68 macro=>proc cSkipSymbol * refs #68 macro=>proc cDebug * refs #68 macro=>proc cDisableCaching * refs #68 notes for cDefine * refs #68 macro=>proc cAddSearchDir ; improve some runnableExamples * refs #68 macro=>proc cAddStdDir * $projpath/include => testsIncludeDir() everywhere * disable $projpath interpolation (error prone) * fix tests * make nim doc part of test suite; fix for 0.19.2
Diffstat (limited to 'tests')
-rw-r--r--tests/config.nims.disabled7
-rw-r--r--tests/nim.cfg2
-rw-r--r--tests/tmath.nim12
-rw-r--r--tests/tnimterop_c.nim12
-rw-r--r--tests/tnimterop_cpp.nim12
-rw-r--r--tests/tsoloud.nim7
6 files changed, 31 insertions, 21 deletions
diff --git a/tests/config.nims.disabled b/tests/config.nims.disabled
new file mode 100644
index 0000000..06a791e
--- /dev/null
+++ b/tests/config.nims.disabled
@@ -0,0 +1,7 @@
+#[
+pending https://github.com/nim-lang/Nim/pull/10530
+note: nimble init installs something like this (maybe without src in this case)
+switch("path", "$projectDir/../src")
+but it doesn't seem robust in case tests have subdirs, so, changing to ../ seems better
+]#
+switch("path", "..")
diff --git a/tests/nim.cfg b/tests/nim.cfg
new file mode 100644
index 0000000..3936716
--- /dev/null
+++ b/tests/nim.cfg
@@ -0,0 +1,2 @@
+# TODO: pending https://github.com/nimterop/nimterop/issues/110 remove in favor of config.nims
+--path:".."
diff --git a/tests/tmath.nim b/tests/tmath.nim
index 63f1786..95fc086 100644
--- a/tests/tmath.nim
+++ b/tests/tmath.nim
@@ -1,15 +1,15 @@
-import nimterop/cimport
import unittest
+import nimterop/cimport
type
locale_t = object
mingw_ldbl_type_t = object
mingw_dbl_type_t = object
-cDebug()
-cDisableCaching()
-
-cAddStdDir()
+static:
+ cDebug()
+ cDisableCaching()
+ cAddStdDir()
cPlugin:
import strutils
@@ -21,4 +21,4 @@ cImport cSearchPath("math.h")
check sin(5) == -0.9589242746631385
check abs(-5) == 5
-check sqrt(4.00) == 2.0 \ No newline at end of file
+check sqrt(4.00) == 2.0
diff --git a/tests/tnimterop_c.nim b/tests/tnimterop_c.nim
index eca3324..86ac0fd 100644
--- a/tests/tnimterop_c.nim
+++ b/tests/tnimterop_c.nim
@@ -1,12 +1,14 @@
import std/unittest
import nimterop/cimport
+import nimterop/paths
-cDebug()
-cDisableCaching()
+static:
+ cDebug()
+ cDisableCaching()
+ cAddSearchDir testsIncludeDir()
cDefine("FORCE")
-cIncludeDir "$projpath/include"
-cAddSearchDir "$projpath/include"
+cIncludeDir testsIncludeDir()
cCompile cSearchPath("test.c")
cPlugin:
@@ -137,8 +139,6 @@ var
k: uKernel
kp: Kernel
-cAddStdDir()
-
## failing tests
when false:
static: # Error: undeclared identifier: 'foobar1'
diff --git a/tests/tnimterop_cpp.nim b/tests/tnimterop_cpp.nim
index a556818..14c8c8f 100644
--- a/tests/tnimterop_cpp.nim
+++ b/tests/tnimterop_cpp.nim
@@ -1,11 +1,13 @@
-import nimterop/cimport
import unittest
+import nimterop/cimport
+import nimterop/paths
-cDebug()
-cDisableCaching()
+static:
+ cDebug()
+ cDisableCaching()
+ cAddSearchDir testsIncludeDir()
-cIncludeDir "$projpath/include"
-cAddSearchDir "$projpath/include"
+cIncludeDir testsIncludeDir()
cCompile cSearchPath "test2.cpp"
cImport cSearchPath "test2.hpp"
diff --git a/tests/tsoloud.nim b/tests/tsoloud.nim
index ea7bbb2..f46dd10 100644
--- a/tests/tsoloud.nim
+++ b/tests/tsoloud.nim
@@ -7,9 +7,8 @@ const
static:
gitPull("https://github.com/jarikomppa/soloud", baseDir, "include/*\nsrc/*\n")
-
-cDebug()
-cDisableCaching()
+ cDebug()
+ cDisableCaching()
cOverride:
type
@@ -18,7 +17,7 @@ cOverride:
proc Soloud_destroy*(aSoloud: ptr Soloud) {.importc: "Soloud_destroy", header: cSearchPath(incl/"soloud_c.h").}
-cSkipSymbol("WavStream_stop", "WavStream_setFilter")
+static: cSkipSymbol @["WavStream_stop", "WavStream_setFilter"]
cIncludeDir(incl)