summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/arc/t14383.nim14
-rw-r--r--tests/arc/t15909.nim16
-rw-r--r--tests/arc/tmovebug.nim33
-rw-r--r--tests/arc/topt_cursor2.nim29
-rw-r--r--tests/arc/torc_selfcycles.nim33
-rw-r--r--tests/ccgbugs/t13062.nim27
-rw-r--r--tests/concepts/t8558.nim26
-rw-r--r--tests/config.nims2
-rw-r--r--tests/deps/jester-#head/jester/request.nim2
-rw-r--r--tests/deps/x11-1.0/xvlib.nim2
-rw-r--r--tests/destructor/tdestructor3.nim11
-rw-r--r--tests/distinct/tdistinct.nim32
-rw-r--r--tests/effects/tstrict_funcs.nim2
-rw-r--r--tests/errmsgs/tgcsafety.nim4
-rw-r--r--tests/float/tfloatmod.nim2
-rw-r--r--tests/generics/tbintree.nim4
-rw-r--r--tests/iter/t2771.nim21
-rw-r--r--tests/js/t12303.nim16
-rw-r--r--tests/js/tmodify_cstring.nim6
-rw-r--r--tests/js/tos.nim26
-rw-r--r--tests/magics/t10307.nim23
-rw-r--r--tests/metatype/ttypetraits.nim40
-rw-r--r--tests/misc/t8404.nim33
-rw-r--r--tests/misc/taddr.nim (renamed from tests/js/taddr.nim)28
-rw-r--r--tests/misc/trunner.nim2
-rw-r--r--tests/misc/tsizeof.nim14
-rw-r--r--tests/nimdoc/t15916.nim16
-rw-r--r--tests/objects/t4318.nim12
-rw-r--r--tests/osproc/passenv.nim2
-rw-r--r--tests/overflw/tdistinct_range.nim6
-rw-r--r--tests/overload/t8829.nim18
-rw-r--r--tests/pragmas/t12558.nim15
-rw-r--r--tests/pragmas/tcustom_pragma.nim11
-rw-r--r--tests/statictypes/tstatictypes.nim118
-rw-r--r--tests/stdlib/concurrency/tatomics_size.nim18
-rw-r--r--tests/stdlib/t15663.nim7
-rw-r--r--tests/stdlib/t15835.nim17
-rw-r--r--tests/stdlib/tfrexp1.nim2
-rw-r--r--tests/stdlib/thttpcore.nim27
-rw-r--r--tests/stdlib/tintsets.nim65
-rw-r--r--tests/stdlib/tjsonutils.nim2
-rw-r--r--tests/stdlib/tpackedsets.nim259
-rw-r--r--tests/stdlib/trstgen.nim24
-rw-r--r--tests/stdlib/tsharedlist.nim17
-rw-r--r--tests/stdlib/tstring.nim7
-rw-r--r--tests/stdlib/tterminal_15874.nim8
-rw-r--r--tests/test_nimscript.nims6
-rw-r--r--tests/types/t14127_cast_number.nim30
-rw-r--r--tests/types/tisopr.nim26
-rw-r--r--tests/varres/tvarres0.nim3
-rw-r--r--tests/vm/t11637.nim52
-rw-r--r--tests/vm/tswap.nim12
52 files changed, 1131 insertions, 97 deletions
diff --git a/tests/arc/t14383.nim b/tests/arc/t14383.nim
index f112a1a6c..834c50def 100644
--- a/tests/arc/t14383.nim
+++ b/tests/arc/t14383.nim
@@ -34,3 +34,17 @@ echo x
 
 import std/os
 discard getFileInfo(".")
+
+
+#------------------------------------------------------------------------------
+# Issue #15707
+#------------------------------------------------------------------------------
+
+type
+  JVMObject = ref object
+proc freeJVMObject(o: JVMObject) =
+  discard
+proc fromJObject(T: typedesc[JVMObject]): T =
+  result.new(cast[proc(r: T) {.nimcall.}](freeJVMObject))
+
+discard JVMObject.fromJObject()
\ No newline at end of file
diff --git a/tests/arc/t15909.nim b/tests/arc/t15909.nim
new file mode 100644
index 000000000..f25c89daf
--- /dev/null
+++ b/tests/arc/t15909.nim
@@ -0,0 +1,16 @@
+discard """
+  action: run
+  cmd: "nim c --gc:arc $file"
+"""
+
+proc f1() {.noreturn.} = raise newException(CatchableError, "")
+
+proc f2(y: int): int =
+  if y != 0:
+    y
+  else:
+    f1()
+
+doAssert f2(5) == 5
+doAssertRaises(CatchableError):
+  discard f2(0)
diff --git a/tests/arc/tmovebug.nim b/tests/arc/tmovebug.nim
index 3b7a7c5df..61105b44e 100644
--- a/tests/arc/tmovebug.nim
+++ b/tests/arc/tmovebug.nim
@@ -70,6 +70,9 @@ king
 hi
 try
 bye
+()
+()
+()
 '''
 """
 
@@ -524,3 +527,33 @@ proc getScope2(): string =
     "else"
 
 echo getScope2()
+
+
+#--------------------------------------------------------------------
+#bug  #15609
+
+type
+  Wrapper = object
+    discard
+
+proc newWrapper(): ref Wrapper =
+  new(result)
+  result
+
+
+proc newWrapper2(a: int): ref Wrapper =
+  new(result)
+  if a > 0:
+    result
+  else:
+    new(Wrapper)
+
+
+let w1 = newWrapper()
+echo $w1[]
+
+let w2 = newWrapper2(1)
+echo $w2[]
+
+let w3 = newWrapper2(-1)
+echo $w3[]
\ No newline at end of file
diff --git a/tests/arc/topt_cursor2.nim b/tests/arc/topt_cursor2.nim
index 2e6fb256f..4b566ed24 100644
--- a/tests/arc/topt_cursor2.nim
+++ b/tests/arc/topt_cursor2.nim
@@ -1,6 +1,8 @@
-discard """
-  output: '''emptyemptyempty'''
+discard """  
   cmd: '''nim c --gc:arc $file'''
+  output: '''emptyemptyempty
+inner destroy
+'''
 """
 
 # bug #15039
@@ -49,3 +51,26 @@ proc parse() =
     echo children
 
 parse()
+
+
+#------------------------------------------------------------------------------
+# issue #15629
+
+type inner = object
+type outer = ref inner
+
+proc `=destroy`(b: var inner) =
+  echo "inner destroy"
+
+proc newOuter(): outer =
+  new(result)
+
+type holder = object
+  contents: outer
+
+proc main() = 
+  var t: holder
+  t.contents = newOuter()
+  
+main()
+
diff --git a/tests/arc/torc_selfcycles.nim b/tests/arc/torc_selfcycles.nim
new file mode 100644
index 000000000..ac4fa52ce
--- /dev/null
+++ b/tests/arc/torc_selfcycles.nim
@@ -0,0 +1,33 @@
+discard """
+  output: '''ok'''
+  cmd: '''nim c --gc:orc -d:useMalloc -d:nimStressOrc $file'''
+  valgrind: "leaks"
+"""
+
+# bug #15753
+
+type
+  NodeKind = enum
+    nkDancing,
+    nkColumn
+
+  DancingNode = ref object
+    right: DancingNode
+    column: DancingNode
+    kind: NodeKind
+
+proc newColumnNode(): DancingNode =
+  result = DancingNode(kind: nkColumn)
+  result.right = result
+  result.column = result
+
+proc createDLXList(): DancingNode =
+  result = newColumnNode()
+
+  for i in 0 .. 15:
+    let n = newColumnNode()
+    n.right = result.right
+    result = n
+  echo "ok"
+
+var dlxlist = createDLXList()
diff --git a/tests/ccgbugs/t13062.nim b/tests/ccgbugs/t13062.nim
new file mode 100644
index 000000000..fed32a1f7
--- /dev/null
+++ b/tests/ccgbugs/t13062.nim
@@ -0,0 +1,27 @@
+discard """
+  output: "[p = nil]"
+  targets: "c cpp"
+"""
+
+import atomics
+
+type
+  Pledge* {.exportc.} = object
+    p: PledgePtr
+
+  PledgeKind {.exportc.} = enum
+    Single
+    Iteration
+
+  PledgePtr {.exportc.} = ptr object
+    case kind: PledgeKind
+    of Single:
+      impl: PledgeImpl
+    of Iteration:
+      discard
+
+  PledgeImpl {.exportc.} = object
+    fulfilled: Atomic[bool]
+
+var x: Pledge
+echo x.repr
diff --git a/tests/concepts/t8558.nim b/tests/concepts/t8558.nim
new file mode 100644
index 000000000..acb2de30e
--- /dev/null
+++ b/tests/concepts/t8558.nim
@@ -0,0 +1,26 @@
+discard """
+  output: '''10
+9
+8
+7
+6
+5
+4
+3
+2
+1
+go!
+'''
+"""
+
+type Integral = concept x
+  x == 0 is bool
+  x - 1 is type(x)
+
+proc countToZero(n: Integral) =
+  if n == 0: echo "go!"
+  else:
+    echo n
+    countToZero(n-1)
+
+countToZero(10)
\ No newline at end of file
diff --git a/tests/config.nims b/tests/config.nims
index e91c3aa4f..640df9cad 100644
--- a/tests/config.nims
+++ b/tests/config.nims
@@ -1,7 +1,7 @@
 switch("path", "$lib/../testament/lib")
   # so we can `import stdtest/foo` inside tests
   # Using $lib/../ instead of $nim/ so you can use a different nim to run tests
-  # during local testing, eg nim --lib:lib.
+  # during local testing, e.g. nim --lib:lib.
 
 ## prevent common user config settings to interfere with testament expectations
 ## Indifidual tests can override this if needed to test for these options.
diff --git a/tests/deps/jester-#head/jester/request.nim b/tests/deps/jester-#head/jester/request.nim
index 7c6a1a961..20e5c840f 100644
--- a/tests/deps/jester-#head/jester/request.nim
+++ b/tests/deps/jester-#head/jester/request.nim
@@ -56,7 +56,7 @@ proc path*(req: Request): string =
     return u.path
 
 proc reqMethod*(req: Request): HttpMethod =
-  ## Request method, eg. HttpGet, HttpPost
+  ## Request method, e.g. HttpGet, HttpPost
   when useHttpBeast:
     req.req.httpMethod.get()
   else:
diff --git a/tests/deps/x11-1.0/xvlib.nim b/tests/deps/x11-1.0/xvlib.nim
index e642cb350..354a4b93b 100644
--- a/tests/deps/x11-1.0/xvlib.nim
+++ b/tests/deps/x11-1.0/xvlib.nim
@@ -155,7 +155,7 @@ type
     vert_y_period*: cuint
     vert_u_period*: cuint
     vert_v_period*: cuint
-    component_order*: array[0..31, char] # eg. UYVY
+    component_order*: array[0..31, char] # e.g. UYVY
     scanline_order*: cint     # XvTopToBottom, XvBottomToTop
 
   PXvImage* = ptr TXvImage
diff --git a/tests/destructor/tdestructor3.nim b/tests/destructor/tdestructor3.nim
index eb49f3f15..3f5eb2cc1 100644
--- a/tests/destructor/tdestructor3.nim
+++ b/tests/destructor/tdestructor3.nim
@@ -172,3 +172,14 @@ when true: # D20200607T202043
   main2()
 
 
+
+#------------------------------------------------------------
+# Issue #15825
+
+type
+  Union = string | int | char
+
+proc run(a: sink Union) =
+  discard
+
+run("123")
diff --git a/tests/distinct/tdistinct.nim b/tests/distinct/tdistinct.nim
index 2c0196745..d64f33443 100644
--- a/tests/distinct/tdistinct.nim
+++ b/tests/distinct/tdistinct.nim
@@ -106,3 +106,35 @@ type FooD = distinct int
 proc `<=`(a, b: FooD): bool {.borrow.}
 
 for f in [FooD(0): "Foo"]: echo f
+
+block tRequiresInit:
+  template accept(x) =
+    static: doAssert compiles(x)
+
+  template reject(x) =
+    static: doAssert not compiles(x)
+
+  type
+    Foo = object
+      x: string
+
+    DistinctFoo {.requiresInit, borrow: `.`.} = distinct Foo
+    DistinctString {.requiresInit.} = distinct string
+
+  reject:
+    var foo: DistinctFoo
+    foo.x = "test"
+    doAssert foo.x == "test"
+
+  accept:
+    let foo = DistinctFoo(Foo(x: "test"))
+    doAssert foo.x == "test"
+
+  reject:
+    var s: DistinctString
+    s = "test"
+    doAssert s == "test"
+
+  accept:
+    let s = "test"
+    doAssert s == "test"
diff --git a/tests/effects/tstrict_funcs.nim b/tests/effects/tstrict_funcs.nim
index 75ed9c8d9..0028e7d7e 100644
--- a/tests/effects/tstrict_funcs.nim
+++ b/tests/effects/tstrict_funcs.nim
@@ -2,7 +2,7 @@ discard """
   cmd: "nim c --experimental:strictFuncs --experimental:views $file"
 """
 
-import tables, streams, nre, parsecsv, uri
+import tables, streams, nre, parsecsv, uri, httpcore
 
 type
   Contig2Reads = TableRef[string, seq[string]]
diff --git a/tests/errmsgs/tgcsafety.nim b/tests/errmsgs/tgcsafety.nim
index e6a62204e..77515b74f 100644
--- a/tests/errmsgs/tgcsafety.nim
+++ b/tests/errmsgs/tgcsafety.nim
@@ -5,8 +5,8 @@ nimout: '''
 type mismatch: got <AsyncHttpServer, Port, proc (req: Request): Future[system.void]{.locks: <unknown>.}>
 but expected one of:
 proc serve(server: AsyncHttpServer; port: Port;
-          callback: proc (request: Request): Future[void] {.closure, gcsafe.};
-          address = ""): owned(Future[void])
+           callback: proc (request: Request): Future[void] {.closure, gcsafe.};
+           address = ""; assumedDescriptorsPerRequest = -1): owned(Future[void])
   first type mismatch at position: 3
   required type for callback: proc (request: Request): Future[system.void]{.closure, gcsafe.}
   but expression 'cb' is of type: proc (req: Request): Future[system.void]{.locks: <unknown>.}
diff --git a/tests/float/tfloatmod.nim b/tests/float/tfloatmod.nim
index 0b84ec7e0..37546a64c 100644
--- a/tests/float/tfloatmod.nim
+++ b/tests/float/tfloatmod.nim
@@ -1,5 +1,5 @@
 discard """
-  targets: "c c++ js"
+  targets: "c cpp js"
   output: "ok"
   exitcode: "0"
 """
diff --git a/tests/generics/tbintree.nim b/tests/generics/tbintree.nim
index a1a13c7b5..83f14406b 100644
--- a/tests/generics/tbintree.nim
+++ b/tests/generics/tbintree.nim
@@ -55,8 +55,8 @@ proc find*[Ty2](b: PBinaryTree[Ty2], data: Ty2): bool =
 
 iterator preorder*[T](root: PBinaryTree[T]): T =
   # Preorder traversal of a binary tree.
-  # Since recursive iterators are not yet implemented,
-  # this uses an explicit stack:
+  # This uses an explicit stack (which is more efficient than
+  # a recursive iterator factory).
   var stack: seq[PBinaryTree[T]] = @[root]
   while stack.len > 0:
     var n = stack.pop()
diff --git a/tests/iter/t2771.nim b/tests/iter/t2771.nim
new file mode 100644
index 000000000..49befb0a9
--- /dev/null
+++ b/tests/iter/t2771.nim
@@ -0,0 +1,21 @@
+template t1(i: int): int=
+  i+1
+template t2(i: int): int=
+  i+1
+
+doAssert t1(10).t2() == 12
+
+
+template it1(i: int): iterator(): int =
+  iterator result(): int {.closure, gensym.} =
+    yield i+1
+  result
+
+template it2(iter: iterator(): int): iterator(): int =
+  iterator result(): int {.closure, gensym.} =
+    yield iter()+1
+  result
+
+let x2 = it1(10).it2()
+
+doAssert x2() == 12
diff --git a/tests/js/t12303.nim b/tests/js/t12303.nim
new file mode 100644
index 000000000..270d82ced
--- /dev/null
+++ b/tests/js/t12303.nim
@@ -0,0 +1,16 @@
+discard """
+  output: "{ b: 2 }"
+"""
+
+import jsconsole, jsffi
+
+type
+  A = ref object
+   b: B
+
+  B = object
+    b: int
+
+var a = cast[A](js{})
+a.b = B(b: 2)
+console.log a.b
diff --git a/tests/js/tmodify_cstring.nim b/tests/js/tmodify_cstring.nim
new file mode 100644
index 000000000..82f8ccb23
--- /dev/null
+++ b/tests/js/tmodify_cstring.nim
@@ -0,0 +1,6 @@
+discard """
+  errormsg: "cstring doesn't support `[]=` operator"
+"""
+
+var x = cstring"abcd"
+x[0] = 'x'
diff --git a/tests/js/tos.nim b/tests/js/tos.nim
index 30c19c1ae..07eb3aaa3 100644
--- a/tests/js/tos.nim
+++ b/tests/js/tos.nim
@@ -19,3 +19,29 @@ block:
   if not isWindows:
     doAssert cwd.isAbsolute
     doAssert relativePath(getCurrentDir() / "foo", "bar") == "../foo"
+
+import std/sequtils
+
+template main =
+  putEnv("foo", "bar")
+  doAssert getEnv("foo") == "bar"
+  doAssert existsEnv("foo")
+
+  putEnv("foo", "")
+  doAssert existsEnv("foo")
+  putEnv("foo", "bar2")
+  doAssert getEnv("foo") == "bar2"
+
+  when nimvm:
+    discard
+  else:
+    # need support in vmops: envPairs, delEnv
+    let s = toSeq(envPairs())
+    doAssert ("foo", "bar2") in s
+    doAssert ("foo", "bar") notin s
+
+    delEnv("foo")
+    doAssert not existsEnv("foo")
+
+static: main()
+main()
diff --git a/tests/magics/t10307.nim b/tests/magics/t10307.nim
new file mode 100644
index 000000000..111b0d221
--- /dev/null
+++ b/tests/magics/t10307.nim
@@ -0,0 +1,23 @@
+discard """
+  cmd: "nim c -d:useGcAssert $file"
+  output: '''running someProc(true)
+res: yes
+yes
+running someProc(false)
+res:
+'''
+"""
+
+proc someProc(x:bool):cstring =
+  var res:string = ""
+  if x:
+    res = "yes"
+  echo "res: ", res
+  GC_ref(res)
+  result = res
+
+echo "running someProc(true)"
+echo someProc(true)
+
+echo "running someProc(false)"
+echo someProc(false)
\ No newline at end of file
diff --git a/tests/metatype/ttypetraits.nim b/tests/metatype/ttypetraits.nim
index 50c474fe9..326faac82 100644
--- a/tests/metatype/ttypetraits.nim
+++ b/tests/metatype/ttypetraits.nim
@@ -303,3 +303,43 @@ block: # elementType
   var a: seq[int]
   doAssert elementType(a) is int
   doAssert elementType(seq[char].default) is char
+
+block: # enum.len
+  type
+    Direction = enum
+      north, east, south, west
+    
+    Direction2 = Direction
+    Direction3 = Direction2
+
+    TokenType = enum
+      a = 2, b = 4, c = 89
+    
+    MyEnum = enum
+      ##[This is test of enum with a doc comment.
+
+         Which is also a multi line one.]##
+      valueA = (0, "my value A"),
+        ## The items are also commented. This has both integer and string
+        ## values.
+      valueB = "value B",
+        ## This item has only a string value,
+      valueC = 2,
+        ## and this one only an integer.
+      valueD = (3, "abc")
+        ## Both, integer and string values again.
+
+    OtherEnum {.pure.} = enum
+      valueX, valueY, valueZ
+
+    MyFlag {.size: sizeof(cint).} = enum
+      A, B, C, D
+
+  static:
+    doAssert Direction.enumLen == 4
+    doAssert Direction2.enumLen == 4
+    doAssert Direction3.enumLen == 4
+    doAssert TokenType.enumLen == 3
+    doAssert MyEnum.enumLen == 4
+    doAssert OtherEnum.enumLen == 3
+    doAssert MyFlag.enumLen == 4
diff --git a/tests/misc/t8404.nim b/tests/misc/t8404.nim
new file mode 100644
index 000000000..87991071c
--- /dev/null
+++ b/tests/misc/t8404.nim
@@ -0,0 +1,33 @@
+discard """
+  targets: "c cpp js"
+"""
+template main() =
+  block: # bug #8404
+    # can conv
+    template float2int(T) =
+      var a = -1.0
+      let b = T(a)
+      doAssert b < 0
+      let c = b + 1
+      doAssert c is T
+      doAssert c == 0
+
+    float2int(int8)
+    float2int(int16)
+    float2int(int32)
+    float2int(int64)
+
+  block:
+    # can handle middle conv
+    # `/` can trigger int to float
+    template float2int(T) =
+      let n = T(1 / 256)
+      doAssert n == 0
+
+    float2int(int8)
+    float2int(int16)
+    float2int(int32)
+    # float2int(int64)
+main()
+static:
+  main()
diff --git a/tests/js/taddr.nim b/tests/misc/taddr.nim
index 9c45621a8..4d0aebc01 100644
--- a/tests/js/taddr.nim
+++ b/tests/misc/taddr.nim
@@ -1,5 +1,6 @@
 discard """
-  targets: "c js"
+  targets: "c cpp js"
+  matrix: "; -d:release"
 """
 
 type T = object
@@ -79,7 +80,7 @@ someGlobalPtr[] = 10
 doAssert(someGlobal == 10)
 
 block:
-  # issue #14576
+  # bug #14576
   # lots of these used to give: Error: internal error: genAddr: 2
   proc byLent[T](a: T): lent T = a
   proc byPtr[T](a: T): ptr T = a.unsafeAddr
@@ -89,24 +90,21 @@ block:
     let (x,y) = byLent(a)
     doAssert (x,y) == a
 
-  block:
-    when defined(c) and defined(release):
-      # bug; pending https://github.com/nim-lang/Nim/issues/14578
-      discard
-    else:
-      let a = 10
-      doAssert byLent(a) == 10
-      let a2 = byLent(a)
-      doAssert a2 == 10
+  block: # (with -d:release) bug #14578
+    let a = 10
+    doAssert byLent(a) == 10
+    let a2 = byLent(a)
+    doAssert a2 == 10
 
   block:
-    let a = [11,12]
-    doAssert byLent(a) == [11,12]
+    when not defined(cpp): # pending bug #15958
+      let a = [11,12]
+      doAssert byLent(a) == [11,12]
     let a2 = (11,)
     doAssert byLent(a2) == (11,)
 
   block:
-    when defined(c) and defined(release):
+    when (defined(c) or defined(cpp)) and defined(release):
       discard # probably not a bug since optimizer is free to pass by value, and `unsafeAddr` is used
     else:
       var a = @[12]
@@ -134,6 +132,6 @@ block:
     bar(a2).inc
     doAssert a2 == 13
 
-  block: # xxx: bug this doesn't work
+  block: # pending bug #15959
     when false:
       proc byLent2[T](a: T): lent type(a[0]) = a[0]
diff --git a/tests/misc/trunner.nim b/tests/misc/trunner.nim
index d67547d62..018916e67 100644
--- a/tests/misc/trunner.nim
+++ b/tests/misc/trunner.nim
@@ -149,7 +149,7 @@ mmain.html
       doAssert exitCode == 0, output
     block:
       let (output, exitCode) = runCmd(file, "-d:checkAbi -d:caseBad")
-      # on platforms that support _StaticAssert natively, errors will show full context, eg:
+      # on platforms that support _StaticAssert natively, errors will show full context, e.g.:
       # error: static_assert failed due to requirement 'sizeof(unsigned char) == 8'
       # "backend & Nim disagree on size for: BadImportcType{int64} [declared in mabi_check.nim(1, 6)]"
       check2 "sizeof(unsigned char) == 8"
diff --git a/tests/misc/tsizeof.nim b/tests/misc/tsizeof.nim
index a09265667..0d96a5e04 100644
--- a/tests/misc/tsizeof.nim
+++ b/tests/misc/tsizeof.nim
@@ -361,6 +361,16 @@ testinstance:
           y: int32
       z: AnotherEnum
 
+    Stack[N: static int, T: object] = object
+      pad: array[128 - sizeof(array[N, ptr T]) - sizeof(int) - sizeof(pointer), byte]
+      stack: array[N, ptr T]
+      len*: int
+      rawMem: ptr array[N, T]
+
+    Stack2[T: object] = object
+      pad: array[128 - sizeof(array[sizeof(T), ptr T]), byte]
+    
+
   const trivialSize = sizeof(TrivialType) # needs to be able to evaluate at compile time
 
   proc main(): void =
@@ -377,6 +387,8 @@ testinstance:
     var po : PaddingOfSetEnum33
     var capo: MyCustomAlignPackedObject
     var issue15516: MyObject
+    var issue12636_1: Stack[5, MyObject]
+    var issue12636_2: Stack2[MyObject]
 
     var
       e1: Enum1
@@ -395,7 +407,7 @@ testinstance:
     else:
       doAssert sizeof(SimpleAlignment) > 10
 
-    testSizeAlignOf(t,a,b,c,d,e,f,g,ro,go,po, e1, e2, e4, e8, eoa, eob, capo, issue15516)
+    testSizeAlignOf(t,a,b,c,d,e,f,g,ro,go,po, e1, e2, e4, e8, eoa, eob, capo, issue15516, issue12636_1, issue12636_2)
 
     type
       WithBitsize {.objectconfig.} = object
diff --git a/tests/nimdoc/t15916.nim b/tests/nimdoc/t15916.nim
new file mode 100644
index 000000000..c6c09d94b
--- /dev/null
+++ b/tests/nimdoc/t15916.nim
@@ -0,0 +1,16 @@
+discard """
+cmd: "nim doc --hints:off $file"
+action: "compile"
+joinable: false
+"""
+
+type
+  Test* = object
+    id: int
+
+proc initTest*(id: int): Test =
+  result.id = id
+
+proc hello*() =
+  runnableExamples:
+    discard
diff --git a/tests/objects/t4318.nim b/tests/objects/t4318.nim
new file mode 100644
index 000000000..34ff722f5
--- /dev/null
+++ b/tests/objects/t4318.nim
@@ -0,0 +1,12 @@
+type
+  A = object of RootObj
+  B = object of A
+
+method identify(a:A) {.base.} = echo "A"
+method identify(b:B) = echo "B"
+
+var b: B
+
+doAssertRaises(ObjectAssignmentDefect):
+  var a: A = b
+  discard a
diff --git a/tests/osproc/passenv.nim b/tests/osproc/passenv.nim
index 815f7536f..40b1c3f7c 100644
--- a/tests/osproc/passenv.nim
+++ b/tests/osproc/passenv.nim
@@ -1,7 +1,7 @@
 discard """
   file: "passenv.nim"
   output: "123"
-  targets: "c c++ objc"
+  targets: "c cpp objc"
 """
 
 import osproc, os, strtabs
diff --git a/tests/overflw/tdistinct_range.nim b/tests/overflw/tdistinct_range.nim
new file mode 100644
index 000000000..f53515d45
--- /dev/null
+++ b/tests/overflw/tdistinct_range.nim
@@ -0,0 +1,6 @@
+discard """
+  outputsub: "Error: unhandled exception: over- or underflow [OverflowDefect]"
+  exitcode: "1"
+"""
+var x: distinct range[0..5]
+dec(x)
\ No newline at end of file
diff --git a/tests/overload/t8829.nim b/tests/overload/t8829.nim
new file mode 100644
index 000000000..a688e18cb
--- /dev/null
+++ b/tests/overload/t8829.nim
@@ -0,0 +1,18 @@
+block:
+  let txt = "Hello World"
+
+  template `[]`[T](p: ptr T, span: Slice[int]): untyped =
+    toOpenArray(cast[ptr array[0, T]](p)[], span.a, span.b)
+
+  doAssert $cast[ptr uint8](txt[0].unsafeAddr)[0 ..< txt.len] == 
+                "[72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100]"
+
+
+block:
+  let txt = "Hello World"
+
+  template `[]`[T](p: ptr T, span: Slice[int]): untyped =
+    toOpenArray(cast[ptr array[0, T]](p)[], span.a, span.b)
+
+  doAssert $cast[ptr uint8](txt[0].unsafeAddr)[0 ..< txt.len] == 
+                "[72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100]"
diff --git a/tests/pragmas/t12558.nim b/tests/pragmas/t12558.nim
new file mode 100644
index 000000000..14fc74cee
--- /dev/null
+++ b/tests/pragmas/t12558.nim
@@ -0,0 +1,15 @@
+discard """
+  nimout: '''@["1", "2", "3"]'''
+"""
+
+import sequtils
+
+{.push compile_time.}
+
+proc foo =
+  echo map_it([1, 2, 3], $it)
+
+{.pop.}
+
+static:
+  foo()
diff --git a/tests/pragmas/tcustom_pragma.nim b/tests/pragmas/tcustom_pragma.nim
index 756396529..a4a200c34 100644
--- a/tests/pragmas/tcustom_pragma.nim
+++ b/tests/pragmas/tcustom_pragma.nim
@@ -367,3 +367,14 @@ block:
   let x = RefType2()
   for fieldName, fieldSym in fieldPairs(x[]):
     doAssert hasCustomPragma(fieldSym, myCustomPragma)
+
+# bug 8457
+block:
+  template world {.pragma.}
+
+  type
+    Hello = ref object
+      a: float32
+      b {.world.}: int
+
+  discard Hello(a: 1.0, b: 12)
diff --git a/tests/statictypes/tstatictypes.nim b/tests/statictypes/tstatictypes.nim
index 50dc60e09..fe1d1c8ca 100644
--- a/tests/statictypes/tstatictypes.nim
+++ b/tests/statictypes/tstatictypes.nim
@@ -10,6 +10,8 @@ b is 2 times a
 17
 ['\x00', '\x00', '\x00', '\x00']
 heyho
+Val1
+Val1
 '''
 """
 
@@ -239,3 +241,119 @@ let t = T[true](foo: "hey")
 let u = U[false](bar: "ho")
 echo t.foo, u.bar
 
+
+#------------------------------------------------------------------------------
+# issue #9679
+
+discard """
+  output: ''''''
+"""
+type
+  Foo*[T] = object
+    bar*: int
+    dummy: T
+
+proc initFoo(T: type, bar: int): Foo[T] =
+  result.bar = 1
+
+proc fails[T](x: static Foo[T]) = # Change to non-static and it compiles
+  doAssert($x == "(bar: 1, dummy: 0)")
+
+block:
+  const foo = initFoo(int, 2)
+  fails(foo)
+
+
+import macros, tables
+
+var foo{.compileTime.} = [
+  "Foo",
+  "Bar"
+]
+
+var bar{.compileTime.} = {
+  0: "Foo",
+  1: "Bar"
+}.toTable()
+
+macro fooM(): untyped =
+  for i, val in foo:
+    echo i, ": ", val
+
+macro barM(): untyped =
+  for i, val in bar:
+    echo i, ": ", val
+
+macro fooParam(x: static array[2, string]): untyped =
+  for i, val in x:
+    echo i, ": ", val
+
+macro barParam(x: static Table[int, string]): untyped =
+  for i, val in x:
+    echo i, ": ", val
+
+fooM()
+barM()
+fooParam(foo)
+barParam(bar)
+
+
+#-----------------------------------------------------------------------------------------
+# issue #7546
+type
+  rangeB[N: static[int16]] = range[0'i16 .. N]
+  setB[N: static[int16]] = set[rangeB[N]]
+
+block:
+  var s : setB[14'i16]
+
+
+#-----------------------------------------------------------------------------------------
+# issue #9520
+
+type
+  MyEnum = enum
+    Val1, Val2
+
+proc myproc(a: static[MyEnum], b: int) =
+  if b < 0:
+    myproc(a, -b)
+
+  echo $a
+
+myproc(Val1, -10)
+
+
+#------------------------------------------------------------------------------------------
+# issue #6177
+
+type                                                                                                 
+  G[N,M:static[int], T] = object                                                                      
+    o: T                                                                                             
+                                                                                                     
+proc newG[N,M:static[int],T](x:var G[N,M,T], y:T) =                                                  
+  x.o = y+10*N+100*M                                                                                 
+                                                                                                     
+proc newG[N,M:static[int],T](x:T):G[N,M,T] = result.newG(x)                                          
+                                                                                                     
+var x:G[2,3,int]                                                                                     
+x.newG(4)                                                                                            
+var y = newG[2,3,int](4)
+
+
+#------------------------------------------------------------------------------------------
+# issue #12897
+
+type
+  TileCT[n: static int] = object
+    a: array[n, int]
+  Tile = TileCT #Commenting this out to make it work
+
+
+#------------------------------------------------------------------------------------------
+# issue #15858
+
+proc fn(N1: static int, N2: static int, T: typedesc): array[N1 * N2, T] = 
+  doAssert(len(result) == N1 * N2)
+
+let yy = fn(5, 10, float)
diff --git a/tests/stdlib/concurrency/tatomics_size.nim b/tests/stdlib/concurrency/tatomics_size.nim
new file mode 100644
index 000000000..49387c0c1
--- /dev/null
+++ b/tests/stdlib/concurrency/tatomics_size.nim
@@ -0,0 +1,18 @@
+discard """
+  targets: "c cpp"
+"""
+import std/atomics
+
+block testSize: # issue 12726
+  type
+    Node = ptr object
+      # works
+      next: Atomic[pointer]
+      f:AtomicFlag
+    MyChannel = object
+      # type not defined completely
+      back: Atomic[ptr int]
+      f: AtomicFlag
+  static:
+    doAssert sizeof(Node) == sizeof(pointer)
+    doAssert sizeof(MyChannel) == sizeof(pointer) * 2
\ No newline at end of file
diff --git a/tests/stdlib/t15663.nim b/tests/stdlib/t15663.nim
new file mode 100644
index 000000000..1ad5677fd
--- /dev/null
+++ b/tests/stdlib/t15663.nim
@@ -0,0 +1,7 @@
+discard """
+  cmd: "nim c --gc:arc $file"
+  output: "Test"
+"""
+
+let ws = newWideCString("Test")
+echo ws
\ No newline at end of file
diff --git a/tests/stdlib/t15835.nim b/tests/stdlib/t15835.nim
new file mode 100644
index 000000000..bddfa87aa
--- /dev/null
+++ b/tests/stdlib/t15835.nim
@@ -0,0 +1,17 @@
+import json
+
+type
+  Foo = object
+    ii*: int
+    data*: JsonNode
+
+block:
+  const jt = """{"ii": 123, "data": ["some", "data"]}"""
+  let js = parseJson(jt)
+  discard js.to(Foo)
+
+block:
+  const jt = """{"ii": 123}"""
+  let js = parseJson(jt)
+  doAssertRaises(KeyError):
+    echo js.to(Foo)
diff --git a/tests/stdlib/tfrexp1.nim b/tests/stdlib/tfrexp1.nim
index 6da185420..21ecc7491 100644
--- a/tests/stdlib/tfrexp1.nim
+++ b/tests/stdlib/tfrexp1.nim
@@ -1,5 +1,5 @@
 discard """
-  targets: "js c c++"
+  targets: "js c cpp"
   output: '''ok'''
 """
 
diff --git a/tests/stdlib/thttpcore.nim b/tests/stdlib/thttpcore.nim
index 33c24453e..cb1a0875f 100644
--- a/tests/stdlib/thttpcore.nim
+++ b/tests/stdlib/thttpcore.nim
@@ -51,3 +51,30 @@ suite "httpcore":
     doAssert parseHeader("Accept: foo, bar") == (key: "Accept", value: @["foo", "bar"])
     doAssert parseHeader("Accept: foo, bar, prologue") == (key: "Accept", value: @["foo", "bar", "prologue"])
     doAssert parseHeader("Accept: foo, bar, prologue, starlight") == (key: "Accept", value: @["foo", "bar", "prologue", "starlight"])
+
+  test "add empty sequence to HTTP headers":
+    block:
+      var headers = newHttpHeaders()
+      headers["empty"] = @[]
+
+      doAssert not headers.hasKey("empty")
+
+    block:
+      var headers = newHttpHeaders()
+      headers["existing"] = "true"
+      headers["existing"] = @[]
+
+      doAssert not headers.hasKey("existing")
+
+    block:
+      var headers = newHttpHeaders()
+      headers["existing"] = @["true"]
+      headers["existing"] = @[]
+
+      doAssert not headers.hasKey("existing")
+
+    block:
+      var headers = newHttpHeaders()
+      headers["existing"] = @[]
+      headers["existing"] = @["true"]
+      doAssert headers.hasKey("existing")
diff --git a/tests/stdlib/tintsets.nim b/tests/stdlib/tintsets.nim
deleted file mode 100644
index f859b87ae..000000000
--- a/tests/stdlib/tintsets.nim
+++ /dev/null
@@ -1,65 +0,0 @@
-import intsets
-import std/sets
-
-from sequtils import toSeq
-from algorithm import sorted
-
-proc sortedPairs[T](t: T): auto = toSeq(t.pairs).sorted
-template sortedItems(t: untyped): untyped = sorted(toSeq(t))
-
-block: # we use HashSet as groundtruth, it's well tested elsewhere
-  template testDel(t, t0) =
-
-    template checkEquals() =
-      doAssert t.len == t0.len
-      for k in t0:
-        doAssert k in t
-      for k in t:
-        doAssert k in t0
-
-      doAssert sortedItems(t) == sortedItems(t0)
-
-    template incl2(i) =
-      t.incl i
-      t0.incl i
-
-    template excl2(i) =
-      t.excl i
-      t0.excl i
-
-    block:
-      var expected: seq[int]
-      let n = 100
-      let n2 = n*2
-      for i in 0..<n:
-        incl2(i)
-      checkEquals()
-      for i in 0..<n:
-        if i mod 3 == 0:
-          if i < n div 2:
-            excl2(i)
-          else:
-            t0.excl i
-            doAssert i in t
-            doAssert not t.missingOrExcl(i)
-
-      checkEquals()
-      for i in n..<n2:
-        incl2(i)
-      checkEquals()
-      for i in 0..<n2:
-        if i mod 7 == 0:
-          excl2(i)
-      checkEquals()
-
-      # notin check
-      for i in 0..<t.len:
-        if i mod 7 == 0:
-          doAssert i notin t0
-          doAssert i notin t
-          # issue #13505
-          doAssert t.missingOrExcl(i)
-
-  var t: IntSet
-  var t0: HashSet[int]
-  testDel(t, t0)
diff --git a/tests/stdlib/tjsonutils.nim b/tests/stdlib/tjsonutils.nim
index fefd412e7..28f05ecbe 100644
--- a/tests/stdlib/tjsonutils.nim
+++ b/tests/stdlib/tjsonutils.nim
@@ -57,7 +57,7 @@ template fn() =
       """[1.1,"fo",120,[10,11],[true,false],[{"mode":"modeCaseSensitive","table":{"y":"Y","z":"Z"}},{"mode":"modeCaseSensitive","table":{}}],[0,3],-4,{"foo":0.5,"bar":{"a1":"abc"},"bar2":null}]"""
 
   block:
-    # edge case when user defined `==` doesn't handle `nil` well, eg:
+    # edge case when user defined `==` doesn't handle `nil` well, e.g.:
     # https://github.com/nim-lang/nimble/blob/63695f490728e3935692c29f3d71944d83bb1e83/src/nimblepkg/version.nim#L105
     testRoundtrip(@[Foo(id: 10), nil]): """[{"id":10},null]"""
 
diff --git a/tests/stdlib/tpackedsets.nim b/tests/stdlib/tpackedsets.nim
new file mode 100644
index 000000000..d0149adc5
--- /dev/null
+++ b/tests/stdlib/tpackedsets.nim
@@ -0,0 +1,259 @@
+import std/packedsets
+import std/sets
+
+import sequtils
+import algorithm
+
+block basicIntSetTests:
+  var y = initPackedSet[int]()
+  y.incl(1)
+  y.incl(2)
+  y.incl(7)
+  y.incl(1056)
+
+  y.incl(1044)
+  y.excl(1044)
+
+  doAssert y == [1, 2, 7, 1056].toPackedSet
+  doAssert toSeq(y.items) == [1, 2, 7, 1056]
+
+  doAssert y.containsOrIncl(888) == false
+  doAssert 888 in y
+  doAssert y.containsOrIncl(888) == true
+
+  doAssert y.missingOrExcl(888) == false
+  doAssert 888 notin y
+  doAssert y.missingOrExcl(888) == true
+
+proc sortedPairs[T](t: T): auto = toSeq(t.pairs).sorted
+template sortedItems(t: untyped): untyped = sorted(toSeq(t))
+
+type Id = distinct int
+proc `$`(x: Id): string {.borrow.}
+proc cmp(a: Id, b: Id): int {.borrow.}
+proc `==`(a: Id, b: Id): bool {.borrow.}
+proc `<`(a: Id, b: Id): bool {.borrow.}
+
+block genericTests: 
+  # we use HashSet as groundtruth, it's well tested elsewhere
+  template testDel(A: typedesc, t: typed, t0: typed) =
+
+    block:
+      template checkEquals() =
+        doAssert t.len == t0.len
+        for k in t0:
+          doAssert k in t
+        for k in t:
+          doAssert k in t0
+
+        doAssert sortedItems(t) == sortedItems(t0)
+
+      template incl2(i) =
+        t.incl i
+        t0.incl i
+
+      template excl2(i) =
+        t.excl i
+        t0.excl i
+
+      var expected: seq[A]
+      let n = 100
+      let n2 = n*2
+      for i in 0..<n:
+        incl2(A(i))
+      checkEquals()
+      for i in 0..<n:
+        if i mod 3 == 0:
+          if i < n div 2:
+            excl2(A(i))
+          else:
+            t0.excl A(i)
+            doAssert A(i) in t
+            doAssert not t.missingOrExcl A(i)
+
+      checkEquals()
+      for i in n..<n2:
+        incl2(A(i))
+      checkEquals()
+      for i in 0..<n2:
+        if i mod 7 == 0:
+          excl2(A(i))
+      checkEquals()
+
+      # notin check
+      for i in 0..<t.len:
+        if i mod 7 == 0:
+          doAssert A(i) notin t0
+          doAssert A(i) notin t
+          # issue #13505
+          doAssert t.missingOrExcl(A(i))
+
+  var t: PackedSet[int]
+  var t0: HashSet[int]
+  testDel(int, t, t0)
+
+  var distT: PackedSet[Id]
+  var distT0: HashSet[Id]
+  testDel(Id, distT, distT0)
+
+  doAssert union(distT, initPackedSet[Id]()) == distT
+
+  var charT: PackedSet[char]
+  var charT0: HashSet[char]
+  testDel(char, charT, charT0)
+
+
+block typeSafetyTest:
+  # mixing sets of different types shouldn't compile
+  doAssert not compiles( union(initPackedSet[Id](), initPackedSet[int]()) )
+  doAssert     compiles( union(initPackedSet[Id](), initPackedSet[Id]()))
+
+  var ids: PackedSet[Id]
+  doAssert not compiles( ids.incl(3) )
+  doAssert     compiles( ids.incl(Id(3)) )
+
+  type NonOrdinal = string
+  doAssert not compiles( initPackedSet[NonOrdinal]() )
+
+type EnumABCD = enum A, B, C, D
+
+block enumTest:
+  var letterSet = initPackedSet[EnumABCD]()
+
+  for x in [A, C]:
+    letterSet.incl(x)
+
+  doAssert A in letterSet
+  doAssert B notin letterSet
+  doAssert C in letterSet
+  doAssert D notin letterSet
+
+type Foo = distinct int16
+proc `$`(a: Foo): string {.borrow.} # `echo a` below won't work without `$` defined, as expected
+
+block printTest:
+  var a = initPackedSet[EnumABCD]()
+  a.incl A
+  a.incl C 
+  doAssert $a == "{A, C}"
+
+import intsets
+
+block legacyMainModuleTests:
+  template genericTests(A: typedesc[Ordinal], x: typed) =
+    block:
+      proc typSeq(s: seq[int]): seq[A] = s.map(proc (i: int): A = A(i))
+      x.incl(A(1))
+      x.incl(A(2))
+      x.incl(A(7))
+      x.incl(A(1056))
+
+      x.incl(A(1044))
+      x.excl(A(1044))
+
+      doAssert x == typSeq(@[1, 2, 7, 1056]).toPackedSet
+
+      doAssert x.containsOrIncl(A(888)) == false
+      doAssert A(888) in x
+      doAssert x.containsOrIncl(A(888)) == true
+
+      doAssert x.missingOrExcl(A(888)) == false
+      doAssert A(888) notin x
+      doAssert x.missingOrExcl(A(888)) == true
+
+      var xs = toSeq(items(x))
+      xs.sort(cmp[A])
+      doAssert xs == typSeq(@[1, 2, 7, 1056])
+
+      var y: PackedSet[A]
+      assign(y, x)
+      var ys = toSeq(items(y))
+      ys.sort(cmp[A])
+      doAssert ys == typSeq(@[1, 2, 7, 1056])
+
+      doAssert x == y
+
+      var z: PackedSet[A]
+      for i in 0..1000:
+        incl z, A(i)
+        doAssert z.len() == i+1
+      for i in 0..1000:
+        doAssert z.contains(A(i))
+
+      var w = initPackedSet[A]()
+      w.incl(A(1))
+      w.incl(A(4))
+      w.incl(A(50))
+      w.incl(A(1001))
+      w.incl(A(1056))
+
+      var xuw = x.union(w)
+      var xuws = toSeq(items(xuw))
+      xuws.sort(cmp)
+      doAssert xuws == typSeq(@[1, 2, 4, 7, 50, 1001, 1056])
+
+      var xiw = x.intersection(w)
+      var xiws = toSeq(items(xiw))
+      xiws.sort(cmp)
+      doAssert xiws == @[A(1), A(1056)]
+
+      var xdw = x.difference(w)
+      var xdws = toSeq(items(xdw))
+      xdws.sort(cmp[A])
+      doAssert xdws == @[A(2), A(7)]
+
+      var xsw = x.symmetricDifference(w)
+      var xsws = toSeq(items(xsw))
+      xsws.sort(cmp[A])
+      doAssert xsws == typSeq(@[2, 4, 7, 50, 1001])
+
+      x.incl(w)
+      xs = toSeq(items(x))
+      xs.sort(cmp[A])
+      doAssert xs == typSeq(@[1, 2, 4, 7, 50, 1001, 1056])
+
+      doAssert w <= x
+
+      doAssert w < x
+
+      doAssert(not disjoint(w, x))
+
+      var u = initPackedSet[A]()
+      u.incl(A(3))
+      u.incl(A(5))
+      u.incl(A(500))
+      doAssert disjoint(u, x)
+
+      var v = initPackedSet[A]()
+      v.incl(A(2))
+      v.incl(A(50))
+
+      x.excl(v)
+      xs = toSeq(items(x))
+      xs.sort(cmp[A])
+      doAssert xs == typSeq(@[1, 4, 7, 1001, 1056])
+
+      proc bug12366 =
+        var
+          x = initPackedSet[A]()
+          y = initPackedSet[A]()
+          n = 3584
+
+        for i in 0..n:
+          x.incl(A(i))
+          y.incl(A(i))
+
+        let z = symmetricDifference(x, y)
+        doAssert z.len == 0
+        doAssert $z == "{}"
+
+      bug12366()
+
+  var legacyInit = initIntSet()
+  genericTests(int, legacyInit)
+
+  var intGenericInit = initPackedSet[int]()
+  genericTests(int, intGenericInit)
+
+  var intDistinct = initPackedSet[Id]()
+  genericTests(Id, intDistinct)
diff --git a/tests/stdlib/trstgen.nim b/tests/stdlib/trstgen.nim
index 8fdbf3911..d35bc5821 100644
--- a/tests/stdlib/trstgen.nim
+++ b/tests/stdlib/trstgen.nim
@@ -153,3 +153,27 @@ suite "YAML syntax highlighting":
     assert a == """(( <a class="reference external" href="https://nim-lang.org/">Nim</a> ))"""
     assert b == """((<a class="reference external" href="https://nim-lang.org/">Nim</a>))"""
     assert c == """[<a class="reference external" href="https://nim-lang.org/">Nim</a>]"""
+
+  test "Markdown tables":
+    let input1 = """
+| A1 header    | A2 \| not fooled
+| :---         | ----:       |
+| C1           | C2 **bold** | ignored |
+| D1 `code \|` | D2          | also ignored
+| E1 \| text   |
+|              | F2 without pipe
+not in table"""
+    let output1 = rstToHtml(input1, {roSupportMarkdown}, defaultConfig())
+    assert output1 == """<table border="1" class="docutils"><tr><th>A1 header</th><th>A2 | not fooled</th></tr>
+<tr><td>C1</td><td>C2 <strong>bold</strong></td></tr>
+<tr><td>D1 <tt class="docutils literal"><span class="pre">code |</span></tt></td><td>D2</td></tr>
+<tr><td>E1 | text</td><td></td></tr>
+<tr><td></td><td>F2 without pipe</td></tr>
+</table><p>not in table</p>
+"""
+    let input2 = """
+| A1 header | A2 |
+| --- | --- |"""
+    let output2 = rstToHtml(input2, {roSupportMarkdown}, defaultConfig())
+    assert output2 == """<table border="1" class="docutils"><tr><th>A1 header</th><th>A2</th></tr>
+</table>"""
diff --git a/tests/stdlib/tsharedlist.nim b/tests/stdlib/tsharedlist.nim
new file mode 100644
index 000000000..a795be0f3
--- /dev/null
+++ b/tests/stdlib/tsharedlist.nim
@@ -0,0 +1,17 @@
+import sharedlist
+
+var
+  list: SharedList[int]
+  count: int
+
+init(list)
+
+for i in 1 .. 250:
+  list.add i
+
+for i in list:
+  inc count
+
+doAssert count == 250
+
+deinitSharedList(list)
diff --git a/tests/stdlib/tstring.nim b/tests/stdlib/tstring.nim
index 0a7bf0511..ff3d41b49 100644
--- a/tests/stdlib/tstring.nim
+++ b/tests/stdlib/tstring.nim
@@ -91,3 +91,10 @@ proc tester[T](x: T) =
 
 tester(1)
 
+# #14497 
+func reverse*(a: string): string =
+  result = a
+  for i in 0 ..< a.len div 2:
+    swap(result[i], result[^(i + 1)])
+
+doAssert reverse("hello") == "olleh"
diff --git a/tests/stdlib/tterminal_15874.nim b/tests/stdlib/tterminal_15874.nim
new file mode 100644
index 000000000..c3455c350
--- /dev/null
+++ b/tests/stdlib/tterminal_15874.nim
@@ -0,0 +1,8 @@
+discard """
+  cmd: "nim c --app:console $file"
+  action: "compile"
+"""
+
+import terminal
+
+writeStyled("hello", {styleBright})
diff --git a/tests/test_nimscript.nims b/tests/test_nimscript.nims
index b94146b1e..ea640cac6 100644
--- a/tests/test_nimscript.nims
+++ b/tests/test_nimscript.nims
@@ -81,3 +81,9 @@ block: # #14142
   discard dirExists("/usr")
   discard fileExists("/usr/foo")
   discard findExe("nim")
+
+block:
+  doAssertRaises(AssertionDefect): doAssert false
+  try: doAssert false
+  except Exception as e:
+    discard
diff --git a/tests/types/t14127_cast_number.nim b/tests/types/t14127_cast_number.nim
new file mode 100644
index 000000000..4bb23f22f
--- /dev/null
+++ b/tests/types/t14127_cast_number.nim
@@ -0,0 +1,30 @@
+discard """
+  targets: "c cpp js"
+"""
+block: # bug #14127
+  template int2uint(T) =
+    var a = -1
+    let b = cast[T](a)
+    doAssert b < 0
+    let c = b + 1
+    doAssert c is T
+    doAssert c == 0
+
+  int2uint(int8)
+  int2uint(int16)
+  int2uint(int32)
+  int2uint(int64)
+
+block: # maybe related
+  template uint2int(T) =
+    var a = 3
+    let b = cast[T](a)
+    doAssert b > 0
+    let c = b - 1
+    doAssert c is T
+    doAssert c == 2
+
+  uint2int(uint8)
+  uint2int(uint16)
+  uint2int(uint32)
+  uint2int(uint64)
diff --git a/tests/types/tisopr.nim b/tests/types/tisopr.nim
index 1bbd0da94..67f1ce0c1 100644
--- a/tests/types/tisopr.nim
+++ b/tests/types/tisopr.nim
@@ -109,3 +109,29 @@ block:
   doAssert Foo2[int,float|int] is Foo
   doAssert Foo2[int,float|int] isnot Bar
   doAssert int is (int|float)
+
+
+block:
+  # Slice[T] as static type issue
+  type
+    MyEnum = enum
+      x1, x2, x3, x4, x5, x6
+
+  proc enumGen[T: enum](s: static[Slice[T]]) = 
+    doAssert($s.a & "  " & $s.b == "x1  x3")
+
+  enumGen(x1..x3)
+
+block:
+  # issue #11142
+  type
+    MyObjParam[N: static int] = object
+      x: int
+
+    MyObj[P: static MyObjParam] = object
+      y: int
+
+  const P = MyObjParam[256](x: 2)
+  let Q = MyObj[P](y: 2)
+  doAssert($Q  == "(y: 2)")
+
diff --git a/tests/varres/tvarres0.nim b/tests/varres/tvarres0.nim
index 0f89c7e71..94bdb4a06 100644
--- a/tests/varres/tvarres0.nim
+++ b/tests/varres/tvarres0.nim
@@ -4,6 +4,7 @@ discard """
 123
 1234
 12345
+123456
 '''
 """
 
@@ -28,6 +29,8 @@ getF().a = 1234
 echo getF().a
 getF() = Foo(a: 12345)
 echo getF().a
+(addr getF())[] = Foo(a: 123456)
+echo getF().a
 
 
 block: # #13848
diff --git a/tests/vm/t11637.nim b/tests/vm/t11637.nim
new file mode 100644
index 000000000..c061c6641
--- /dev/null
+++ b/tests/vm/t11637.nim
@@ -0,0 +1,52 @@
+type Foo = ref object
+  val: int
+
+proc `+`(a, b: Foo): Foo =
+  Foo(val: a.val + b.val)
+
+proc `*`(a: Foo, b: int): Foo =
+  Foo(val: a.val * b)
+
+proc `+=`(a: var Foo, b: Foo) =
+  a = Foo(
+    val: a.val + b.val
+  )
+
+proc foobar(a, b, c: Foo): tuple[bar, baz, buzz: Foo] =
+
+  let foo = a + b + c
+  result.bar = foo * 2
+
+  result.baz = foo * 3
+  result.buzz = result.baz
+
+  result.buzz += a * 10000
+  result.baz += b
+  result.buzz += b
+
+
+block: # Compile-Time
+  let
+    a {.compileTime.} = Foo(val: 1)
+    b {.compileTime.} = Foo(val: 2)
+    c {.compileTime.} = Foo(val: 3)
+    r {.compileTime.} = foobar(a, b, c)
+
+  static:
+    doAssert r.bar.val == 12
+    doAssert r.baz.val == 20
+    doAssert r.buzz.val == 10020
+
+####################################
+
+block: # Run-time
+  let
+    a = Foo(val: 1)
+    b = Foo(val: 2)
+    c = Foo(val: 3)
+    r = foobar(a, b, c)
+
+  # Expected values
+  doAssert r.bar.val == 12
+  doAssert r.baz.val == 20
+  doAssert r.buzz.val == 10020
diff --git a/tests/vm/tswap.nim b/tests/vm/tswap.nim
index 4243b5a71..bdbe5528c 100644
--- a/tests/vm/tswap.nim
+++ b/tests/vm/tswap.nim
@@ -3,7 +3,9 @@ nimout: '''
 x.data = @[10]
 y = @[11]
 x.data = @[11]
-y = @[10]'''
+y = @[10]
+@[3, 2, 1]
+'''
 """
 
 # bug #2946
@@ -22,3 +24,11 @@ proc testSwap(): int {.compiletime.} =
   result = 99
 
 const something = testSwap()
+
+# bug #15463
+block:
+  static:
+    var s = @[1, 2, 3]
+    swap(s[0], s[2])
+
+    echo s