summary refs log tree commit diff stats
path: root/tests/compiles
diff options
context:
space:
mode:
Diffstat (limited to 'tests/compiles')
-rw-r--r--tests/compiles/mstaticlib.nim1
-rw-r--r--tests/compiles/t8630.nim13
-rw-r--r--tests/compiles/tcompiles.nim12
-rw-r--r--tests/compiles/trecursive_generic_in_compiles.nim18
-rw-r--r--tests/compiles/tstaticlib.nim22
5 files changed, 50 insertions, 16 deletions
diff --git a/tests/compiles/mstaticlib.nim b/tests/compiles/mstaticlib.nim
new file mode 100644
index 000000000..6ed593691
--- /dev/null
+++ b/tests/compiles/mstaticlib.nim
@@ -0,0 +1 @@
+echo 1234
\ No newline at end of file
diff --git a/tests/compiles/t8630.nim b/tests/compiles/t8630.nim
new file mode 100644
index 000000000..8b447d061
--- /dev/null
+++ b/tests/compiles/t8630.nim
@@ -0,0 +1,13 @@
+discard """
+  output: '''
+foo
+bar
+'''
+"""
+
+proc test(strings: seq[string]) =
+  for s in strings:
+    var p3 = addr(s)
+    echo p3[]
+
+test(@["foo", "bar"])
diff --git a/tests/compiles/tcompiles.nim b/tests/compiles/tcompiles.nim
index b3d9c17ce..1a21315c8 100644
--- a/tests/compiles/tcompiles.nim
+++ b/tests/compiles/tcompiles.nim
@@ -1,13 +1,15 @@
 # test the new 'compiles' feature:
 
-template supports(opr, x: expr): bool {.immediate.} =
+template supports(opr, x: untyped): bool =
   compiles(opr(x)) or compiles(opr(x, x))
 
-template ok(x: expr): stmt =
-  static: assert(x)
+template ok(x) =
+  static:
+    assert(x)
 
-template no(x: expr): stmt =
-  static: assert(not x)
+template no(x) =
+  static:
+    assert(not x)
 
 type
   TObj = object
diff --git a/tests/compiles/trecursive_generic_in_compiles.nim b/tests/compiles/trecursive_generic_in_compiles.nim
index 77bf0bb02..ab31ad0f5 100644
--- a/tests/compiles/trecursive_generic_in_compiles.nim
+++ b/tests/compiles/trecursive_generic_in_compiles.nim
@@ -1,6 +1,10 @@
-# bug #3313
-import unittest, future
+discard """
+action: compile
+"""
 
+# bug #3313
+import unittest, sugar
+{.experimental: "notnil".}
 type
   ListNodeKind = enum
     lnkNil, lnkCons
@@ -46,7 +50,7 @@ proc `==`*[T](xs, ys: List[T]): bool =
 
 proc asList*[T](xs: varargs[T]): List[T] =
   ## Creates list from varargs
-  proc initListImpl(i: int, xs: openarray[T]): List[T] =
+  proc initListImpl(i: int, xs: openArray[T]): List[T] =
     if i > high(xs):
       Nil[T]()
     else:
@@ -88,11 +92,3 @@ proc foldLeft*[T,U](xs: List[T], z: U, f: (U, T) -> U): U =
   case xs.isEmpty
   of true: z
   else: foldLeft(xs.tail, f(z, xs.head), f)
-
-suite "unittest compilation error":
-
-  test "issue 3313":
-    let lst = lc[$x | (x <- 'a'..'z'), string].asList
-
-    let lstCopy = lst.dup
-    check: lstCopy == lst
diff --git a/tests/compiles/tstaticlib.nim b/tests/compiles/tstaticlib.nim
new file mode 100644
index 000000000..a18b59204
--- /dev/null
+++ b/tests/compiles/tstaticlib.nim
@@ -0,0 +1,22 @@
+import std/[os, osproc, strformat]
+
+
+const dir = "tests/compiles"
+const fileName = dir / "mstaticlib.nim"
+const nim = getCurrentCompilerExe()
+
+block: # bug #18578
+  const libName = dir / "tstaticlib1.a"
+  let (_, status) = execCmdEx(fmt"{nim} c -o:{libName} --app:staticlib {fileName}")
+  doAssert status == 0
+  doAssert fileExists(libName)
+  removeFile(libName)
+
+block: # bug #16947
+  const libName = dir / "tstaticlib2.a"
+  writeFile(libName, "echo 124")
+  doAssert fileExists(libName)
+  let (_, status) = execCmdEx(fmt"{nim} c -o:{libName} --app:staticlib {fileName}")
+  doAssert status == 0
+  doAssert fileExists(libName)
+  removeFile(libName)