summary refs log tree commit diff stats
path: root/tests/run
diff options
context:
space:
mode:
Diffstat (limited to 'tests/run')
-rw-r--r--tests/run/globalaux.nim15
-rw-r--r--tests/run/globalaux2.nim4
-rw-r--r--tests/run/mambsys1.nim7
-rw-r--r--tests/run/mambsys2.nim4
-rw-r--r--tests/run/mbind3.nim10
-rw-r--r--tests/run/mfriends.nim11
-rw-r--r--tests/run/minit.nim2
-rw-r--r--tests/run/mmultim3.nim12
-rw-r--r--tests/run/tack.nim21
-rw-r--r--tests/run/tactiontable.nim27
-rw-r--r--tests/run/tambsym2.nim24
-rw-r--r--tests/run/tambsys.nim13
-rw-r--r--tests/run/tanontuples.nim15
-rw-r--r--tests/run/tarray.nim33
-rw-r--r--tests/run/tarray2.nim36
-rw-r--r--tests/run/tarray3.nim13
-rw-r--r--tests/run/tarraycons.nim23
-rw-r--r--tests/run/tassert.nim23
-rw-r--r--tests/run/tastoverload1.nim21
-rw-r--r--tests/run/tasynciossl.nim91
-rw-r--r--tests/run/tasyncudp.nim78
-rw-r--r--tests/run/tbind1.nim21
-rw-r--r--tests/run/tbind3.nim11
-rw-r--r--tests/run/tbintre2.nim31
-rw-r--r--tests/run/tbintree.nim107
-rw-r--r--tests/run/tborrow.nim21
-rw-r--r--tests/run/tbug499771.nim14
-rw-r--r--tests/run/tbug511622.nim16
-rw-r--r--tests/run/tcase_setconstr.nim15
-rw-r--r--tests/run/tcasestm.nim40
-rw-r--r--tests/run/tcgbug.nim23
-rw-r--r--tests/run/tclosure.nim47
-rw-r--r--tests/run/tclosure2.nim101
-rw-r--r--tests/run/tclosure3.nim20
-rw-r--r--tests/run/tcnstseq.nim17
-rw-r--r--tests/run/tcnstseq2.nim12
-rw-r--r--tests/run/tcnstseq3.nim7
-rw-r--r--tests/run/tconcat.nim11
-rw-r--r--tests/run/tconstr2.nim26
-rw-r--r--tests/run/tcontinue.nim28
-rw-r--r--tests/run/tcontinuexc.nim30
-rw-r--r--tests/run/tcopy.nim25
-rw-r--r--tests/run/tcountup.nim14
-rw-r--r--tests/run/tcritbits.nim28
-rw-r--r--tests/run/tcurrncy.nim38
-rw-r--r--tests/run/tdestructor.nim84
-rw-r--r--tests/run/tdomulttest.nim17
-rw-r--r--tests/run/tdrdobbs_examples.nim134
-rw-r--r--tests/run/tdumptree.nim27
-rw-r--r--tests/run/temit.nim20
-rw-r--r--tests/run/tenumhole.nim25
-rw-r--r--tests/run/tenumitems.nim14
-rw-r--r--tests/run/teventemitter.nim33
-rw-r--r--tests/run/tevents.nim48
-rw-r--r--tests/run/texceptions.nim66
-rw-r--r--tests/run/texcpt1.nim30
-rw-r--r--tests/run/texcsub.nim17
-rw-r--r--tests/run/texplicitgeneric1.nim38
-rw-r--r--tests/run/texplicitgeneric2.nim35
-rw-r--r--tests/run/tfailedassert.nim51
-rw-r--r--tests/run/tfieldindex.nim21
-rw-r--r--tests/run/tfielditerator.nim46
-rw-r--r--tests/run/tfielditerator2.nim64
-rw-r--r--tests/run/tfilter.nim41
-rw-r--r--tests/run/tfinally.nim19
-rw-r--r--tests/run/tfinally2.nim30
-rw-r--r--tests/run/tfinally3.nim18
-rw-r--r--tests/run/tfinalobj.nim16
-rw-r--r--tests/run/tfloat1.nim15
-rw-r--r--tests/run/tfloat2.nim15
-rw-r--r--tests/run/tfloat3.nim24
-rw-r--r--tests/run/tformat.nim12
-rw-r--r--tests/run/tfriends.nim11
-rw-r--r--tests/run/tgenericassign.nim24
-rw-r--r--tests/run/tgenericassigntuples.nim16
-rw-r--r--tests/run/tgenericconverter.nim30
-rw-r--r--tests/run/tgenericprocvar.nim36
-rw-r--r--tests/run/tgenerics1.nim53
-rw-r--r--tests/run/tgensym.nim16
-rw-r--r--tests/run/tglobal.nim16
-rw-r--r--tests/run/thashes.nim8
-rw-r--r--tests/run/thexlit.nim12
-rw-r--r--tests/run/thintoff.nim12
-rw-r--r--tests/run/tidgen.nim19
-rw-r--r--tests/run/tindent1.nim42
-rw-r--r--tests/run/tinit.nim12
-rw-r--r--tests/run/tinterf.nim24
-rw-r--r--tests/run/tints.nim45
-rw-r--r--tests/run/tisopr.nim13
-rw-r--r--tests/run/titer3.nim22
-rw-r--r--tests/run/titer5.nim16
-rw-r--r--tests/run/titer6.nim37
-rw-r--r--tests/run/titer7.nim57
-rw-r--r--tests/run/titer8.nim117
-rw-r--r--tests/run/titer9.nim20
-rw-r--r--tests/run/titerslice.nim9
-rw-r--r--tests/run/titervaropenarray.nim16
-rw-r--r--tests/run/tkoeniglookup.nim17
-rw-r--r--tests/run/tlet.nim19
-rw-r--r--tests/run/tlists.nim66
-rw-r--r--tests/run/tlocals.nim11
-rw-r--r--tests/run/tlowhigh.nim24
-rw-r--r--tests/run/tmacro2.nim28
-rw-r--r--tests/run/tmacro3.nim31
-rw-r--r--tests/run/tmacro4.nim19
-rw-r--r--tests/run/tmacrogenerics.nim39
-rw-r--r--tests/run/tmacros1.nim31
-rw-r--r--tests/run/tmath.nim47
-rw-r--r--tests/run/tmatrix.nim48
-rw-r--r--tests/run/tmemoization.nim17
-rw-r--r--tests/run/tmethods1.nim22
-rw-r--r--tests/run/tmixin.nim27
-rw-r--r--tests/run/tmoditer.nim29
-rw-r--r--tests/run/tmultim1.nim29
-rw-r--r--tests/run/tmultim2.nim36
-rw-r--r--tests/run/tmultim3.nim20
-rw-r--r--tests/run/tmultim4.nim47
-rw-r--r--tests/run/tmultim6.nim30
-rw-r--r--tests/run/tnamedenumfields.nim23
-rw-r--r--tests/run/tnestif.nim24
-rw-r--r--tests/run/tnestprc.nim16
-rw-r--r--tests/run/tnewderef.nim11
-rw-r--r--tests/run/tnodeadlocks.nim70
-rw-r--r--tests/run/tobjasgn.nim39
-rw-r--r--tests/run/tobjconstr.nim41
-rw-r--r--tests/run/tobject.nim15
-rw-r--r--tests/run/tofopr.nim26
-rw-r--r--tests/run/tonraise.nim34
-rw-r--r--tests/run/toop1.nim89
-rw-r--r--tests/run/topenarrayrepr.nim17
-rw-r--r--tests/run/topenlen.nim18
-rw-r--r--tests/run/toprprec.nim39
-rw-r--r--tests/run/toverflw.nim21
-rw-r--r--tests/run/toverflw2.nim10
-rw-r--r--tests/run/toverl2.nim33
-rw-r--r--tests/run/toverl3.nim20
-rw-r--r--tests/run/toverwr.nim13
-rw-r--r--tests/run/tovfint.nim23
-rw-r--r--tests/run/tpatterns.nim17
-rw-r--r--tests/run/tpegs.nim1770
-rw-r--r--tests/run/tpos.nim35
-rw-r--r--tests/run/tprecedence.nim11
-rw-r--r--tests/run/tprintf.nim16
-rw-r--r--tests/run/tprocvar.nim32
-rw-r--r--tests/run/tquotewords.nim26
-rw-r--r--tests/run/tregex.nim31
-rw-r--r--tests/run/treguse.nim27
-rw-r--r--tests/run/trepr.nim29
-rw-r--r--tests/run/treraise.nim24
-rw-r--r--tests/run/trettypeinference.nim33
-rw-r--r--tests/run/tromans.nim71
-rw-r--r--tests/run/tsemistatic.nim24
-rw-r--r--tests/run/tseqcon.nim51
-rw-r--r--tests/run/tseqtuple.nim28
-rw-r--r--tests/run/tsequtils.nim55
-rw-r--r--tests/run/tsets.nim64
-rw-r--r--tests/run/tsets2.nim62
-rw-r--r--tests/run/tsidee2.nim17
-rw-r--r--tests/run/tsidee3.nim17
-rw-r--r--tests/run/tsimmeth.nim14
-rw-r--r--tests/run/tsimplesort.nim313
-rw-r--r--tests/run/tslices.nim59
-rw-r--r--tests/run/tsortdev.nim59
-rw-r--r--tests/run/tsplit.nim20
-rw-r--r--tests/run/tstaticparams.nim31
-rw-r--r--tests/run/tstempl.nim24
-rw-r--r--tests/run/tstmtexprs.nim71
-rw-r--r--tests/run/tstrange.nim23
-rw-r--r--tests/run/tstringinterp.nim74
-rw-r--r--tests/run/tstrlits.nim20
-rw-r--r--tests/run/tstrutil.nim45
-rw-r--r--tests/run/tsubrange.nim19
-rw-r--r--tests/run/tsubrange2.nim17
-rw-r--r--tests/run/ttables.nim129
-rw-r--r--tests/run/ttables2.nim21
-rw-r--r--tests/run/ttoseq.nim18
-rw-r--r--tests/run/ttypedesc1.nim42
-rw-r--r--tests/run/ttypetraits.nim59
-rw-r--r--tests/run/tunhandledexc.nim23
-rw-r--r--tests/run/tunidecode.nim12
-rw-r--r--tests/run/tunittests.nim1
-rw-r--r--tests/run/tuserassert.nim13
-rw-r--r--tests/run/tusertypeclasses.nim28
-rw-r--r--tests/run/tusingstatement.nim89
-rw-r--r--tests/run/tvarargs_vs_generic.nim26
-rw-r--r--tests/run/tvardecl.nim15
-rw-r--r--tests/run/tvariantasgn.nim30
-rw-r--r--tests/run/tvariantstack.nim52
-rw-r--r--tests/run/tvarious1.nim41
-rw-r--r--tests/run/tvarnums.nim142
-rw-r--r--tests/run/tvarres1.nim15
-rw-r--r--tests/run/tvarres2.nim20
-rw-r--r--tests/run/tvartup.nim17
-rw-r--r--tests/run/tvtable.nim74
-rw-r--r--tests/run/twrongexc.nim13
-rw-r--r--tests/run/txmlgen.nim12
-rw-r--r--tests/run/txmltree.nim13
-rw-r--r--tests/run/tzeroarray.nim18
-rw-r--r--tests/run/uclosures.nim12
-rw-r--r--tests/run/utemplates.nim32
-rw-r--r--tests/run/utypeclasses.nim13
201 files changed, 0 insertions, 8257 deletions
diff --git a/tests/run/globalaux.nim b/tests/run/globalaux.nim
deleted file mode 100644
index 5f6f72721..000000000
--- a/tests/run/globalaux.nim
+++ /dev/null
@@ -1,15 +0,0 @@
-type 
-  TObj*[T] = object
-    val*: T
-
-var
-  totalGlobals* = 0
-
-proc makeObj[T](x: T): TObj[T] =
-  totalGlobals += 1
-  result.val = x
-
-proc globalInstance*[T]: var TObj[T] =
-  var g {.global.} = when T is int: makeObj(10) else: makeObj("hello")
-  result = g
-
diff --git a/tests/run/globalaux2.nim b/tests/run/globalaux2.nim
deleted file mode 100644
index 6c77f1f48..000000000
--- a/tests/run/globalaux2.nim
+++ /dev/null
@@ -1,4 +0,0 @@
-import globalaux
-
-echo "in globalaux2: ", globalInstance[int]().val
-
diff --git a/tests/run/mambsys1.nim b/tests/run/mambsys1.nim
deleted file mode 100644
index 5472b5ae4..000000000
--- a/tests/run/mambsys1.nim
+++ /dev/null
@@ -1,7 +0,0 @@
-import mambsys2 # import TExport

-

-type

-  TExport* = enum x, y, z

-

-proc foo*(x: int) =

-  nil

diff --git a/tests/run/mambsys2.nim b/tests/run/mambsys2.nim
deleted file mode 100644
index 395425b86..000000000
--- a/tests/run/mambsys2.nim
+++ /dev/null
@@ -1,4 +0,0 @@
-type

-  TExport* = enum x, y, z # exactly the same type!

-

-proc foo*(x: int) = nil

diff --git a/tests/run/mbind3.nim b/tests/run/mbind3.nim
deleted file mode 100644
index d02bc79d0..000000000
--- a/tests/run/mbind3.nim
+++ /dev/null
@@ -1,10 +0,0 @@
-# Module A
-var 
-  lastId = 0
-
-template genId*: expr =
-  bind lastId
-  inc(lastId)
-  lastId
-
-
diff --git a/tests/run/mfriends.nim b/tests/run/mfriends.nim
deleted file mode 100644
index f1c663655..000000000
--- a/tests/run/mfriends.nim
+++ /dev/null
@@ -1,11 +0,0 @@
-
-type
-  TMyObj = object 
-    x: int
-    
-proc gen*[T](): T = 
-  var d: TMyObj
-  # access private field here
-  d.x = 3
-  result = d.x
-
diff --git a/tests/run/minit.nim b/tests/run/minit.nim
deleted file mode 100644
index 75fcebb77..000000000
--- a/tests/run/minit.nim
+++ /dev/null
@@ -1,2 +0,0 @@
-# Test the new initialization for modules

-write(stdout, "Hello from module! ")

diff --git a/tests/run/mmultim3.nim b/tests/run/mmultim3.nim
deleted file mode 100644
index 3139a8089..000000000
--- a/tests/run/mmultim3.nim
+++ /dev/null
@@ -1,12 +0,0 @@
-type
-    TObj* = object {.inheritable.}
-
-var myObj* : ref TObj
-
-method test123(a : ref TObj) =
-    echo("Hi base!")
-
-proc testMyObj*() =
-    test123(myObj)
-
-
diff --git a/tests/run/tack.nim b/tests/run/tack.nim
deleted file mode 100644
index 680ff567e..000000000
--- a/tests/run/tack.nim
+++ /dev/null
@@ -1,21 +0,0 @@
-discard """
-  file: "tack.nim"
-  output: "125"
-"""
-# the Ackermann function

-

-proc ack(x, y: int): int =

-  if x != 0:

-    if y != 0:

-      return ack(x-1, ack(x, y-1))

-    return ack(x-1, 1)

-  else:

-    return y + 1

-#  if x == 0: return y + 1

-#  elif y == 0: return ack(x-1, 1)

-#  else: return ack(x-1, ack(x, y-1))

-

-# echo(ack(0, 0))

-write(stdout, ack(3, 4)) #OUT 125

-
-
diff --git a/tests/run/tactiontable.nim b/tests/run/tactiontable.nim
deleted file mode 100644
index e2f19a099..000000000
--- a/tests/run/tactiontable.nim
+++ /dev/null
@@ -1,27 +0,0 @@
-discard """
-  output: "action 3 arg"
-"""
-
-import tables
-
-proc action1(arg: string) = 
-  echo "action 1 ", arg
-
-proc action2(arg: string) = 
-  echo "action 2 ", arg
-
-proc action3(arg: string) = 
-  echo "action 3 ", arg
-
-proc action4(arg: string) = 
-  echo "action 4 ", arg
-
-var
-  actionTable = {
-    "A": action1, 
-    "B": action2, 
-    "C": action3, 
-    "D": action4}.toTable
-
-actionTable["C"]("arg")
-
diff --git a/tests/run/tambsym2.nim b/tests/run/tambsym2.nim
deleted file mode 100644
index 745427c54..000000000
--- a/tests/run/tambsym2.nim
+++ /dev/null
@@ -1,24 +0,0 @@
-discard """
-  file: "tambsym2.nim"
-  output: "7"
-"""
-# Test overloading of procs with locals
-
-type
-  TMyType = object
-    len: int
-    data: string
-    
-proc len(x: TMyType): int {.inline.} = return x.len
-
-proc x(s: TMyType, len: int) = 
-  writeln(stdout, len(s))
-  
-var
-  m: TMyType
-m.len = 7
-m.data = "1234"
-
-x(m, 5) #OUT 7
-
-
diff --git a/tests/run/tambsys.nim b/tests/run/tambsys.nim
deleted file mode 100644
index 67522d7c9..000000000
--- a/tests/run/tambsys.nim
+++ /dev/null
@@ -1,13 +0,0 @@
-discard """
-  file: "tambsys.nim"
-  output: ""
-"""
-# Test ambiguous symbols
-
-import mambsys1, mambsys2
-
-var
-  v: mambsys1.TExport
-mambsys2.foo(3) #OUT
-
-
diff --git a/tests/run/tanontuples.nim b/tests/run/tanontuples.nim
deleted file mode 100644
index a2babf038..000000000
--- a/tests/run/tanontuples.nim
+++ /dev/null
@@ -1,15 +0,0 @@
-discard """
-  output: "61, 125"
-"""
-
-proc `^` (a, b: int): int =
-  result = 1
-  for i in 1..b: result = result * a
-
-var m = (0, 5)
-var n = (56, 3)
-
-m = (n[0] + m[1], m[1] ^ n[1])
-
-echo m[0], ", ", m[1]
-
diff --git a/tests/run/tarray.nim b/tests/run/tarray.nim
deleted file mode 100644
index 16ef558d1..000000000
--- a/tests/run/tarray.nim
+++ /dev/null
@@ -1,33 +0,0 @@
-discard """
-  file: "tarray.nim"
-  output: "10012"
-"""
-# simple check for one dimensional arrays

-

-type

-  TMyArray = array[0..2, int]

-  TMyRecord = tuple[x, y: int]

-

-proc sum(a: TMyarray): int =

-  result = 0

-  var i = 0

-  while i < len(a):

-    inc(result, a[i])

-    inc(i)

-

-proc sum(a: openarray[int]): int =

-  result = 0

-  var i = 0

-  while i < len(a):

-    inc(result, a[i])

-    inc(i)

-

-proc getPos(r: TMyRecord): int =

-  result = r.x + r.y

-

-write(stdout, sum([1, 2, 3, 4]))

-write(stdout, sum([]))

-write(stdout, getPos( (x: 5, y: 7) ))

-#OUT 10012

-
-
diff --git a/tests/run/tarray2.nim b/tests/run/tarray2.nim
deleted file mode 100644
index b6adabb45..000000000
--- a/tests/run/tarray2.nim
+++ /dev/null
@@ -1,36 +0,0 @@
-discard """
-  file: "tarray2.nim"
-  output: "[4, 5, 6]\n\n[16, 25, 36]\n\n[16, 25, 36]"
-"""
-# simple check for one dimensional arrays
-
-type
-  TMyArray = array[0..2, int]
-
-  TObj = object
-    arr: TMyarray
-  
-proc mul(a, b: TMyarray): TMyArray =
-  result = a
-  for i in 0..len(a)-1:
-    result[i] = a[i] * b[i]
-
-var
-  x, y: TMyArray
-  o: TObj
-
-proc varArr1(x: var TMyArray): var TMyArray = x
-proc varArr2(x: var TObj): var TMyArray = x.arr
-
-x = [ 4, 5, 6 ]
-echo repr(varArr1(x))
-
-y = x
-echo repr(mul(x, y))
-
-o.arr = mul(x, y)
-echo repr(varArr2(o))
-
-#OUT [16, 25, 36]
-
-
diff --git a/tests/run/tarray3.nim b/tests/run/tarray3.nim
deleted file mode 100644
index d28778357..000000000
--- a/tests/run/tarray3.nim
+++ /dev/null
@@ -1,13 +0,0 @@
-discard """
-  file: "tarray3.nim"
-  output: "3"
-"""
-# simple check for two dimensional arrays

-
-const  
-  myData = [[1,2,3], [4, 5, 6]]
-
-echo myData[0][2] #OUT 3
-
-
-
diff --git a/tests/run/tarraycons.nim b/tests/run/tarraycons.nim
deleted file mode 100644
index 0b2a42c2f..000000000
--- a/tests/run/tarraycons.nim
+++ /dev/null
@@ -1,23 +0,0 @@
-discard """
-  file: "tarraycons.nim"
-  output: "6"
-"""
-
-type
-  TEnum = enum
-    eA, eB, eC, eD, eE, eF
-    
-const
-  myMapping: array[TEnum, array[0..1, int]] = [
-    eA: [1, 2],
-    eB: [3, 4],
-    [5, 6],
-    eD: [0: 8, 1: 9],
-    eE: [0: 8, 9],
-    eF: [2, 1: 9]
-  ]
-
-echo myMapping[eC][1]
-
-
-
diff --git a/tests/run/tassert.nim b/tests/run/tassert.nim
deleted file mode 100644
index 0ea8d2034..000000000
--- a/tests/run/tassert.nim
+++ /dev/null
@@ -1,23 +0,0 @@
-discard """
-  file: "tassert.nim"
-  outputsub: "assertion failure!this shall be always written"
-  exitcode: "1"
-"""
-# test assert and exception handling
-
-proc callB() = assert(False)
-proc callA() = callB()
-proc callC() = callA()
-
-try:
-  callC()
-except EAssertionFailed:
-  write(stdout, "assertion failure!")
-except:
-  write(stdout, "unknown exception!")
-finally:
-  system.write(stdout, "this shall be always written")
-
-assert(false) #OUT assertion failure!this shall be always written
-
-
diff --git a/tests/run/tastoverload1.nim b/tests/run/tastoverload1.nim
deleted file mode 100644
index c8705547a..000000000
--- a/tests/run/tastoverload1.nim
+++ /dev/null
@@ -1,21 +0,0 @@
-discard """
-  output: '''string literal
-no string literal
-no string literal'''
-"""
-
-proc optLit(a: string{lit}) =
-  echo "string literal"
-
-proc optLit(a: string) =
-  echo "no string literal"
-
-const
-  constant = "abc"
-
-var
-  variable = "xyz"
-
-optLit("literal")
-optLit(constant)
-optLit(variable)
diff --git a/tests/run/tasynciossl.nim b/tests/run/tasynciossl.nim
deleted file mode 100644
index fbed46efb..000000000
--- a/tests/run/tasynciossl.nim
+++ /dev/null
@@ -1,91 +0,0 @@
-discard """
-  file: "tasynciossl.nim"
-  cmd: "nimrod cc --hints:on --define:ssl $# $#"
-  output: "20000"
-"""
-import sockets, asyncio, strutils, times
-
-var disp = newDispatcher()
-var msgCount = 0
-
-when defined(ssl):
-  var ctx = newContext(verifyMode = CVerifyNone, 
-      certFile = "tests/testdata/mycert.pem", keyFile = "tests/testdata/mycert.pem")
-
-  var ctx1 = newContext(verifyMode = CVerifyNone)
-
-const 
-  swarmSize = 50
-  messagesToSend = 100
-
-proc swarmConnect(s: PAsyncSocket) =
-  #echo("Connected")
-  for i in 1..messagesToSend:
-    s.send("Message " & $i & "\c\L")
-  s.close()
-
-proc serverRead(s: PAsyncSocket) =
-  var line = ""
-  assert s.readLine(line)
-  if line != "":
-    #echo(line)
-    if line.startsWith("Message "):
-      msgCount.inc()
-    else:
-      assert(false)
-  else:
-    s.close()
-
-proc serverAccept(s: PAsyncSocket) =
-  var client: PAsyncSocket
-  new(client)
-  s.accept(client)
-  client.handleRead = serverRead
-  disp.register(client)
-
-proc launchSwarm(disp: var PDispatcher, port: TPort, count: int,
-                 buffered = true, useSSL = false) =
-  for i in 1..count:
-    var client = AsyncSocket()
-    when defined(ssl):
-      if useSSL:
-        ctx1.wrapSocket(client)
-    client.handleConnect = swarmConnect
-    disp.register(client)
-    client.connect("localhost", port)
-
-proc createSwarm(port: TPort, buffered = true, useSSL = false) =
-  var server = AsyncSocket()
-  when defined(ssl):
-    if useSSL:
-      ctx.wrapSocket(server)
-  server.handleAccept = serverAccept
-  disp.register(server)
-  server.bindAddr(port)
-  server.listen()
-  disp.launchSwarm(port, swarmSize, buffered, useSSL)
-
-when defined(ssl):
-  const serverCount = 4
-else:
-  const serverCount = 2
-
-createSwarm(TPort(10235))
-createSwarm(TPort(10236), false)
-
-when defined(ssl):
-  createSwarm(TPort(10237), true, true)
-  createSwarm(TPort(10238), false, true)
-
-var startTime = epochTime()
-while true:
-  if epochTime() - startTime >= 300.0:
-    break
-  if not disp.poll(): break
-  if disp.len == serverCount:
-    # Only the servers are left in the dispatcher. All clients finished,
-    # we need to therefore break.
-    break
-
-assert msgCount == (swarmSize * messagesToSend) * serverCount
-echo(msgCount)
\ No newline at end of file
diff --git a/tests/run/tasyncudp.nim b/tests/run/tasyncudp.nim
deleted file mode 100644
index fd7f3d568..000000000
--- a/tests/run/tasyncudp.nim
+++ /dev/null
@@ -1,78 +0,0 @@
-discard """
-  file: "tasyncudp.nim"
-  output: "2000"
-"""
-import asyncio, sockets, strutils, times
-
-const
-  swarmSize = 5
-  messagesToSend = 200
-
-var
-  disp = newDispatcher()
-  msgCount = 0
-  currentClient = 0
-
-proc serverRead(s: PAsyncSocket) =
-  var data = ""
-  var address = ""
-  var port: TPort
-  if s.recvFromAsync(data, 9, address, port):
-    assert address == "127.0.0.1"
-    msgCount.inc()
-  
-  discard """
-  
-  var line = ""
-  assert s.recvLine(line)
-  
-  if line == "":
-    assert(false)
-  else:
-    if line.startsWith("Message "):
-      msgCount.inc()
-    else:
-      assert(false)
-  """
-
-proc swarmConnect(s: PAsyncSocket) =
-  for i in 1..messagesToSend:
-    s.send("Message\c\L")
-
-proc createClient(disp: var PDispatcher, port: TPort,
-                  buffered = true) =
-  currentClient.inc()
-  var client = AsyncSocket(typ = SOCK_DGRAM, protocol = IPPROTO_UDP,
-                           buffered = buffered)
-  client.handleConnect = swarmConnect
-  disp.register(client)
-  client.connect("localhost", port)
-
-proc createServer(port: TPort, buffered = true) =
-  var server = AsyncSocket(typ = SOCK_DGRAM, protocol = IPPROTO_UDP,
-                           buffered = buffered)
-  server.handleRead = serverRead
-  disp.register(server)
-  server.bindAddr(port)
-
-let serverCount = 2
-
-createServer(TPort(10335), false)
-createServer(TPort(10336), true)
-var startTime = epochTime()
-while true:
-  if epochTime() - startTime >= 300.0:
-    break
-
-  if not disp.poll():
-    break
-  
-  if (msgCount div messagesToSend) * serverCount == currentClient:
-    createClient(disp, TPort(10335), false)
-    createClient(disp, TPort(10336), true)
-  
-  if msgCount == messagesToSend * serverCount * swarmSize:
-    break
-
-assert msgCount == messagesToSend * serverCount * swarmSize
-echo(msgCount)
\ No newline at end of file
diff --git a/tests/run/tbind1.nim b/tests/run/tbind1.nim
deleted file mode 100644
index 6593b2307..000000000
--- a/tests/run/tbind1.nim
+++ /dev/null
@@ -1,21 +0,0 @@
-discard """
-  file: "tbind1.nim"
-  output: "3"
-"""
-# Test the new ``bind`` keyword for templates
-
-proc p1(x: int8, y: int): int = return x + y
-
-template tempBind(x, y: expr): expr = 
-  bind p1
-  p1(x, y) 
-
-proc p1(x: int, y: int8): int = return x - y
-
-# This is tricky: the call to ``p1(1'i8, 2'i8)`` should not fail in line 6, 
-# because it is not ambiguous there. But it is ambiguous after line 8. 
-
-echo tempBind(1'i8, 2'i8) #OUT 3
-
-
-
diff --git a/tests/run/tbind3.nim b/tests/run/tbind3.nim
deleted file mode 100644
index 551acc10f..000000000
--- a/tests/run/tbind3.nim
+++ /dev/null
@@ -1,11 +0,0 @@
-discard """
-  file: "tbind3.nim"
-  output: "1"
-"""
-# Module B
-import mbind3
-
-echo genId() #OUT 1
-
-
-
diff --git a/tests/run/tbintre2.nim b/tests/run/tbintre2.nim
deleted file mode 100644
index 2a7225411..000000000
--- a/tests/run/tbintre2.nim
+++ /dev/null
@@ -1,31 +0,0 @@
-discard """
-  file: "tbintre2.nim"
-  output: "helloworld99110223"
-"""
-# Same test, but check module boundaries
-
-import tbintree
-
-var
-  root: PBinaryTree[string]
-  x = newNode("hello")
-add(root, x)
-add(root, "world")
-if find(root, "world"):
-  for str in items(root):
-    stdout.write(str)
-else:
-  stdout.writeln("BUG")
-
-var
-  r2: PBinaryTree[int]
-add(r2, newNode(110))
-add(r2, 223)
-add(r2, 99)
-for y in items(r2):
-  stdout.write(y)
-
-#OUT helloworld99110223
-
-
-
diff --git a/tests/run/tbintree.nim b/tests/run/tbintree.nim
deleted file mode 100644
index 8cc8acb82..000000000
--- a/tests/run/tbintree.nim
+++ /dev/null
@@ -1,107 +0,0 @@
-discard """
-  file: "tbintree.nim"
-  output: "helloworld99110223"
-"""
-type
-  TBinaryTree[T] = object      # TBinaryTree is a generic type with
-                               # with generic param ``T``
-    le, ri: ref TBinaryTree[T] # left and right subtrees; may be nil
-    data: T                    # the data stored in a node
-  PBinaryTree*[A] = ref TBinaryTree[A] # type that is exported
-
-proc newNode*[T](data: T): PBinaryTree[T] =
-  # constructor for a node
-  new(result)
-  result.data = data
-
-proc add*[Ty](root: var PBinaryTree[Ty], n: PBinaryTree[Ty]) =
-  # insert a node into the tree
-  if root == nil:
-    root = n
-  else:
-    var it = root
-    while it != nil:
-      # compare the data items; uses the generic ``cmp`` proc that works for
-      # any type that has a ``==`` and ``<`` operator
-      var c = cmp(n.data, it.data)
-      if c < 0:
-        if it.le == nil:
-          it.le = n
-          return
-        it = it.le
-      else:
-        if it.ri == nil:
-          it.ri = n
-          return
-        it = it.ri
-
-proc add*[Ty](root: var PBinaryTree[Ty], data: Ty) =
-  # convenience proc:
-  add(root, newNode(data))
-
-proc find*[Ty2](b: PBinaryTree[Ty2], data: Ty2): bool =
-  # for testing this needs to be recursive, so that the
-  # instantiated type is checked for proper tyGenericInst envelopes
-  if b == nil:
-    result = false
-  else:
-    var c = cmp(data, b.data)
-    if c < 0: result = find(b.le, data)
-    elif c > 0: result = find(b.ri, data)
-    else: result = true
-
-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:
-  var stack: seq[PBinaryTree[T]] = @[root]
-  while stack.len > 0:
-    var n = stack.pop()
-    while n != nil:
-      yield n.data
-      add(stack, n.ri)  # push right subtree onto the stack
-      n = n.le          # and follow the left pointer
-
-iterator items*[T](root: PBinaryTree[T]): T =
-  ## Inorder traversal of the binary tree.
-  var stack: seq[PBinaryTree[T]] = @[]
-  var n = root
-  while true:
-    while n != nil:
-      add(stack, n)
-      n = n.le
-    if stack.len > 0:
-      n = stack.pop()
-      yield n.data
-      n = n.ri
-    if stack.len == 0 and n == nil: break
-
-proc debug[T](a: PBinaryTree[T]) =
-  if a != nil:
-    debug(a.le)
-    echo a.data
-    debug(a.ri)
-
-when isMainModule:
-  var
-    root: PBinaryTree[string]
-    x = newNode("hello")
-  add(root, x)
-  add(root, "world")
-  if find(root, "world"):
-    for str in items(root):
-      stdout.write(str)
-  else:
-    stdout.writeln("BUG")
-
-  var
-    r2: PBinaryTree[int]
-  add(r2, newNode(110))
-  add(r2, 223)
-  add(r2, 99)
-  for y in items(r2):
-    stdout.write(y)
-
-#OUT helloworld99110223
-
-
diff --git a/tests/run/tborrow.nim b/tests/run/tborrow.nim
deleted file mode 100644
index 8e6aeba74..000000000
--- a/tests/run/tborrow.nim
+++ /dev/null
@@ -1,21 +0,0 @@
-discard """
-  output: "4887 true"
-"""
-
-# test the new borrow feature that works with generics:
-
-proc `++`*[T: int | float](a, b: T): T =
-  result = a + b
-  
-type
-  DI = distinct int
-  DF = distinct float
-  DS = distinct string
-  
-proc `++`(x, y: DI): DI {.borrow.}
-proc `++`(x, y: DF): DF {.borrow.}
-
-proc `$`(x: DI): string {.borrow.}
-proc `$`(x: DF): string {.borrow.}
-
-echo  4544.DI ++ 343.di, " ", (4.5.df ++ 0.5.df).float == 5.0
diff --git a/tests/run/tbug499771.nim b/tests/run/tbug499771.nim
deleted file mode 100644
index 682148422..000000000
--- a/tests/run/tbug499771.nim
+++ /dev/null
@@ -1,14 +0,0 @@
-discard """
-  file: "tbug499771.nim"
-  output: '''TSubRange: 5 from 1 to 10
-true true true'''
-"""
-type 
-  TSubRange = range[1 .. 10]
-  TEnum = enum A, B, C
-var sr: TSubRange = 5
-echo("TSubRange: " & $sr & " from " & $low(TSubRange) & " to " & 
-     $high(TSubRange))
-
-const cset = {A} + {B}
-echo A in cset, " ", B in cset, " ", C notin cset
diff --git a/tests/run/tbug511622.nim b/tests/run/tbug511622.nim
deleted file mode 100644
index a5360423d..000000000
--- a/tests/run/tbug511622.nim
+++ /dev/null
@@ -1,16 +0,0 @@
-discard """
-  file: "tbug511622.nim"
-  output: "3"
-"""
-import StrUtils, Math
-
-proc FibonacciA(n: int): int64 =
-  var fn = float64(n)
-  var p: float64 = (1.0 + sqrt(5.0)) / 2.0
-  var q: float64 = 1.0 / p
-  return int64((pow(p, fn) + pow(q, fn)) / sqrt(5.0))
-
-echo FibonacciA(4) #OUT 3
-
-
-
diff --git a/tests/run/tcase_setconstr.nim b/tests/run/tcase_setconstr.nim
deleted file mode 100644
index 21f657c2b..000000000
--- a/tests/run/tcase_setconstr.nim
+++ /dev/null
@@ -1,15 +0,0 @@
-discard """
-  output: "an identifier"
-"""
-
-const
-  SymChars: set[char] = {'a'..'z', 'A'..'Z', '\x80'..'\xFF'}
-
-proc classify(s: string) =
-  case s[0]
-  of SymChars, '_': echo "an identifier"
-  of {'0'..'9'}: echo "a number"
-  else: echo "other"
-
-classify("Hurra")
-
diff --git a/tests/run/tcasestm.nim b/tests/run/tcasestm.nim
deleted file mode 100644
index 003ec6e50..000000000
--- a/tests/run/tcasestm.nim
+++ /dev/null
@@ -1,40 +0,0 @@
-discard """
-  file: "tcasestm.nim"
-  output: "ayyydd"
-"""
-# Test the case statement
-
-type
-  tenum = enum eA, eB, eC
-
-var
-  x: string = "yyy"
-  y: Tenum = eA
-  i: int
-
-case y
-of eA: write(stdout, "a")
-of eB, eC: write(stdout, "b or c")
-
-case x
-of "Andreas", "Rumpf": write(stdout, "Hallo Meister!")
-of "aa", "bb": write(stdout, "Du bist nicht mein Meister")
-of "cc", "hash", "when": nil
-of "will", "it", "finally", "be", "generated": nil
-
-var z = case i
-  of 1..5, 8, 9: "aa"
-  of 6, 7: "bb"
-  elif x == "Ha": 
-    "cc"
-  elif x == "yyy":
-    write(stdout, x)
-    "dd"
-  else:
-    "zz"
-
-echo z
-#OUT ayyy
-
-
-
diff --git a/tests/run/tcgbug.nim b/tests/run/tcgbug.nim
deleted file mode 100644
index 417b909ae..000000000
--- a/tests/run/tcgbug.nim
+++ /dev/null
@@ -1,23 +0,0 @@
-discard """
-  file: "tcgbug.nim"
-  output: "success"
-"""
-
-type
-  TObj = object
-    x, y: int
-  PObj = ref TObj
-
-proc p(a: PObj) =
-  a.x = 0
-
-proc q(a: var PObj) =
-  a.p()
-
-var 
-  a: PObj
-new(a)
-q(a)
-
-echo "success"
-
diff --git a/tests/run/tclosure.nim b/tests/run/tclosure.nim
deleted file mode 100644
index d9e7b8ee4..000000000
--- a/tests/run/tclosure.nim
+++ /dev/null
@@ -1,47 +0,0 @@
-discard """
-  file: "tclosure.nim"
-  output: "2 4 6 8 10"
-  disabled: true
-"""
-# Test the closure implementation
-
-proc map(n: var openarray[int], fn: proc (x: int): int {.closure}) =
-  for i in 0..n.len-1: n[i] = fn(n[i])
-
-proc foldr(n: openarray[int], fn: proc (x, y: int): int {.closure}): int =
-  for i in 0..n.len-1:
-    result = fn(result, n[i])
-
-proc each(n: openarray[int], fn: proc(x: int) {.closure.}) =
-  for i in 0..n.len-1:
-    fn(n[i])
-
-var
-  myData: array[0..4, int] = [0, 1, 2, 3, 4]
-
-proc testA() =
-  var p = 0
-  map(myData, proc (x: int): int =
-                result = x + 1 shl (proc (y: int): int =
-                  return y + p
-                )(0)
-                inc(p))
-
-testA()
-
-myData.each do (x: int):
-  write(stout, x)
-
-#OUT 2 4 6 8 10
-
-type
-  ITest = tuple[
-    setter: proc(v: Int),
-    getter: proc(): int]
-
-proc getInterf(): ITest =
-  var shared: int
-  
-  return (setter: proc (x) = shared = x,
-          getter: proc (): int = return shared)
-
diff --git a/tests/run/tclosure2.nim b/tests/run/tclosure2.nim
deleted file mode 100644
index d2c16eac9..000000000
--- a/tests/run/tclosure2.nim
+++ /dev/null
@@ -1,101 +0,0 @@
-discard """
-  output: '''0
-11
-1
-11
-2
-11
-3
-11
-4
-11
-5
-11
-6
-11
-7
-11
-8
-11
-9
-11
-11
-py
-py
-py
-py
-px
-6'''
-"""
-
-when true:
-  proc ax =
-    for xxxx in 0..9:
-      var i = 0
-      proc bx =
-        if i > 10: 
-          echo xxxx
-          return
-        i += 1
-        #for j in 0 .. 0: echo i
-        bx()
-      
-      bx()
-      echo i
-
-  ax()
-
-when true:
-  proc accumulator(start: int): (proc(): int {.closure.}) =
-    var x = start-1
-    #let dummy = proc =
-    #  discard start
-    
-    result = proc (): int = 
-      #var x = 9
-      for i in 0 .. 0: x = x + 1
-      
-      return x
-
-  var a = accumulator(3)
-  let b = accumulator(4)
-  echo a() + b() + a()
-
-
-  proc outer =
-
-    proc py() =
-      # no closure here:
-      for i in 0..3: echo "py"
-
-    py()
-    
-  outer()
-
-
-when true:
-  proc outer2 =
-    var errorValue = 3
-    proc fac[T](n: T): T =
-      if n < 0: result = errorValue
-      elif n <= 1: result = 1
-      else: result = n * fac(n-1)
-  
-    proc px() {.closure.} =
-      echo "px"
-
-    proc py() {.closure.} =
-      echo "py"
-
-    const
-      mapping = {
-        "abc": px,
-        "xyz": py
-      }
-    mapping[0][1]()
-    
-    echo fac(3)
-
-
-  outer2()
-
diff --git a/tests/run/tclosure3.nim b/tests/run/tclosure3.nim
deleted file mode 100644
index bb217387f..000000000
--- a/tests/run/tclosure3.nim
+++ /dev/null
@@ -1,20 +0,0 @@
-discard """
-  file: "tclosure3.nim"
-  output: "success"
-"""
-
-proc main =
-  const n = 30
-  for iterations in 0..50_000:
-    var s: seq[proc(): string {.closure.}] = @[]
-    for i in 0 .. n-1:
-      let ii = i
-      s.add(proc(): string = return $(ii*ii))
-    for i in 0 .. n-1:
-      let val = s[i]()
-      if val != $(i*i): echo "bug  ", val
-    
-    if getOccupiedMem() > 3000_000: quit("still a leak!")
-  echo "success"
-
-main()
diff --git a/tests/run/tcnstseq.nim b/tests/run/tcnstseq.nim
deleted file mode 100644
index e7d2333b4..000000000
--- a/tests/run/tcnstseq.nim
+++ /dev/null
@@ -1,17 +0,0 @@
-discard """
-  file: "tcnstseq.nim"
-  output: "AngelikaAnneAnnaAnkaAnja"
-"""
-# Test the new implicit conversion from sequences to arrays in a constant
-# context.
-
-import strutils
-
-const
-  myWords = "Angelika Anne Anna Anka Anja".split()
-  
-for x in items(myWords): 
-  write(stdout, x) #OUT AngelikaAnneAnnaAnkaAnja
-
-
-
diff --git a/tests/run/tcnstseq2.nim b/tests/run/tcnstseq2.nim
deleted file mode 100644
index 1a27b2ba7..000000000
--- a/tests/run/tcnstseq2.nim
+++ /dev/null
@@ -1,12 +0,0 @@
-discard """
-  output: "AngelikaAnneAnnaAnkaAnja"
-"""
-
-const
-  myWords = @["Angelika", "Anne", "Anna", "Anka", "Anja"]
-  
-for i in 0 .. high(myWords): 
-  write(stdout, myWords[i]) #OUT AngelikaAnneAnnaAnkaAnja
-
-
-
diff --git a/tests/run/tcnstseq3.nim b/tests/run/tcnstseq3.nim
deleted file mode 100644
index e59516e85..000000000
--- a/tests/run/tcnstseq3.nim
+++ /dev/null
@@ -1,7 +0,0 @@
-discard """
-  output: "AngelikaAnneAnnaAnkaAnja"
-"""
-
-for w in items(["Angelika", "Anne", "Anna", "Anka", "Anja"]):
-  write(stdout, w) #OUT AngelikaAnneAnnaAnkaAnja
-
diff --git a/tests/run/tconcat.nim b/tests/run/tconcat.nim
deleted file mode 100644
index fdce3ea00..000000000
--- a/tests/run/tconcat.nim
+++ /dev/null
@@ -1,11 +0,0 @@
-discard """
-  output: "DabcD"
-"""
-
-const
-  x = "abc"
-
-var v = "D" & x & "D"
-
-echo v
-
diff --git a/tests/run/tconstr2.nim b/tests/run/tconstr2.nim
deleted file mode 100644
index 30cec5cb8..000000000
--- a/tests/run/tconstr2.nim
+++ /dev/null
@@ -1,26 +0,0 @@
-discard """
-  file: "tconstr2.nim"
-  output: "69"
-"""
-# Test array, record constructors

-

-type

-  TComplexRecord = tuple[

-    s: string,

-    x, y: int,

-    z: float,

-    chars: set[char]]

-

-const

-  things: array [0..1, TComplexRecord] = [

-    (s: "hi", x: 69, y: 45, z: 0.0, chars: {'a', 'b', 'c'}),

-    (s: "hi", x: 69, y: 45, z: 1.0, chars: {})] 

-  otherThings = [  # the same

-    (s: "hi", x: 69, y: 45, z: 0.0, chars: {'a', 'b', 'c'}),

-    (s: "hi", x: 69, y: 45, z: 1.0, chars: {'a'})]

-

-write(stdout, things[0].x)

-#OUT 69

-

-
-
diff --git a/tests/run/tcontinue.nim b/tests/run/tcontinue.nim
deleted file mode 100644
index 092026e8c..000000000
--- a/tests/run/tcontinue.nim
+++ /dev/null
@@ -1,28 +0,0 @@
-discard """
-  output: "came here"
-"""
-
-var i = 0
-while i < 400:
-
-  if i == 10: break
-  elif i == 3: 
-    inc i
-    continue
-  inc i
-
-var f = "failure"
-var j = 0
-while j < 300:
-  for x in 0..34:
-    if j < 300: continue
-    if x == 10: 
-      echo "failure: should never happen"
-      break
-  f = "came here"
-  break
-
-if i == 10:
-  echo f
-else:
-  echo "failure"
diff --git a/tests/run/tcontinuexc.nim b/tests/run/tcontinuexc.nim
deleted file mode 100644
index f618abc14..000000000
--- a/tests/run/tcontinuexc.nim
+++ /dev/null
@@ -1,30 +0,0 @@
-discard """
-  file: "tcontinuexc.nim"
-  outputsub: "ECcaught"
-  exitcode: "1"
-"""
-type
-  ESomething = object of E_Base
-  ESomeOtherErr = object of E_Base
-
-proc genErrors(s: string) =
-  if s == "error!":
-    raise newException(ESomething, "Test")
-  else:
-    raise newException(EsomeotherErr, "bla")
-
-try:
-  for i in 0..3:
-    try:
-      genErrors("error!")
-    except ESomething:
-      stdout.write("E")
-    stdout.write("C")
-    raise newException(EsomeotherErr, "bla")
-finally:  
-  echo "caught"
-
-#OUT ECcaught
-
-
-
diff --git a/tests/run/tcopy.nim b/tests/run/tcopy.nim
deleted file mode 100644
index 5feb0d6b3..000000000
--- a/tests/run/tcopy.nim
+++ /dev/null
@@ -1,25 +0,0 @@
-discard """
-  file: "tcopy.nim"
-  output: "TEMP=C:\\Programs\\xyz\\bin"
-"""
-# tests the substr proc
-
-import
-  strutils
-
-proc main() =
-  const
-    example = r"TEMP=C:\Programs\xyz\bin"
-  var
-    a, b: string
-    p: int
-  p = find(example, "=")
-  a = substr(example, 0, p-1)
-  b = substr(example, p+1)
-  writeln(stdout, a & '=' & b)
-  #writeln(stdout, b)
-
-main()
-#OUT TEMP=C:\Programs\xyz\bin
-
-
diff --git a/tests/run/tcountup.nim b/tests/run/tcountup.nim
deleted file mode 100644
index e68a614b0..000000000
--- a/tests/run/tcountup.nim
+++ /dev/null
@@ -1,14 +0,0 @@
-discard """
-  file: "tcountup.nim"
-  output: "0123456789"
-"""
-
-# Test new countup and unary < 
-
-for i in 0 .. < 10'i64: 
-  stdout.write(i)
-  
-#OUT 0123456789
-
-
-
diff --git a/tests/run/tcritbits.nim b/tests/run/tcritbits.nim
deleted file mode 100644
index fb447b80b..000000000
--- a/tests/run/tcritbits.nim
+++ /dev/null
@@ -1,28 +0,0 @@
-discard """
-  output: '''abc
-def
-definition
-prefix
-xyz
-def
-definition'''
-"""
-
-import critbits
-
-when isMainModule:
-  var r: TCritBitTree[void]
-  r.incl "abc"
-  r.incl "xyz"
-  r.incl "def"
-  r.incl "definition"
-  r.incl "prefix"
-  doAssert r.contains"def"
-  #r.del "def"
-
-  for w in r.items:
-    echo w
-    
-  for w in r.itemsWithPrefix("de"):
-    echo w
-
diff --git a/tests/run/tcurrncy.nim b/tests/run/tcurrncy.nim
deleted file mode 100644
index 78dbc2a89..000000000
--- a/tests/run/tcurrncy.nim
+++ /dev/null
@@ -1,38 +0,0 @@
-discard """
-  file: "tcurrncy.nim"
-  output: "25"
-"""
-template Additive(typ: typeDesc): stmt =
-  proc `+` *(x, y: typ): typ {.borrow.}
-  proc `-` *(x, y: typ): typ {.borrow.}
-  
-  # unary operators:
-  proc `+` *(x: typ): typ {.borrow.}
-  proc `-` *(x: typ): typ {.borrow.}
-
-template Multiplicative(typ, base: typeDesc): stmt {.immediate.} =
-  proc `*` *(x: typ, y: base): typ {.borrow.}
-  proc `*` *(x: base, y: typ): typ {.borrow.}
-  proc `div` *(x: typ, y: base): typ {.borrow.}
-  proc `mod` *(x: typ, y: base): typ {.borrow.}
-
-template Comparable(typ: typeDesc): stmt =
-  proc `<` * (x, y: typ): bool {.borrow.}
-  proc `<=` * (x, y: typ): bool {.borrow.}
-  proc `==` * (x, y: typ): bool {.borrow.}
-
-template DefineCurrency(typ, base: expr): stmt {.immediate.} =
-  type
-    typ* = distinct base
-  Additive(typ)
-  Multiplicative(typ, base)
-  Comparable(typ)
-  
-  proc `$` * (t: typ): string {.borrow.}
-
-DefineCurrency(TDollar, int)
-DefineCurrency(TEuro, int)
-echo($( 12.TDollar + 13.TDollar )) #OUT 25
-
-
-
diff --git a/tests/run/tdestructor.nim b/tests/run/tdestructor.nim
deleted file mode 100644
index bb1410d92..000000000
--- a/tests/run/tdestructor.nim
+++ /dev/null
@@ -1,84 +0,0 @@
-discard """
-  output: '''----
-myobj constructed
-myobj destroyed
-----
-mygeneric1 constructed
-mygeneric1 destroyed
-----
-mygeneric2 constructed
-mygeneric2 destroyed
-myobj destroyed
-----
-mygeneric3 constructed
-mygeneric1 destroyed
-'''
-"""
-
-type
-  TMyObj = object
-    x, y: int
-    p: pointer
-
-  TMyGeneric1[T] = object
-    x: T
-
-  TMyGeneric2[A, B] = object
-    x: A
-    y: B
-
-  TMyGeneric3[A, B, C] = object
-    x: A
-    y: B
-    z: C
-
-proc destruct(o: var TMyObj) {.destructor.} =
-  if o.p != nil: dealloc o.p
-  echo "myobj destroyed"
-
-proc destroy(o: var TMyGeneric1) {.destructor.} =
-  echo "mygeneric1 destroyed"
-
-proc destroy[A, B](o: var TMyGeneric2[A, B]) {.destructor.} =
-  echo "mygeneric2 destroyed"
-
-proc open: TMyObj =
-  # allow for superfluous ()
-  result = (TMyObj(x: 1, y: 2, p: alloc(3)))
-
-proc `$`(x: TMyObj): string = $x.y
-
-proc myobj() =
-  var x = open()
-  echo "myobj constructed"
-
-proc mygeneric1() =
-  var x = TMyGeneric1[int](x: 10)
-  echo "mygeneric1 constructed"
-
-proc mygeneric2[T](val: T) =
-  var
-    a = open()
-    b = TMyGeneric2[int, T](x: 10, y: val)
-    c = TMyGeneric3[int, int, string](x: 10, y: 20, z: "test")
-
-  echo "mygeneric2 constructed"
-
-proc mygeneric3 =
-  var x = TMyGeneric3[int, string, TMyGeneric1[int]](
-    x: 10, y: "test", z: TMyGeneric1[int](x: 10))
-
-  echo "mygeneric3 constructed"
-
-echo "----"
-myobj()
-
-echo "----"
-mygeneric1()
-
-echo "----"
-mygeneric2[int](10)
-
-echo "----"
-mygeneric3()
-
diff --git a/tests/run/tdomulttest.nim b/tests/run/tdomulttest.nim
deleted file mode 100644
index 4ee6de128..000000000
--- a/tests/run/tdomulttest.nim
+++ /dev/null
@@ -1,17 +0,0 @@
-discard """
-  file: "tdomulttest.nim"
-  output: "555\ntest\nmulti lines\n99999999\nend"
-  disabled: true
-"""
-proc foo(bar, baz: proc (x: int): int) =
-  echo bar(555)
-  echo baz(99999999)
-
-foo do (x: int) -> int:
-  return x
-do (x: int) -> int:
-  echo("test")
-  echo("multi lines")
-  return x
-
-echo("end")
\ No newline at end of file
diff --git a/tests/run/tdrdobbs_examples.nim b/tests/run/tdrdobbs_examples.nim
deleted file mode 100644
index d1e0585d2..000000000
--- a/tests/run/tdrdobbs_examples.nim
+++ /dev/null
@@ -1,134 +0,0 @@
-discard """
-  output: '''108
-11 -1 1936
-4.000000000000002-e001
-true
-truefalse'''
-"""
-
-proc `++`(x: var int; y: int = 1; z: int = 0) =
-  x = x + y + z
-
-var g = 70
-++g
-g ++ 7
-g.`++`(10, 20)
-echo g 
-
-
-#let lv = stdin.readline
-#var vv = stdin.readline
-#vv = "abc" # valid, reassignment allowed
-#lv = "abc" # fails at compile time
-
-#proc square(x: int): int = x*x
-
-template square(x: int): int =
-  # ensure 'x' is only evaluated once:
-  let y = x
-  y * y
-
-proc mostSignificantBit(n: int): int =
-  # naive algorithm:
-  var n = n
-  while n != 0:
-    n = n shr 1
-    result += 1
-  result -= 1
-
-const msb3999 = mostSignificantBit(3999)
-
-echo msb3999, " ", mostSignificantBit(0), " ", square(44)
-
-proc filter[T](a: openarray[T], predicate: proc (x: T): bool): seq[T] =
-  result = @[] # @[] constructs the empty seq
-  for x in a:
-    if predicate(x): result.add(x)
-
-proc map[T, S](a: openarray[T], fn: proc (x: T): S): seq[S] =
-  newSeq(result, a.len)
-  for i in 0 .. <a.len: result[i] = fn(a[i])
-
-
-type
-  FormulaKind = enum
-    fkVar,        ## element is a variable like 'X'
-    fkLit,        ## element is a literal like 0.1
-    fkAdd,        ## element is an addition operation
-    fkMul,        ## element is a multiplication operation
-    fkExp         ## element is an exponentiation operation 
-
-type
-  Formula = ref object
-    case kind: FormulaKind
-    of fkVar: name: string
-    of fkLit: value: float
-    of fkAdd, fkMul, fkExp: left, right: Formula
-
-from math import pow
-
-proc evaluate(n: Formula, varToVal: proc (name: string): float): float =
-  case n.kind
-  of fkVar: varToVal(n.name)
-  of fkLit: n.value
-  of fkAdd: evaluate(n.left, varToVal) + evaluate(n.right, varToVal)
-  of fkMul: evaluate(n.left, varToVal) * evaluate(n.right, varToVal)
-  of fkExp: pow(evaluate(n.left, varToVal), evaluate(n.right, varToVal))
-
-echo evaluate(Formula(kind: fkLit, value: 0.4), nil)
-
-proc isPolyTerm(n: Formula): bool =
-  n.kind == fkMul and n.left.kind == fkLit and (let e = n.right; 
-    e.kind == fkExp and e.left.kind == fkVar and e.right.kind == fkLit)
-
-proc isPolynomial(n: Formula): bool =
-  isPolyTerm(n) or 
-    (n.kind == fkAdd and isPolynomial(n.left) and isPolynomial(n.right))
-
-let myFormula = Formula(kind: fkMul,
-                        left: Formula(kind: fkLit, value: 2.0),
-                        right: Formula(kind: fkExp, 
-                          left: Formula(kind: fkVar, name: "x"),
-                          right: Formula(kind: fkLit, value: 5.0)))
-
-echo isPolyTerm(myFormula)
-
-proc pat2kind(pattern: string): FormulaKind =
-  case pattern
-  of "^": fkExp
-  of "*": fkMul
-  of "+": fkAdd
-  of "x": fkVar
-  of "c": fkLit
-  else:   fkVar # no error reporting for reasons of simplicity
-
-import macros
-
-proc matchAgainst(n, pattern: PNimrodNode): PNimrodNode {.compileTime.} =
-  template `@`(current, field: expr): expr =
-    newDotExpr(current, newIdentNode(astToStr(field)))
-
-  template `==@`(n, pattern: expr): expr =
-    newCall("==", n@kind, newIdentNode($pat2kind($pattern.ident)))
-
-  case pattern.kind
-  of CallNodes:
-    result = newCall("and",
-      n ==@ pattern[0],
-      matchAgainst(n@left, pattern[1]))
-    if pattern.len == 3:
-      result = newCall("and", result.copy,
-        matchAgainst(n@right, pattern[2]))
-  of nnkIdent:
-    result = n ==@ pattern
-  of nnkPar:
-    result = matchAgainst(n, pattern[0])
-  else:
-    error "invalid pattern"
-
-macro `=~` (n: Formula, pattern: expr): bool =
-  result = matchAgainst(n, pattern)
-
-proc isPolyTerm2(n: Formula): bool = n =~ c * x^c
-
-echo isPolyTerm2(myFormula), isPolyTerm2(Formula(kind: fkLit, value: 0.7))
diff --git a/tests/run/tdumptree.nim b/tests/run/tdumptree.nim
deleted file mode 100644
index 5299a94e3..000000000
--- a/tests/run/tdumptree.nim
+++ /dev/null
@@ -1,27 +0,0 @@
-discard """
-disabled: true
-output: '''StmtList
-  VarSection
-    IdentDefs
-      Ident !"x"
-      nil
-      Call
-        DotExpr
-          Ident !"foo"
-          Ident !"create"
-        IntLit 56'''
-"""
-
-# disabled; can't work as the output is done by the compiler
-
-import macros
-
-#emit("type\n  TFoo = object\n    bar: int")
-
-#var f: TFoo
-#f.bar = 5
-#echo(f.bar)
-
-dumpTree:
-  var x = foo.create(56)
-
diff --git a/tests/run/temit.nim b/tests/run/temit.nim
deleted file mode 100644
index ff8df0585..000000000
--- a/tests/run/temit.nim
+++ /dev/null
@@ -1,20 +0,0 @@
-discard """
-  file: "temit.nim"
-  output: "509"
-"""
-# Test the new ``emit`` pragma: 
-
-{.emit: """
-static int cvariable = 420;
-
-""".}
-
-proc embedsC() = 
-  var nimrodVar = 89
-  {.emit: """printf("%d\n", cvariable + (int)`nimrodVar`);""".}
-
-embedsC()
-
-
-
-
diff --git a/tests/run/tenumhole.nim b/tests/run/tenumhole.nim
deleted file mode 100644
index a35526378..000000000
--- a/tests/run/tenumhole.nim
+++ /dev/null
@@ -1,25 +0,0 @@
-discard """
-  file: "tenumhole.nim"
-  output: "my value A1my value Bconc2valueCabc4abc"
-"""
-
-const
-  strValB = "my value B"
-
-type
-  TMyEnum = enum
-    valueA = (1, "my value A"),
-    valueB = strValB & "conc",
-    valueC,
-    valueD = (4, "abc")
- 
-# test the new "proc body can be an expr" feature:
-proc getValue: TMyEnum = valueD
- 
-# trick the optimizer with a variable:
-var x = getValue()
-echo valueA, ord(valueA), valueB, ord(valueB), valueC, valueD, ord(valueD), x
-
-
-
-
diff --git a/tests/run/tenumitems.nim b/tests/run/tenumitems.nim
deleted file mode 100644
index db4c6b554..000000000
--- a/tests/run/tenumitems.nim
+++ /dev/null
@@ -1,14 +0,0 @@
-discard """
-  output: "A\nB\nC"
-"""
-
-type TAlphabet = enum
-  A, B, C
-
-iterator items(E: typedesc[enum]): E =
-  for v in low(E)..high(E):
-    yield v
-
-for c in TAlphabet:
-  echo($c)
-
diff --git a/tests/run/teventemitter.nim b/tests/run/teventemitter.nim
deleted file mode 100644
index 9ecf72ea2..000000000
--- a/tests/run/teventemitter.nim
+++ /dev/null
@@ -1,33 +0,0 @@
-discard """
-  output: "pie"
-"""
-
-import tables, lists
-
-type
-  TEventArgs = object of TObject
-  TEventEmitter = object of TObject
-    events*: TTable[string, TDoublyLinkedList[proc(e: TEventArgs) {.nimcall.}]]
-
-proc emit*(emitter: TEventEmitter, event: string, args: TEventArgs) =
-  for func in nodes(emitter.events[event]):
-    func.value(args) #call function with args.
-
-proc on*(emitter: var TEventEmitter, event: string, 
-         func: proc(e: TEventArgs) {.nimcall.}) =
-  if not hasKey(emitter.events, event):
-    var list: TDoublyLinkedList[proc(e: TEventArgs) {.nimcall.}]
-    add(emitter.events, event, list) #if not, add it.
-  append(emitter.events.mget(event), func)
-
-proc initEmitter(emitter: var TEventEmitter) =
-  emitter.events = initTable[string, 
-    TDoublyLinkedList[proc(e: TEventArgs) {.nimcall.}]]()
-
-var 
-  ee: TEventEmitter
-  args: TEventArgs
-initEmitter(ee)
-ee.on("print", proc(e: TEventArgs) = echo("pie"))
-ee.emit("print", args)
-
diff --git a/tests/run/tevents.nim b/tests/run/tevents.nim
deleted file mode 100644
index fb94b1f79..000000000
--- a/tests/run/tevents.nim
+++ /dev/null
@@ -1,48 +0,0 @@
-discard """
-file: "tevents.nim"
-output: '''HandlePrintEvent: Output -> Handled print event
-HandlePrintEvent2: Output -> printing for ME
-HandlePrintEvent2: Output -> printing for ME'''
-"""
-
-import events
-
-type
-  TPrintEventArgs = object of TEventArgs
-    user*: string
-
-proc handleprintevent*(e: TEventArgs) =
-    write(stdout, "HandlePrintEvent: Output -> Handled print event\n")
-        
-proc handleprintevent2*(e: TEventArgs) =
-    var args: TPrintEventArgs = TPrintEventArgs(e)
-    write(stdout, "HandlePrintEvent2: Output -> printing for " & args.user)
-    
-var ee = initEventEmitter()
-
-var eventargs: TPrintEventArgs
-eventargs.user = "ME\n"
-
-##method one test
-
-ee.on("print", handleprintevent)
-ee.on("print", handleprintevent2)
-
-ee.emit("print", eventargs)
-
-##method two test
-
-type
-  TSomeObject = object of TObject
-    PrintEvent: TEventHandler
-
-var obj: TSomeObject
-obj.PrintEvent = initEventHandler("print")
-obj.PrintEvent.addHandler(handleprintevent2)
-
-ee.emit(obj.PrintEvent, eventargs)
-
-obj.PrintEvent.removeHandler(handleprintevent2)
-
-ee.emit(obj.PrintEvent, eventargs)
-
diff --git a/tests/run/texceptions.nim b/tests/run/texceptions.nim
deleted file mode 100644
index 69b2d0f6a..000000000
--- a/tests/run/texceptions.nim
+++ /dev/null
@@ -1,66 +0,0 @@
-discard """
-  output: '''
-BEFORE
-FINALLY
-
-BEFORE
-EXCEPT
-FINALLY
-RECOVER
-
-BEFORE
-EXCEPT
-FINALLY
-'''
-"""
-
-echo ""
-
-proc no_expcetion =
-  try:
-    echo "BEFORE"
-
-  except:
-    echo "EXCEPT"
-    raise
-
-  finally:
-    echo "FINALLY"
-
-try: no_expcetion()
-except: echo "RECOVER"
-
-echo ""
-
-proc reraise_in_except =
-  try:
-    echo "BEFORE"
-    raise newException(EIO, "")
-
-  except EIO:
-    echo "EXCEPT"
-    raise
-
-  finally:
-    echo "FINALLY"
-
-try: reraise_in_except()
-except: echo "RECOVER"
-
-echo ""
-
-proc return_in_except =
-  try:
-    echo "BEFORE"
-    raise newException(EIO, "")
-
-  except:
-    echo "EXCEPT"
-    return
-
-  finally:
-    echo "FINALLY"
-
-try: return_in_except()
-except: echo "RECOVER"
-
diff --git a/tests/run/texcpt1.nim b/tests/run/texcpt1.nim
deleted file mode 100644
index ec74c9470..000000000
--- a/tests/run/texcpt1.nim
+++ /dev/null
@@ -1,30 +0,0 @@
-discard """
-  outputsub: "-6"
-"""
-type
-  ESomething = object of E_Base
-  ESomeOtherErr = object of E_Base
-
-proc genErrors(s: string) =
-  if s == "error!":
-    raise newException(ESomething, "Test")
-  else:
-    raise newException(EsomeotherErr, "bla")
-
-proc raiseBla(): int =
-  try:
-    genErrors("errssor!")
-  except ESomething:
-    echo("Error happened")
-  except:
-    raise
-
-proc blah(): int =
-  try:
-    result = raiseBla()
-  except ESomeOtherErr:
-    result = -6
-
-echo blah()
-
-
diff --git a/tests/run/texcsub.nim b/tests/run/texcsub.nim
deleted file mode 100644
index 3dba357f9..000000000
--- a/tests/run/texcsub.nim
+++ /dev/null
@@ -1,17 +0,0 @@
-discard """
-  file: "texcsub.nim"
-  output: "caught!"
-"""
-# Test inheritance for exception matching:
-
-try:
-  raise newException(EOS, "dummy message")
-except E_Base:
-  echo "caught!"
-except: 
-  echo "wtf!?"
-  
-#OUT caught!
-
-
-
diff --git a/tests/run/texplicitgeneric1.nim b/tests/run/texplicitgeneric1.nim
deleted file mode 100644
index 6cca71ac0..000000000
--- a/tests/run/texplicitgeneric1.nim
+++ /dev/null
@@ -1,38 +0,0 @@
-discard """
-  file: "texplicitgeneric1.nim"
-  output: "Key: 12 value: 12Key: 13 value: 13 Key: A value: 12 Key: B value: 13"
-"""
-# test explicit type instantiation
-
-type
-  TDict*[TKey, TValue] = object 
-    data: seq[tuple[k: TKey, v: TValue]]
-  PDict*[TKey, #with `==`(a, b: TKey): bool
-               #     hash(a: TKey): int, 
-         TValue] = ref TDict[TKey, TValue]
-  
-proc newDict*[TKey, TValue](): PDict[TKey, TValue] = 
-  new(result)
-  result.data = @[]
-  
-proc add*[TKey, TValue](d: PDict[TKey, TValue], k: TKey, v: TValue) = 
-  d.data.add((k, v))
-  
-iterator items*[Tkey, tValue](d: PDict[TKey, TValue]): tuple[k: TKey, 
-               v: TValue] = 
-  for k, v in items(d.data): yield (k, v)
-    
-var d = newDict[int, string]()
-d.add(12, "12")
-d.add(13, "13")
-for k, v in items(d): 
-  stdout.write("Key: ", $k, " value: ", v)
-
-var c = newDict[char, string]()
-c.add('A', "12")
-c.add('B', "13")
-for k, v in items(c): 
-  stdout.write(" Key: ", $k, " value: ", v)
-
-
-
diff --git a/tests/run/texplicitgeneric2.nim b/tests/run/texplicitgeneric2.nim
deleted file mode 100644
index 95461d023..000000000
--- a/tests/run/texplicitgeneric2.nim
+++ /dev/null
@@ -1,35 +0,0 @@
-discard """
-  output: "Key: 12 value: 12Key: 13 value: 13 Key: A value: 12 Key: B value: 13"
-  disabled: true
-"""
-
-# test explicit type instantiation
-
-type
-  TDict*[TKey, TValue] = object 
-    data: seq[tuple[k: TKey, v: TValue]]
-  PDict*[TKey, TValue] = ref TDict[TKey, TValue]
-  
-proc newDict*[TKey, TValue](): PDict[TKey, TValue] = 
-  new(result)
-  result.data = @[]
-  
-proc add*(d: PDict, k: TKey, v: TValue) = 
-  d.data.add((k, v))
-  
-
-#iterator items*(d: PDict): tuple[k: TKey, v: TValue] = 
-#  for k, v in items(d.data): yield (k, v)
-    
-var d = newDict[int, string]()
-d.add(12, "12")
-d.add(13, "13")
-for k, v in items(d): 
-  stdout.write("Key: ", $k, " value: ", v)
-
-var c = newDict[char, string]()
-c.add('A', "12")
-c.add('B', "13")
-for k, v in items(c): 
-  stdout.write(" Key: ", $k, " value: ", v)
-
diff --git a/tests/run/tfailedassert.nim b/tests/run/tfailedassert.nim
deleted file mode 100644
index d99e6dc60..000000000
--- a/tests/run/tfailedassert.nim
+++ /dev/null
@@ -1,51 +0,0 @@
-discard """
-  output: '''
-WARNING: false first asseertion from bar
-ERROR: false second assertion from bar
--1
-tests/run/tfailedassert.nim:27 false assertion from foo
-'''
-"""
-
-type
-  TLineInfo = tuple[filename: string, line: int]
-
-  TMyError = object of E_Base
-    lineinfo: TLineInfo
-
-  EMyError = ref TMyError
-
-# module-wide policy to change the failed assert
-# exception type in order to include a lineinfo
-onFailedAssert(msg):
-  var e = new(TMyError)
-  e.msg = msg
-  e.lineinfo = instantiationInfo(-2)
-  raise e
-
-proc foo =
-  assert(false, "assertion from foo")
-
-proc bar: int =
-  # local overrides that are active only
-  # in this proc
-  onFailedAssert(msg): echo "WARNING: " & msg
-    
-  assert(false, "first asseertion from bar")
-
-  onFailedAssert(msg):
-    echo "ERROR: " & msg
-    return -1
-
-  assert(false, "second assertion from bar")
-  return 10
-
-echo("")
-echo(bar())
-
-try:
-  foo()
-except:
-  let e = EMyError(getCurrentException())
-  echo e.lineinfo.filename, ":", e.lineinfo.line, " ", e.msg
-
diff --git a/tests/run/tfieldindex.nim b/tests/run/tfieldindex.nim
deleted file mode 100644
index f0674af54..000000000
--- a/tests/run/tfieldindex.nim
+++ /dev/null
@@ -1,21 +0,0 @@
-discard """
-  output: "1"
-"""
-
-type
-  TMyTuple = tuple[a, b: int]
-
-proc indexOf*(t: typedesc, name: string): int =
-  ## takes a tuple and looks for the field by name.
-  ## returs index of that field.
-  var
-    d: t
-    i = 0
-  for n, x in fieldPairs(d):
-    if n == name: return i
-    i.inc
-  raise newException(EInvalidValue, "No field " & name & " in type " & 
-    astToStr(t))
-
-echo TMyTuple.indexOf("b")
-
diff --git a/tests/run/tfielditerator.nim b/tests/run/tfielditerator.nim
deleted file mode 100644
index 2919aab41..000000000
--- a/tests/run/tfielditerator.nim
+++ /dev/null
@@ -1,46 +0,0 @@
-discard """
-  output: '''
-a char: true
-a char: false
-an int: 5
-an int: 6
-a string: abc
-false
-true
-true
-false
-true
-a: a
-b: b
-x: 5
-y: 6
-z: abc
-'''
-"""
-
-type
-  TMyTuple = tuple[a, b: char, x, y: int, z: string]
-
-proc p(x: char) = echo "a char: ", x <= 'a'
-proc p(x: int) = echo "an int: ", x
-proc p(x: string) = echo "a string: ", x
-
-var x: TMyTuple = ('a', 'b', 5, 6, "abc")
-var y: TMyTuple = ('A', 'b', 5, 9, "abc")
-
-for f in fields(x): 
-  p f
-
-for a, b in fields(x, y):
-  echo a == b
-
-for key, val in fieldPairs(x):
-  echo key, ": ", val
-
-assert x != y
-assert x == x
-assert(not (x < x))
-assert x <= x
-assert y < x
-assert y <= x
-
diff --git a/tests/run/tfielditerator2.nim b/tests/run/tfielditerator2.nim
deleted file mode 100644
index 76fa568f2..000000000
--- a/tests/run/tfielditerator2.nim
+++ /dev/null
@@ -1,64 +0,0 @@
-discard """
-  output: '''
-a char: true
-a char: false
-an int: 5
-an int: 6
-a string: abc
-false
-true
-true
-false
-true
-a: a
-b: b
-x: 5
-y: 6
-z: abc
-myDisc: enC
-c: Z
-enC
-Z
-'''
-"""
-
-type
-  TMyObj = object
-    a, b: char
-    x, y: int
-    z: string
-    
-  TEnum = enum enA, enB, enC
-  TMyCaseObj = object
-    case myDisc: TEnum
-    of enA: a: int
-    of enB: b: string
-    of enC: c: char
-
-proc p(x: char) = echo "a char: ", x <= 'a'
-proc p(x: int) = echo "an int: ", x
-proc p(x: string) = echo "a string: ", x
-
-proc myobj(a, b: char, x, y: int, z: string): TMyObj =
-  result.a = a; result.b = b; result.x = x; result.y = y; result.z = z
-
-var x = myobj('a', 'b', 5, 6, "abc")
-var y = myobj('A', 'b', 5, 9, "abc")
-
-for f in fields(x): 
-  p f
-
-for a, b in fields(x, y):
-  echo a == b
-
-for key, val in fieldPairs(x):
-  echo key, ": ", val
-
-var co: TMyCaseObj
-co.myDisc = enC
-co.c = 'Z'
-for key, val in fieldPairs(co):
-  echo key, ": ", val
-
-for val in fields(co):
-  echo val
diff --git a/tests/run/tfilter.nim b/tests/run/tfilter.nim
deleted file mode 100644
index 5846d0efb..000000000
--- a/tests/run/tfilter.nim
+++ /dev/null
@@ -1,41 +0,0 @@
-discard """
-  output: "02468101214161820\n15"
-"""
-
-proc filter[T](list: seq[T], f: proc (item: T): bool {.closure.}): seq[T] =
-  result = @[]
-  for i in items(list):
-    if f(i):
-      result.add(i)
-
-let nums = @[0, 1, 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]
-
-when true:
-  let nums2 = filter(nums,
-               (proc (item: int): bool =
-                 result = (item mod 2) == 0)
-               )
-
-proc outer =
-  # lets use a proper closure this time:
-  var modulo = 2
-  let nums2 = filter(nums,
-               (proc (item: int): bool = result = (item mod modulo) == 0)
-               )
-
-  for n in nums2: stdout.write(n)
-  stdout.write("\n")
-
-outer()
-
-import math
-proc compose[T](f1, f2: proc (x: T): T {.closure.}): proc (x: T): T {.closure.} =
-  result = (proc (x: T): T =
-             result = f1(f2(x)))
-
-
-proc add5(x: int): int = result = x + 5
-
-var test = compose(add5, add5)
-echo test(5)
-
diff --git a/tests/run/tfinally.nim b/tests/run/tfinally.nim
deleted file mode 100644
index 16fb3e7da..000000000
--- a/tests/run/tfinally.nim
+++ /dev/null
@@ -1,19 +0,0 @@
-discard """
-  file: "tfinally.nim"
-  output: "came\nhere\n3"
-"""
-# Test return in try statement:
-
-proc main: int = 
-  try:
-    try:
-      return 1
-    finally:
-      echo("came")
-      return 2
-  finally: 
-    echo("here")
-    return 3
-
-echo main() #OUT came here 3
-
diff --git a/tests/run/tfinally2.nim b/tests/run/tfinally2.nim
deleted file mode 100644
index e1e8d4c7e..000000000
--- a/tests/run/tfinally2.nim
+++ /dev/null
@@ -1,30 +0,0 @@
-discard """
-  file: "tfinally2.nim"
-  output: '''A
-B
-C
-D'''
-"""
-# Test break in try statement:
-
-proc main: int = 
-  try:
-    block AB:
-      try:
-        try:
-          break AB
-        finally:
-          echo("A")
-        echo("skipped")
-      finally: 
-        block B:
-          echo("B")
-      echo("skipped")
-    echo("C")
-  finally:
-    echo("D")
-    
-discard main() #OUT ABCD
-
-
-
diff --git a/tests/run/tfinally3.nim b/tests/run/tfinally3.nim
deleted file mode 100644
index e65661cd0..000000000
--- a/tests/run/tfinally3.nim
+++ /dev/null
@@ -1,18 +0,0 @@
-discard """
-  file: "tfinally3.nim"
-  output: "false"
-"""
-# Test break in try statement:
-
-proc main: bool = 
-  while true:
-    try:
-      return true
-    finally:
-      break
-  return false
-
-echo main() #OUT false
-
-
-
diff --git a/tests/run/tfinalobj.nim b/tests/run/tfinalobj.nim
deleted file mode 100644
index 1cd7fae28..000000000
--- a/tests/run/tfinalobj.nim
+++ /dev/null
@@ -1,16 +0,0 @@
-discard """
-  output: "abc"
-"""
-
-type
-  TA = object {.pure, final.} 
-    x: string
-    
-var
-  a: TA
-a.x = "abc"
-
-doAssert TA.sizeof == string.sizeof
-
-echo a.x
-
diff --git a/tests/run/tfloat1.nim b/tests/run/tfloat1.nim
deleted file mode 100644
index f290fdb57..000000000
--- a/tests/run/tfloat1.nim
+++ /dev/null
@@ -1,15 +0,0 @@
-discard """
-  file: "tfloat1.nim"
-  outputsub: "Error: unhandled exception: FPU operation caused an overflow [EFloatOverflow]"
-  exitcode: "1"
-"""
-# Test new floating point exceptions
-
-{.floatChecks: on.}
-
-var x = 0.8
-var y = 0.0
-
-echo x / y #OUT Error: unhandled exception: FPU operation caused an overflow [EFloatOverflow]
-
-
diff --git a/tests/run/tfloat2.nim b/tests/run/tfloat2.nim
deleted file mode 100644
index 51883674f..000000000
--- a/tests/run/tfloat2.nim
+++ /dev/null
@@ -1,15 +0,0 @@
-discard """
-  file: "tfloat2.nim"
-  outputsub: "Error: unhandled exception: FPU operation caused a NaN result [EFloatInvalidOp]"
-  exitcode: "1"
-"""
-# Test new floating point exceptions
-
-{.floatChecks: on.}
-
-var x = 0.0
-var y = 0.0
-
-echo x / y #OUT Error: unhandled exception: FPU operation caused a NaN result [EFloatInvalidOp]
-
-
diff --git a/tests/run/tfloat3.nim b/tests/run/tfloat3.nim
deleted file mode 100644
index 4382dd3ed..000000000
--- a/tests/run/tfloat3.nim
+++ /dev/null
@@ -1,24 +0,0 @@
-discard """
-  file: "tfloat3.nim"
-  output: "Nimrod    3.4368930843, 0.3299290698 C double: 3.4368930843, 0.3299290698"
-"""
-
-import math, strutils
-
-{.emit: """
-void printFloats(void) {
-    double y = 1.234567890123456789;
-    
-    printf("C double: %.10f, %.10f ", exp(y), cos(y));
-}
-""".}
-
-proc c_printf(frmt: CString) {.importc: "printf", header: "<stdio.h>", varargs.}
-proc printFloats {.importc, nodecl.}
-
-var x: float = 1.234567890123456789
-c_printf("Nimrod    %.10f, %.10f ", exp(x), cos(x))
-printFloats()
-
-
-
diff --git a/tests/run/tformat.nim b/tests/run/tformat.nim
deleted file mode 100644
index 92c0c16f5..000000000
--- a/tests/run/tformat.nim
+++ /dev/null
@@ -1,12 +0,0 @@
-discard """
-  file: "tformat.nim"
-  output: "Hi Andreas! How do you feel, Rumpf?"
-"""
-# Tests the new format proc (including the & and &= operators)

-

-import strutils

-

-echo("Hi $1! How do you feel, $2?\n" % ["Andreas", "Rumpf"])

-#OUT Hi Andreas! How do you feel, Rumpf?

-
-
diff --git a/tests/run/tfriends.nim b/tests/run/tfriends.nim
deleted file mode 100644
index 1e70d50a5..000000000
--- a/tests/run/tfriends.nim
+++ /dev/null
@@ -1,11 +0,0 @@
-discard """
-  output: "3"
-"""
-
-# Tests that a generic instantiation from a different module may access
-# private object fields:
-
-import mfriends
-
-echo gen[int]()
-
diff --git a/tests/run/tgenericassign.nim b/tests/run/tgenericassign.nim
deleted file mode 100644
index 654b0ab8f..000000000
--- a/tests/run/tgenericassign.nim
+++ /dev/null
@@ -1,24 +0,0 @@
-discard """
-  output: '''came here'''
-"""
-
-type
-  TAny* = object {.pure.}
-    value*: pointer
-    rawType: pointer
-    
-proc newAny(value, rawType: pointer): TAny =
-  result.value = value
-  result.rawType = rawType
-
-var name: cstring = "example"
-
-var ret: seq[tuple[name: string, a: TAny]] = @[]
-for i in 0..8000:
-  var tup = ($name, newAny(nil, nil))
-  assert(tup[0] == "example")
-  ret.add(tup)
-  assert(ret[ret.len()-1][0] == "example")
-
-echo "came here"
-
diff --git a/tests/run/tgenericassigntuples.nim b/tests/run/tgenericassigntuples.nim
deleted file mode 100644
index 6dd63a984..000000000
--- a/tests/run/tgenericassigntuples.nim
+++ /dev/null
@@ -1,16 +0,0 @@
-discard """
-  output: '''abc232'''
-"""
-
-var t, s: tuple[x: string, c: int]
-
-proc ugh: seq[tuple[x: string, c: int]] = 
-  result = @[("abc", 232)]
-
-t = ugh()[0]
-s = t
-s = ugh()[0]
-
-echo s[0], t[1]
-
-
diff --git a/tests/run/tgenericconverter.nim b/tests/run/tgenericconverter.nim
deleted file mode 100644
index e1c9f7c4c..000000000
--- a/tests/run/tgenericconverter.nim
+++ /dev/null
@@ -1,30 +0,0 @@
-discard """
-  output: '''666
-666'''
-"""
-
-# test the new generic converters:
-
-type
-  TFoo2[T] = object
-    x: T
-
-  TFoo[T] = object
-    data: array[0..100, T]
-
-converter toFoo[T](a: TFoo2[T]): TFoo[T] =
-  result.data[0] = a.x
-
-proc p(a: TFoo[int]) =
-  echo a.data[0]
-
-proc q[T](a: TFoo[T]) =
-  echo a.data[0]
-
-
-var
-  aa: TFoo2[int]
-aa.x = 666
-
-p aa
-q aa
diff --git a/tests/run/tgenericprocvar.nim b/tests/run/tgenericprocvar.nim
deleted file mode 100644
index 1eba81fec..000000000
--- a/tests/run/tgenericprocvar.nim
+++ /dev/null
@@ -1,36 +0,0 @@
-discard """
-  output: "0false12"
-"""
-
-# Test multiple generic instantiation of generic proc vars:
-
-proc threadProcWrapper[TMsg]() =
-  var x: TMsg
-  stdout.write($x)
-
-#var x = threadProcWrapper[int]
-#x()
-
-#var y = threadProcWrapper[bool]
-#y()
-
-threadProcWrapper[int]()
-threadProcWrapper[bool]()
-
-type
-  TFilterProc[T,D] = proc (item: T, env:D): bool {.nimcall.}
-
-proc filter[T,D](data: seq[T], env:D, pred: TFilterProc[T,D]): seq[T] =
-  result = @[]
-  for e in data:
-    if pred(e, env): result.add(e)
-
-proc predTest(item: int, value: int): Bool =
-  return item <= value
-
-proc test(data: seq[int], value: int): seq[int] =
-  return filter(data, value, predTest)
-
-for x in items(test(@[1,2,3], 2)):
-  stdout.write(x)
-
diff --git a/tests/run/tgenerics1.nim b/tests/run/tgenerics1.nim
deleted file mode 100644
index 5d20a864b..000000000
--- a/tests/run/tgenerics1.nim
+++ /dev/null
@@ -1,53 +0,0 @@
-discard """
-  output: "100 0"
-"""
-
-# A min-heap.
-type
-  TNode[T] = tuple[priority: int, data: T]
-
-  TBinHeap[T] = object
-    heap: seq[TNode[T]]
-    last: int
-  
-  PBinHeap[T] = ref TBinHeap[T]
-
-proc newBinHeap*[T](heap: var PBinHeap[T], size: int) =
-  new(heap)
-  heap.last = 0
-  newSeq(heap.heap, size)
-  #newSeq(heap.seq, size)
- 
-proc parent(elem: int): int {.inline.} =
-  return (elem-1) div 2
-
-proc siftUp[T](heap: PBinHeap[T], elem: int) =
-  var idx = elem
-  while idx != 0:
-    var p = parent(idx)
-    if heap.heap[idx].priority < heap.heap[p].priority:
-      swap(heap.heap[idx], heap.heap[p])
-      idx = p
-    else:
-      break
-
-proc add*[T](heap: PBinHeap[T], priority: int, data: T) =
-  var node: TNode[T]
-  node.priority = priority
-  node.data = data
-  heap.heap[heap.last] = node
-  siftUp(heap, heap.last)
-  inc(heap.last)
-
-proc print*[T](heap: PBinHeap[T]) =
-  for i in countup(0, heap.last):
-    stdout.write($heap.heap[i].data, " ")
-
-var
-  heap: PBinHeap[int]
-
-newBinHeap(heap, 256)
-add(heap, 1, 100)
-print(heap)
-
-
diff --git a/tests/run/tgensym.nim b/tests/run/tgensym.nim
deleted file mode 100644
index 3c85b0b83..000000000
--- a/tests/run/tgensym.nim
+++ /dev/null
@@ -1,16 +0,0 @@
-discard """
-  output: "123100"
-"""
-
-template hygienic(val: expr) =
-  var x = val
-  stdout.write x
-
-var x = 100
-
-hygienic 1
-hygienic 2
-hygienic 3
-
-echo x
-
diff --git a/tests/run/tglobal.nim b/tests/run/tglobal.nim
deleted file mode 100644
index 84c4510c1..000000000
--- a/tests/run/tglobal.nim
+++ /dev/null
@@ -1,16 +0,0 @@
-discard """
-  file: "toop1.nim"
-  output: "in globalaux2: 10\ntotal globals: 2\nint value: 100\nstring value: second"
-"""
-
-import globalaux, globalaux2
-
-echo "total globals: ", totalGlobals
-
-globalInstance[int]().val = 100
-echo "int value: ", globalInstance[int]().val
-
-globalInstance[string]().val = "first"
-globalInstance[string]().val = "second"
-echo "string value: ", globalInstance[string]().val
-
diff --git a/tests/run/thashes.nim b/tests/run/thashes.nim
deleted file mode 100644
index c442b43fb..000000000
--- a/tests/run/thashes.nim
+++ /dev/null
@@ -1,8 +0,0 @@
-import unittest
-import hashes
-
-suite "hashes":
-  suite "hashing":
-    test "0.0 and -0.0 should have the same hash value":
-      var dummy = 0.0
-      check hash(dummy) == hash(-dummy)
diff --git a/tests/run/thexlit.nim b/tests/run/thexlit.nim
deleted file mode 100644
index 04a530c9c..000000000
--- a/tests/run/thexlit.nim
+++ /dev/null
@@ -1,12 +0,0 @@
-discard """
-  file: "thexlit.nim"
-  output: "equal"
-"""
-
-var t=0x950412DE
-
-if t==0x950412DE:
-    echo "equal"
-else:
-    echo "not equal"
-    
diff --git a/tests/run/thintoff.nim b/tests/run/thintoff.nim
deleted file mode 100644
index 807ff44f3..000000000
--- a/tests/run/thintoff.nim
+++ /dev/null
@@ -1,12 +0,0 @@
-discard """
-  file: "thintoff.nim"
-  output: "0"
-"""
-
-{.hint[XDeclaredButNotUsed]: off.}
-var
-  x: int
-  
-echo x #OUT 0
-
-
diff --git a/tests/run/tidgen.nim b/tests/run/tidgen.nim
deleted file mode 100644
index 2fe9e0f82..000000000
--- a/tests/run/tidgen.nim
+++ /dev/null
@@ -1,19 +0,0 @@
-discard """
-  output: "3 4"
-"""
-
-import macros
-
-# Test compile-time state in same module
-
-var gid {.compileTime.} = 3
-
-macro genId(): expr =
-  result = newIntLitNode(gid)
-  inc gid
-
-proc Id1(): int {.compileTime.} = return genId()
-proc Id2(): int {.compileTime.} = return genId()
-
-echo Id1(), " ", Id2()
-
diff --git a/tests/run/tindent1.nim b/tests/run/tindent1.nim
deleted file mode 100644
index 78a303783..000000000
--- a/tests/run/tindent1.nim
+++ /dev/null
@@ -1,42 +0,0 @@
-discard """
-  output: '''Success'''
-"""
-
-const romanNumbers1 =
-    [
-    ("M", 1000), ("D", 500), ("C", 100),
-    ("L", 50), ("X", 10), ("V", 5), ("I", 1) ]
-
-const romanNumbers2 =
-    [
-    ("M", 1000), ("D", 500), ("C", 100),
-    ("L", 50), ("X", 10), ("V", 5), ("I", 1)
-    ]
-
-const romanNumbers3 =
-  [
-    ("M", 1000), ("D", 500), ("C", 100),
-    ("L", 50), ("X", 10), ("V", 5), ("I", 1)
-  ]
-
-const romanNumbers4 = [
-    ("M", 1000), ("D", 500), ("C", 100),
-    ("L", 50), ("X", 10), ("V", 5), ("I", 1)
-    ]
-
-
-proc main =
-  var j = 0
-  while j < 10:
-    inc(j);
-
-  if j == 5: doAssert false
-
-var j = 0
-while j < 10:
-  inc(j);
-
-if j == 5: doAssert false
-
-main()
-echo "Success"
diff --git a/tests/run/tinit.nim b/tests/run/tinit.nim
deleted file mode 100644
index 5c75567ec..000000000
--- a/tests/run/tinit.nim
+++ /dev/null
@@ -1,12 +0,0 @@
-discard """
-  file: "tinit.nim"
-  output: "Hello from module! Hello from main module!"
-"""
-# Test the new init section in modules

-

-import minit

-

-write(stdout, "Hello from main module!\n")

-#OUT Hello from module! Hello from main module!

-
-
diff --git a/tests/run/tinterf.nim b/tests/run/tinterf.nim
deleted file mode 100644
index 726fac9f6..000000000
--- a/tests/run/tinterf.nim
+++ /dev/null
@@ -1,24 +0,0 @@
-discard """
-  output: '''56 66'''
-"""
-
-type
-  ITest = tuple[
-    setter: proc(v: int) {.closure.},
-    getter1: proc(): int {.closure.},
-    getter2: proc(): int {.closure.}]
-
-proc getInterf(): ITest =
-  var shared1, shared2: int
-  
-  return (setter: proc (x: int) = 
-            shared1 = x
-            shared2 = x + 10,
-          getter1: proc (): int = result = shared1,
-          getter2: proc (): int = return shared2)
-
-var i = getInterf()
-i.setter(56)
-
-echo i.getter1(), " ", i.getter2()
-
diff --git a/tests/run/tints.nim b/tests/run/tints.nim
deleted file mode 100644
index fb2852af9..000000000
--- a/tests/run/tints.nim
+++ /dev/null
@@ -1,45 +0,0 @@
-discard """
-  file: "tints.nim"
-  output: "Success"
-"""
-# Test the different integer operations
-
-var testNumber = 0
-
-template test(opr, a, b, c: expr): stmt {.immediate.} =
-  # test the expression at compile and runtime
-  block:
-    const constExpr = opr(a, b)
-    when constExpr != c:
-      {.error: "Test failed " & $constExpr & " " & $c.}
-    inc(testNumber)
-    #Echo("Test: " & $testNumber)
-    var aa = a
-    var bb = b
-    var varExpr = opr(aa, bb)
-    assert(varExpr == c)
-
-test(`+`, 12'i8, -13'i16, -1'i16)
-test(`shl`, 0b11, 0b100, 0b110000)
-test(`shl`, 0b11'i32, 0b100'i64, 0b110000'i64)
-test(`shl`, 0b11'i32, 0b100'i32, 0b110000'i32)
-
-test(`or`, 0xf0f0'i16, 0x0d0d'i16, 0xfdfd'i16)
-test(`and`, 0xf0f0'i16, 0xfdfd'i16, 0xf0f0'i16)
-
-test(`shr`, 0xffffffffffffffff'i64, 0x4'i64, 0x0fffffffffffffff'i64)
-test(`shr`, 0xffff'i16, 0x4'i16, 0x0fff'i16)
-test(`shr`, 0xff'i8, 0x4'i8, 0x0f'i8)
-
-test(`shr`, 0xffffffff'i64, 0x4'i64, 0x0fffffff'i64)
-test(`shr`, 0xffffffff'i32, 0x4'i32, 0x0fffffff'i32)
-
-test(`shl`, 0xffffffffffffffff'i64, 0x4'i64, 0xfffffffffffffff0'i64)
-test(`shl`, 0xffff'i16, 0x4'i16, 0xfff0'i16)
-test(`shl`, 0xff'i8, 0x4'i8, 0xf0'i8)
-
-test(`shl`, 0xffffffff'i64, 0x4'i64, 0xffffffff0'i64)
-test(`shl`, 0xffffffff'i32, 0x4'i32, 0xfffffff0'i32)
-
-Echo("Success") #OUT Success
-
diff --git a/tests/run/tisopr.nim b/tests/run/tisopr.nim
deleted file mode 100644
index 6d3c51749..000000000
--- a/tests/run/tisopr.nim
+++ /dev/null
@@ -1,13 +0,0 @@
-discard """
-  output: "true true false yes"
-"""
-
-proc IsVoid[T](): string = 
-  when T is void:
-    result = "yes"
-  else:
-    result = "no"
-
-const x = int is int
-echo x, " ", float is float, " ", float is string, " ", IsVoid[void]()
-
diff --git a/tests/run/titer3.nim b/tests/run/titer3.nim
deleted file mode 100644
index ab95dd7bd..000000000
--- a/tests/run/titer3.nim
+++ /dev/null
@@ -1,22 +0,0 @@
-discard """
-  file: "titer3.nim"
-  output: "1231"
-"""
-
-iterator count1_3: int =
-  yield 1
-  yield 2
-  yield 3
-
-for x in count1_3():
-  write(stdout, $x)
-
-# yield inside an iterator, but not in a loop:
-iterator iter1(a: openArray[int]): int =
-  yield a[0]
-
-var x = [[1, 2, 3], [4, 5, 6]]
-for y in iter1(x[0]): write(stdout, $y)
-
-#OUT 1231
-
diff --git a/tests/run/titer5.nim b/tests/run/titer5.nim
deleted file mode 100644
index bbd50fcb1..000000000
--- a/tests/run/titer5.nim
+++ /dev/null
@@ -1,16 +0,0 @@
-discard """
-  file: "titer5.nim"
-  output: "abcxyz"
-"""
-# Test method call syntax for iterators:
-import strutils
-
-const lines = """abc  xyz"""
-
-for x in lines.split():
-  stdout.write(x)
-
-#OUT abcxyz
-
-
-
diff --git a/tests/run/titer6.nim b/tests/run/titer6.nim
deleted file mode 100644
index dceace0e0..000000000
--- a/tests/run/titer6.nim
+++ /dev/null
@@ -1,37 +0,0 @@
-discard """
-  file: "titer6.nim"
-  output: "000"
-"""
-# Test iterator with more than 1 yield statement
-
-import strutils
-
-iterator tokenize2(s: string, seps: set[char] = Whitespace): tuple[
-  token: string, isSep: bool] =
-  var i = 0
-  while i < s.len:
-    var j = i
-    if s[j] in seps:
-      while j < s.len and s[j] in seps: inc(j)
-      if j > i:
-        yield (substr(s, i, j-1), true)
-    else:
-      while j < s.len and s[j] notin seps: inc(j)
-      if j > i:
-        yield (substr(s, i, j-1), false)
-    i = j
-
-for word, isSep in tokenize2("ta da", whiteSpace):
-  var titer2TestVar = 0 
-  stdout.write(titer2TestVar)
-
-proc wordWrap2(s: string, maxLineWidth = 80, 
-               splitLongWords = true,
-               seps: set[char] = whitespace,
-               newLine = "\n"): string  = 
-  result = ""
-  for word, isSep in tokenize2(s, seps):
-    var w = 0 
-
-
-
diff --git a/tests/run/titer7.nim b/tests/run/titer7.nim
deleted file mode 100644
index d0337b7bd..000000000
--- a/tests/run/titer7.nim
+++ /dev/null
@@ -1,57 +0,0 @@
-discard """
-  output: '''--- evens
-2
-4
-6
-8
---- squares
-1
-4
-9
-16
-25
-36
-49
-64
-81
---- squares of evens, only
-4
-16
-36
-64'''
-"""
-
-iterator `/`[T](sequence: seq[T],
-                filter: proc(e:T):bool {.closure.}) : T =
-    for element in sequence:
-        if (filter(element)):
-            yield element
-
-iterator `>>`[I,O](sequence: seq[I],
-                   map: proc(e:I):O {.closure.}) : O =
-    for element in sequence:
-        yield map(element)
-
-iterator `/>>`[I,O](sequence: seq[I],
-                    filtermap:tuple[
-                        f:proc(e:I):bool {.closure.},
-                        m:proc(e:I):O {.closure.}]) : O =
-    for element in sequence:
-        if (filtermap.f(element)):
-            yield filtermap.m(element)
-
-proc isEven(x:int): bool {.closure.} = result =
-    (x and 1) == 0
-
-proc square(x:int): int {.closure.} = result =
-    x * x
-
-let list = @[1,2,3,4,5,6,7,8,9]
-
-echo ("--- evens")
-for item in list / isEven : echo(item)
-echo ("--- squares")
-for item in list >> square : echo(item)
-echo ("--- squares of evens, only")
-# next line doesn't compile. Generic types are not inferred
-for item in list />> (isEven, square) : echo(item)
diff --git a/tests/run/titer8.nim b/tests/run/titer8.nim
deleted file mode 100644
index af0e643f1..000000000
--- a/tests/run/titer8.nim
+++ /dev/null
@@ -1,117 +0,0 @@
-discard """
-  output: '''tada
-1
-2
-3
-ta da1 1
-1 2
-1 3
-2 1
-2 2
-2 3
-3 1
-3 2
-3 3
-0
-1
-2
-a1: A
-a2: A
-a1: B
-a2: B
-a1: C
-a2: C
-a1: D'''
-"""
-# Test first class iterator:
-
-import strutils
-
-iterator tokenize2(s: string, seps: set[char] = Whitespace): tuple[
-  token: string, isSep: bool] {.closure.} =
-  var i = 0
-  while i < s.len:
-    var j = i
-    if s[j] in seps:
-      while j < s.len and s[j] in seps: inc(j)
-      if j > i:
-        yield (substr(s, i, j-1), true)
-    else:
-      while j < s.len and s[j] notin seps: inc(j)
-      if j > i:
-        yield (substr(s, i, j-1), false)
-    i = j
-
-iterator count3(): int {.closure.} =
-  yield 1
-  yield 2
-  yield 3
-
-for word, isSep in tokenize2("ta da", whiteSpace):
-  if not isSep:
-    stdout.write(word)
-echo ""
-
-proc inProc() =
-  for c in count3():
-    echo c
-  
-  for word, isSep in tokenize2("ta da", whiteSpace):
-    stdout.write(word)
-
-  for c in count3():
-    for d in count3():
-      echo c, " ", d
-
-
-inProc()
-
-iterator count0(): int {.closure.} =
-  # note: doesn't require anything in its closure (except 'state')
-  yield 0
- 
-iterator count2(): int {.closure.} =
-  # note: requires 'x' in its closure
-  var x = 1
-  yield x
-  inc x
-  yield x
-
-# a first class iterator has the type 'proc {.closure.}', but maybe
-# it shouldn't:
-proc invoke(iter: iterator(): int {.closure.}) =
-  for x in iter(): echo x
-
-invoke(count0)
-invoke(count2)
-
-
-# simple tasking:
-type
-  TTask = iterator (ticker: int)
-
-iterator a1(ticker: int) {.closure.} =
-  echo "a1: A"
-  yield
-  echo "a1: B"
-  yield
-  echo "a1: C"
-  yield
-  echo "a1: D"
-
-iterator a2(ticker: int) {.closure.} =
-  echo "a2: A"
-  yield
-  echo "a2: B"
-  yield
-  echo "a2: C"
-
-proc runTasks(t: varargs[TTask]) =
-  var ticker = 0
-  while true:
-    let x = t[ticker mod t.len]
-    if finished(x): break
-    x(ticker)
-    inc ticker
-
-runTasks(a1, a2)
diff --git a/tests/run/titer9.nim b/tests/run/titer9.nim
deleted file mode 100644
index 99874e70a..000000000
--- a/tests/run/titer9.nim
+++ /dev/null
@@ -1,20 +0,0 @@
-discard """
-  output: '''5
-14
-0'''
-"""
-
-iterator count[T](x: T, skip: bool): int {.closure.} =
-  if skip: return x+10
-  else: yield x+1
-
-  if skip: return x+10
-  else: yield x+2
-
-proc takeProc[T](x: iterator (x: T, skip: bool): int) =
-  echo x(4, false)
-  echo x(4, true)
-  echo x(4, false)
-
-takeProc(count[int])
-
diff --git a/tests/run/titerslice.nim b/tests/run/titerslice.nim
deleted file mode 100644
index e5d2e14a3..000000000
--- a/tests/run/titerslice.nim
+++ /dev/null
@@ -1,9 +0,0 @@
-discard """
-  output: '''2
-3
-4'''
-"""
-
-var t1 = @["1", "2", "3", "4"]
-for t in t1[1..3]:
-  echo t
diff --git a/tests/run/titervaropenarray.nim b/tests/run/titervaropenarray.nim
deleted file mode 100644
index 1e70ce247..000000000
--- a/tests/run/titervaropenarray.nim
+++ /dev/null
@@ -1,16 +0,0 @@
-discard """
-  file: "titer2.nim"
-  output: "123"
-"""
-# Try to break the transformation pass:
-iterator iterAndZero(a: var openArray[int]): int =
-  for i in 0..len(a)-1:
-    yield a[i]
-    a[i] = 0
-
-var x = [[1, 2, 3], [4, 5, 6]]
-for y in iterAndZero(x[0]): write(stdout, $y)
-#OUT 123
-
-
-
diff --git a/tests/run/tkoeniglookup.nim b/tests/run/tkoeniglookup.nim
deleted file mode 100644
index e6f5c0112..000000000
--- a/tests/run/tkoeniglookup.nim
+++ /dev/null
@@ -1,17 +0,0 @@
-discard """
-  output: '''x: 0 y: 0'''
-"""
-
-proc ToString*[T](x: T): string = return $x
-
-
-type
-  TMyObj = object
-    x, y: int
-
-proc `$`*(a: TMyObj): string = 
-  result = "x: " & $a.x & " y: " & $a.y
-
-var a: TMyObj
-echo toString(a)
-
diff --git a/tests/run/tlet.nim b/tests/run/tlet.nim
deleted file mode 100644
index ba355c5d8..000000000
--- a/tests/run/tlet.nim
+++ /dev/null
@@ -1,19 +0,0 @@
-discard """
-  output: '''Very funny, your name is name.
-nameabc'''
-"""
-
-proc main =
-  let name = "name"
-  if name == "":
-    echo("Poor soul, you lost your name?")
-  elif name == "name":
-    echo("Very funny, your name is name.")
-  else:
-    Echo("Hi, ", name, "!")
-    
-  let (x, y) = ("abc", name)
-  echo y, x
-
-main()
-
diff --git a/tests/run/tlists.nim b/tests/run/tlists.nim
deleted file mode 100644
index 7d5379945..000000000
--- a/tests/run/tlists.nim
+++ /dev/null
@@ -1,66 +0,0 @@
-discard """
-  output: '''true'''
-"""
-
-import lists
-
-const
-  data = [1, 2, 3, 4, 5, 6]
-
-block SinglyLinkedListTest1:
-  var L: TSinglyLinkedList[int]
-  for d in items(data): L.prepend(d)
-  assert($L == "[6, 5, 4, 3, 2, 1]")
-  
-  assert(4 in L)
-
-block SinglyLinkedListTest2:
-  var L: TSinglyLinkedList[string]
-  for d in items(data): L.prepend($d)
-  assert($L == "[6, 5, 4, 3, 2, 1]")
-  
-  assert("4" in L)
-
-
-block DoublyLinkedListTest1:
-  var L: TDoublyLinkedList[int]
-  for d in items(data): L.prepend(d)
-  for d in items(data): L.append(d)
-  L.remove(L.find(1))
-  assert($L == "[6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6]")
-  
-  assert(4 in L)
-
-block SinglyLinkedRingTest1:
-  var L: TSinglyLinkedRing[int]
-  L.prepend(4)
-  assert($L == "[4]")
-  L.prepend(4)
-
-  assert($L == "[4, 4]")
-  assert(4 in L)
-  
-
-block DoublyLinkedRingTest1:
-  var L: TDoublyLinkedRing[int]
-  L.prepend(4)
-  assert($L == "[4]")
-  L.prepend(4)
-
-  assert($L == "[4, 4]")
-  assert(4 in L)
-  
-  L.append(3)
-  L.append(5)
-  assert($L == "[4, 4, 3, 5]")
-
-  L.remove(L.find(3))
-  L.remove(L.find(5))
-  L.remove(L.find(4))
-  L.remove(L.find(4))
-  assert($L == "[]")
-  assert(4 notin L)
-  
-
-echo "true"
-
diff --git a/tests/run/tlocals.nim b/tests/run/tlocals.nim
deleted file mode 100644
index 94a34139b..000000000
--- a/tests/run/tlocals.nim
+++ /dev/null
@@ -1,11 +0,0 @@
-discard """
-  output: "(x: string here, a: 1, b: 3)"
-"""
-
-proc simple[T](a, b: T) = 
-  var
-    x = "string here"
-  echo locals()
-  
-simple(1, 3)
-
diff --git a/tests/run/tlowhigh.nim b/tests/run/tlowhigh.nim
deleted file mode 100644
index d1cbd3272..000000000
--- a/tests/run/tlowhigh.nim
+++ /dev/null
@@ -1,24 +0,0 @@
-discard """
-  file: "tlowhigh.nim"
-  output: "10"
-"""
-# Test the magic low() and high() procs

-

-type

-  myEnum = enum e1, e2, e3, e4, e5

-

-var

-  a: array [myEnum, int]

-

-for i in low(a) .. high(a):

-  a[i] = 0

-

-proc sum(a: openarray[int]): int =

-  result = 0

-  for i in low(a)..high(a):

-    inc(result, a[i])

-

-write(stdout, sum([1, 2, 3, 4]))

-#OUT 10

-
-
diff --git a/tests/run/tmacro2.nim b/tests/run/tmacro2.nim
deleted file mode 100644
index 8515322d5..000000000
--- a/tests/run/tmacro2.nim
+++ /dev/null
@@ -1,28 +0,0 @@
-discard """
-  output: "ta-da Your value sir: 'HE!!!!o Wor!!d'"
-"""
-
-import macros, strutils
-
-proc testBlock(): string {.compileTime.} = 
-  block myBlock:
-    while true:
-      echo "inner block"
-      break myBlock
-    echo "outer block"
-  result = "ta-da"
-
-macro mac(n: expr): expr =
-  let n = callsite()
-  expectKind(n, nnkCall)
-  expectLen(n, 2)
-  expectKind(n[1], nnkStrLit)
-  var s: string = n[1].strVal
-  s = s.replace("l", "!!")
-  result = newStrLitNode("Your value sir: '$#'" % [s])
-
-const s = testBlock() 
-const t = mac("HEllo World")
-echo s, " ", t
-
-
diff --git a/tests/run/tmacro3.nim b/tests/run/tmacro3.nim
deleted file mode 100644
index 162212326..000000000
--- a/tests/run/tmacro3.nim
+++ /dev/null
@@ -1,31 +0,0 @@
-discard """
-  output: ""
-"""
-
-import  macros
-
-type 
-    TA = tuple[a: int]
-    PA = ref TA
-
-macro test*(a: stmt): stmt {.immediate.} =
-  var val: PA
-  new(val)
-  val.a = 4
-
-test:
-  "hi"
-
-macro test2*(a: stmt): stmt {.immediate.} =
-  proc testproc(recurse: int) =
-    echo "Thats weird"
-    var o : PNimrodNode = nil
-    echo "  no its not!"
-    o = newNimNode(nnkNone)
-    if recurse > 0:
-      testproc(recurse - 1)
-  testproc(5)
-
-test2:
-  "hi"
-
diff --git a/tests/run/tmacro4.nim b/tests/run/tmacro4.nim
deleted file mode 100644
index 10a23b159..000000000
--- a/tests/run/tmacro4.nim
+++ /dev/null
@@ -1,19 +0,0 @@
-discard """
-  output: "after"
-"""
-
-import
-  macros, strutils
-
-macro test_macro*(n: stmt): stmt {.immediate.} =
-  result = newNimNode(nnkStmtList)
-  var ass : PNimrodNode = newNimNode(nnkAsgn)
-  add(ass, newIdentNode("str"))
-  add(ass, newStrLitNode("after"))
-  add(result, ass)
-when isMainModule:
-  var str: string = "before"
-  test_macro(str):
-    var i : integer = 123
-  echo str
-
diff --git a/tests/run/tmacrogenerics.nim b/tests/run/tmacrogenerics.nim
deleted file mode 100644
index 5ae59e0da..000000000
--- a/tests/run/tmacrogenerics.nim
+++ /dev/null
@@ -1,39 +0,0 @@
-discard """
-  file: "tmacrogenerics.nim"
-  msg: '''
-instantiation 1 with int and float
-instantiation 2 with float and string
-instantiation 3 with string and string
-counter: 3
-'''
-  output: "int\nfloat\nint\nstring"
-"""
-
-import typetraits, macros
-
-var counter {.compileTime.} = 0
-
-macro makeBar(A, B: typedesc): typedesc =
-  inc counter
-  echo "instantiation ", counter, " with ", A.name, " and ", B.name
-  result = A
-
-type 
-  Bar[T, U] = makeBar(T, U)
-
-var bb1: Bar[int, float]
-var bb2: Bar[float, string]
-var bb3: Bar[int, float]
-var bb4: Bar[string, string]
-
-proc match(a: int)    = echo "int"
-proc match(a: string) = echo "string"
-proc match(a: float)  = echo "float"
-
-match(bb1)
-match(bb2)
-match(bb3)
-match(bb4)
-
-static:
-  echo "counter: ", counter
diff --git a/tests/run/tmacros1.nim b/tests/run/tmacros1.nim
deleted file mode 100644
index 3c814ad6d..000000000
--- a/tests/run/tmacros1.nim
+++ /dev/null
@@ -1,31 +0,0 @@
-discard """
-  output: "Got: 'nnkCall' hi"
-"""
-
-import
-  macros, strutils
-
-macro outterMacro*(n: stmt): stmt {.immediate.} =
-  let n = callsite()
-  var j : string = "hi"
-  proc innerProc(i: int): string =
-    echo "Using arg ! " & n.repr
-    result = "Got: '" & $n.kind & "' " & $j
-  var callNode = n[0]
-  expectKind(n, TNimrodNodeKind.nnkCall)
-  if n.len != 3 or n[1].kind != TNimrodNodeKind.nnkIdent:
-    error("Macro " & callNode.repr &
-      " requires the ident passed as parameter (eg: " & callNode.repr & 
-      "(the_name_you_want)): statements.")
-  result = newNimNode(TNimrodNodeKind.nnkStmtList)
-  var ass : PNimrodNode = newNimNode(nnkAsgn)
-  ass.add(newIdentNode(n[1].ident))
-  ass.add(newStrLitNode(innerProc(4)))
-  result.add(ass)
-
-var str: string
-outterMacro(str):
-  "hellow"
-echo str
-
-
diff --git a/tests/run/tmath.nim b/tests/run/tmath.nim
deleted file mode 100644
index a86a3b84c..000000000
--- a/tests/run/tmath.nim
+++ /dev/null
@@ -1,47 +0,0 @@
-import math
-import unittest
-import sets
-
-suite "random int":
-  test "there might be some randomness":
-    var set = initSet[int](128)
-    randomize()
-    for i in 1..1000:
-      incl(set, random(high(int)))
-    check len(set) == 1000
-  test "single number bounds work":
-    randomize()
-    var rand: int
-    for i in 1..1000:
-      rand = random(1000)
-      check rand < 1000
-      check rand > -1
-  test "slice bounds work":
-    randomize()
-    var rand: int
-    for i in 1..1000:
-      rand = random(100..1000)
-      check rand < 1000
-      check rand >= 100
-
-suite "random float":
-  test "there might be some randomness":
-    var set = initSet[float](128)
-    randomize()
-    for i in 1..100:
-      incl(set, random(1.0))
-    check len(set) == 100
-  test "single number bounds work":
-    randomize()
-    var rand: float
-    for i in 1..1000:
-      rand = random(1000.0)
-      check rand < 1000.0
-      check rand > -1.0
-  test "slice bounds work":
-    randomize()
-    var rand: float
-    for i in 1..1000:
-      rand = random(100.0..1000.0)
-      check rand < 1000.0
-      check rand >= 100.0
diff --git a/tests/run/tmatrix.nim b/tests/run/tmatrix.nim
deleted file mode 100644
index 90dfde959..000000000
--- a/tests/run/tmatrix.nim
+++ /dev/null
@@ -1,48 +0,0 @@
-discard """
-  file: "tmatrix.nim"
-  output: "111"
-"""
-# Test overloading of [] with multiple indices
-
-type
-  TMatrix* = object
-    data: seq[float]
-    fWidth, fHeight: int
-
-template `|`(x, y: int): expr = y * m.fWidth + x
-
-proc createMatrix*(width, height: int): TMatrix = 
-  result.fWidth = width
-  result.fHeight = height
-  newSeq(result.data, width*height)
-
-proc width*(m: TMatrix): int {.inline.} = return m.fWidth
-proc height*(m: TMatrix): int {.inline.} = return m.fHeight
-
-proc `[]`*(m: TMatrix, x, y: int): float {.inline.} =
-  result = m.data[x|y]
-
-proc `[]=`*(m: var TMatrix, x, y: int, val: float) {.inline.} =
-  m.data[x|y] = val
-  
-proc `-|`*(m: TMatrix): TMatrix =
-  ## transposes a matrix
-  result = createMatrix(m.height, m.width)
-  for x in 0..m.width-1:
-    for y in 0..m.height-1: result[y,x] = m[x,y]
-
-#m.row(0, 2) # select row
-#m.col(0, 89) # select column
-
-const
-  w = 3
-  h = 20
-
-var m = createMatrix(w, h)
-for i in 0..w-1:
-  m[i, i] = 1.0
-
-for i in 0..w-1:
-  stdout.write(m[i,i]) #OUT 111
-
-
diff --git a/tests/run/tmemoization.nim b/tests/run/tmemoization.nim
deleted file mode 100644
index 180acd89b..000000000
--- a/tests/run/tmemoization.nim
+++ /dev/null
@@ -1,17 +0,0 @@
-discard """
-  msg:    "test 1\ntest 2\ntest 3"
-  output: "TEST 1\nTEST 2\nTEST 3"
-"""
-
-import strutils
-
-proc foo(s: static[string]): string =
-  static: echo s
-
-  const R = s.toUpper
-  return R
-
-echo foo("test 1")
-echo foo("test 2")
-echo foo("test " & $3)
-
diff --git a/tests/run/tmethods1.nim b/tests/run/tmethods1.nim
deleted file mode 100644
index f4add6af4..000000000
--- a/tests/run/tmethods1.nim
+++ /dev/null
@@ -1,22 +0,0 @@
-discard """
-  output: "do nothing"
-"""
-
-method somethin(obj: TObject) =
-  echo "do nothing"
-
-type
-  TNode* = object {.inheritable.}
-  PNode* = ref TNode
-
-  PNodeFoo* = ref object of TNode
-
-  TSomethingElse = object 
-  PSomethingElse = ref TSomethingElse
-
-method foo(a: PNode, b: PSomethingElse) = nil
-method foo(a: PNodeFoo, b: PSomethingElse) = nil
-
-var o: TObject
-o.somethin()
-
diff --git a/tests/run/tmixin.nim b/tests/run/tmixin.nim
deleted file mode 100644
index d841326a5..000000000
--- a/tests/run/tmixin.nim
+++ /dev/null
@@ -1,27 +0,0 @@
-discard """
-  output: "1\n2"
-"""
-
-type
-  TFoo1 = object of TObject
-    v: int
-  TFoo2 = object of TFoo1
-    v2: int
-
-proc test(f: TFoo1) =
-  echo "1"
-
-proc Foo[T](f: T) =
-  mixin test
-  test(f)
-
-var
-  a: TFoo1
-  b: TFoo2
-
-
-proc test(f: TFoo2) =
-  echo "2"
-
-Foo(a)
-Foo(b)
diff --git a/tests/run/tmoditer.nim b/tests/run/tmoditer.nim
deleted file mode 100644
index 1e6be37e4..000000000
--- a/tests/run/tmoditer.nim
+++ /dev/null
@@ -1,29 +0,0 @@
-discard """
-  output: "XXXXX01234"
-"""
-
-iterator modPairs(a: var array[0..4,string]): tuple[key: int, val: var string] =
-  for i in 0..a.high:
-    yield (i, a[i])
-
-iterator modItems*[T](a: var array[0..4,T]): var T =
-  for i in 0..a.high:
-    yield a[i]
-
-var
-  arr = ["a", "b", "c", "d", "e"]
-
-for a in modItems(arr):
-  a = "X"
-
-for a in items(arr):
-  stdout.write(a)
-
-for i, a in modPairs(arr):
-  a = $i
-
-for a in items(arr):
-  stdout.write(a)
-
-echo ""
-
diff --git a/tests/run/tmultim1.nim b/tests/run/tmultim1.nim
deleted file mode 100644
index 7f551aa64..000000000
--- a/tests/run/tmultim1.nim
+++ /dev/null
@@ -1,29 +0,0 @@
-discard """
-  file: "tmultim1.nim"
-  output: "7"
-"""
-# Test multi methods
-
-type
-  Expression = ref object {.inheritable.}
-  Literal = ref object of Expression
-    x: int
-  PlusExpr = ref object of Expression
-    a, b: Expression
-    
-method eval(e: Expression): int = quit "to override!"
-method eval(e: Literal): int = return e.x
-method eval(e: PlusExpr): int = return eval(e.a) + eval(e.b)
-
-proc newLit(x: int): Literal =
-  new(result)
-  result.x = x
-  
-proc newPlus(a, b: Expression): PlusExpr =
-  new(result)
-  result.a = a
-  result.b = b
-
-echo eval(newPlus(newPlus(newLit(1), newLit(2)), newLit(4))) #OUT 7
-
-
diff --git a/tests/run/tmultim2.nim b/tests/run/tmultim2.nim
deleted file mode 100644
index 75f652137..000000000
--- a/tests/run/tmultim2.nim
+++ /dev/null
@@ -1,36 +0,0 @@
-discard """
-  file: "tmultim2.nim"
-  output: "collide: unit, thing collide: unit, thing collide: thing, unit"
-"""
-# Test multi methods
-
-type
-  TThing = object {.inheritable.}
-  TUnit = object of TThing
-    x: int
-  TParticle = object of TThing
-    a, b: int
-    
-method collide(a, b: TThing) {.inline.} =
-  quit "to override!"
-  
-method collide(a: TThing, b: TUnit) {.inline.} =
-  write stdout, "collide: thing, unit "
-
-method collide(a: TUnit, b: TThing) {.inline.} =
-  write stdout, "collide: unit, thing "
-
-proc test(a, b: TThing) {.inline.} =
-  collide(a, b)
-
-var
-  a: TThing
-  b, c: TUnit
-collide(b, c) # ambiguous (unit, thing) or (thing, unit)? -> prefer unit, thing!
-test(b, c)
-collide(a, b)
-#OUT collide: unit, thing collide: unit, thing collide: thing, unit
-
-
-
-
diff --git a/tests/run/tmultim3.nim b/tests/run/tmultim3.nim
deleted file mode 100644
index 373c84c0e..000000000
--- a/tests/run/tmultim3.nim
+++ /dev/null
@@ -1,20 +0,0 @@
-discard """
-  file: "tmultim3.nim"
-  output: "Hi derived!"
-"""
-import mmultim3
-
-type
-    TBObj* = object of TObj
-
-
-method test123(a : ref TBObj) =
-    echo("Hi derived!")
-
-var a : ref TBObj
-new(a)
-myObj = a
-testMyObj()
-
-
-
diff --git a/tests/run/tmultim4.nim b/tests/run/tmultim4.nim
deleted file mode 100644
index d824086b2..000000000
--- a/tests/run/tmultim4.nim
+++ /dev/null
@@ -1,47 +0,0 @@
-discard """
-  file: "tmultim4.nim"
-  output: "hello"
-"""
-type
-  Test = object of TObject
-
-method doMethod(a: ref TObject) {.raises: [EIO].} =
-  quit "override"
-
-method doMethod(a: ref Test) =
-  echo "hello"
-  if a == nil:
-    raise newException(EIO, "arg")
-
-proc doProc(a: ref Test) =
-  echo "hello"
-
-proc newTest(): ref Test =
-  new(result)
-
-var s:ref Test = newTest()
-
-
-#doesn't work
-for z in 1..4:
-  s.doMethod()
-  break
- 
-#works
-#for z in 1..4:
-#  s.doProc()
-#  break
-
-#works
-#while true:
-#  s.doMethod()
-#  break
-
-#works
-#while true:
-#  s.doProc()
-#  break
-
-
-
-
diff --git a/tests/run/tmultim6.nim b/tests/run/tmultim6.nim
deleted file mode 100644
index 5f45f572a..000000000
--- a/tests/run/tmultim6.nim
+++ /dev/null
@@ -1,30 +0,0 @@
-discard """
-  output: "collide: unit, thing | collide: unit, thing | collide: thing, unit |"
-"""
-# Test multi methods
-
-type
-  TThing = object {.inheritable.}
-  TUnit[T] = object of TThing
-    x: T
-  TParticle = object of TThing
-    a, b: int
-    
-method collide(a, b: TThing) {.inline.} =
-  quit "to override!"
-  
-method collide[T](a: TThing, b: TUnit[T]) {.inline.} =
-  write stdout, "collide: thing, unit | "
-
-method collide[T](a: TUnit[T], b: TThing) {.inline.} =
-  write stdout, "collide: unit, thing | "
-
-proc test(a, b: TThing) {.inline.} =
-  collide(a, b)
-
-var
-  a: TThing
-  b, c: TUnit[string]
-collide(b, TThing(c))
-test(b, c)
-collide(a, b)
diff --git a/tests/run/tnamedenumfields.nim b/tests/run/tnamedenumfields.nim
deleted file mode 100644
index e9ac88a42..000000000
--- a/tests/run/tnamedenumfields.nim
+++ /dev/null
@@ -1,23 +0,0 @@
-discard """
-  file: "tnamedenumfields.nim"
-  output: "my value A0my value Bconc1valueCabc3abc"
-"""
-
-const
-  strValB = "my value B"
-
-type
-  TMyEnum = enum
-    valueA = (0, "my value A"),
-    valueB = strValB & "conc",
-    valueC,
-    valueD = (3, "abc"),
-    valueE = 4
-
-# trick the optimizer with a variable:
-var x = valueD
-echo valueA, ord(valueA), valueB, ord(valueB), valueC, valueD, ord(valueD), x
-
-
-
-
diff --git a/tests/run/tnestif.nim b/tests/run/tnestif.nim
deleted file mode 100644
index bfcd8751c..000000000
--- a/tests/run/tnestif.nim
+++ /dev/null
@@ -1,24 +0,0 @@
-discard """
-  file: "tnestif.nim"
-  output: "i == 2"
-"""
-# test nested ifs

-

-var

-    x, y: int

-x = 2

-if x == 0:

-    write(stdout, "i == 0")

-    if y == 0:

-        write(stdout, x)

-    else:

-        write(stdout, y)

-elif x == 1:

-    write(stdout, "i == 1")

-elif x == 2:

-    write(stdout, "i == 2")

-else:

-    write(stdout, "looks like Python")

-#OUT i == 2

-
-
diff --git a/tests/run/tnestprc.nim b/tests/run/tnestprc.nim
deleted file mode 100644
index c10ad6abf..000000000
--- a/tests/run/tnestprc.nim
+++ /dev/null
@@ -1,16 +0,0 @@
-discard """
-  file: "tnestprc.nim"
-  output: "10"
-"""
-# Test nested procs without closures
-
-proc Add3(x: int): int = 
-  proc add(x, y: int): int {.noconv.} = 
-    result = x + y
-    
-  result = add(x, 3)
-  
-echo Add3(7) #OUT 10
-
-
-
diff --git a/tests/run/tnewderef.nim b/tests/run/tnewderef.nim
deleted file mode 100644
index 89dc4c8d1..000000000
--- a/tests/run/tnewderef.nim
+++ /dev/null
@@ -1,11 +0,0 @@
-discard """
-  output: 3
-
-"""
-
-var x: ref int
-new(x)
-x[] = 3
-
-echo x[] 
-
diff --git a/tests/run/tnodeadlocks.nim b/tests/run/tnodeadlocks.nim
deleted file mode 100644
index 18fdca3e9..000000000
--- a/tests/run/tnodeadlocks.nim
+++ /dev/null
@@ -1,70 +0,0 @@
-discard """
-  outputsub: "101"
-  cmd: "nimrod cc --hints:on --threads:on $# $#"
-"""
-
-import os, locks
-
-const
-  noDeadlocks = defined(preventDeadlocks)
-
-var
-  thr: array [0..5, TThread[tuple[a, b: int]]]
-  L, M, N: TLock
-
-proc doNothing() = nil
-
-proc threadFunc(interval: tuple[a, b: int]) {.thread.} = 
-  doNothing()
-  for i in interval.a..interval.b: 
-    when nodeadlocks:
-      case i mod 6
-      of 0:
-        Acquire(L) # lock stdout
-        Acquire(M)
-        Acquire(N)
-      of 1:
-        Acquire(L)
-        Acquire(N) # lock stdout
-        Acquire(M)
-      of 2:
-        Acquire(M)
-        Acquire(L)
-        Acquire(N)
-      of 3:
-        Acquire(M)
-        Acquire(N)
-        Acquire(L)
-      of 4:
-        Acquire(N)
-        Acquire(M)
-        Acquire(L)
-      of 5:
-        Acquire(N)
-        Acquire(L)
-        Acquire(M)
-      else: assert false
-    else:
-      Acquire(L) # lock stdout
-      Acquire(M)
-      
-    echo i
-    os.sleep(10)
-    when nodeadlocks:
-      echo "deadlocks prevented: ", deadlocksPrevented
-    when nodeadlocks:
-      Release(N)
-    Release(M)
-    Release(L)
-
-InitLock(L)
-InitLock(M)
-InitLock(N)
-
-proc main =
-  for i in 0..high(thr):
-    createThread(thr[i], threadFunc, (i*100, i*100+50))
-  joinThreads(thr)
-
-main()
-
diff --git a/tests/run/tobjasgn.nim b/tests/run/tobjasgn.nim
deleted file mode 100644
index 5f411063f..000000000
--- a/tests/run/tobjasgn.nim
+++ /dev/null
@@ -1,39 +0,0 @@
-discard """
-  output: '''0
-pre test a:test b:1 c:2 haha:3
-assignment test a:test b:1 c:2 haha:3
-'''
-"""
-
-type TSomeObj = object of TObject
-  Variable: int
- 
-var a = TSomeObj()
- 
-echo a.Variable.`$`
-
-# bug #575
-
-type
-  Something = object of Tobject
-    a: string
-    b, c: int32
-
-type
-  Other = object of Something
-    haha: int
-
-proc `$`(x: Other): string =
-  result = "a:" & x.a & " b:" & $x.b & " c:" & $x.c & " haha:" & $x.haha
-
-var
-  t: Other
-
-t.a = "test"
-t.b = 1
-t.c = 2
-t.haha = 3
-
-echo "pre test ", $t
-var x = t
-echo "assignment test ", x
diff --git a/tests/run/tobjconstr.nim b/tests/run/tobjconstr.nim
deleted file mode 100644
index 3bd785728..000000000
--- a/tests/run/tobjconstr.nim
+++ /dev/null
@@ -1,41 +0,0 @@
-discard """
-  output: '''(k: kindA, a: (x: abc, z: [1, 1, 3]), empty: ())
-(k: kindA, a: (x: abc, z: [1, 2, 3]), empty: ())
-(k: kindA, a: (x: abc, z: [1, 3, 3]), empty: ())
-(k: kindA, a: (x: abc, z: [1, 4, 3]), empty: ())
-(k: kindA, a: (x: abc, z: [1, 5, 3]), empty: ())
-(k: kindA, a: (x: abc, z: [1, 6, 3]), empty: ())
-(k: kindA, a: (x: abc, z: [1, 7, 3]), empty: ())
-(k: kindA, a: (x: abc, z: [1, 8, 3]), empty: ())
-(k: kindA, a: (x: abc, z: [1, 9, 3]), empty: ())
-(k: kindA, a: (x: abc, z: [1, 10, 3]), empty: ())'''
-"""
-
-type
-  TArg = object
-    x: string
-    z: seq[int]
-  TKind = enum kindXY, kindA
-  TEmpty = object
-  TDummy = ref object
-    case k: TKind
-    of kindXY: x, y: int
-    of kindA: 
-      a: TArg
-      empty: TEmpty
-
-proc `$`[T](s: seq[T]): string =
-  # XXX why is that not in the stdlib?
-  result = "["
-  for i, x in s:
-    if i > 0: result.add(", ")
-    result.add($x)
-  result.add("]")
-
-proc main() =
-  for i in 1..10:
-    let d = TDummy(k: kindA, a: TArg(x: "abc", z: @[1,i,3]), empty: TEmpty())
-    echo d[]
-
-main()
-
diff --git a/tests/run/tobject.nim b/tests/run/tobject.nim
deleted file mode 100644
index 5fec84441..000000000
--- a/tests/run/tobject.nim
+++ /dev/null
@@ -1,15 +0,0 @@
-import unittest
-
-type Obj = object
-  foo: int
-
-proc makeObj(x: int): Obj = 
-  result.foo = x
-
-suite "object basic methods":
-  test "it should convert an object to a string":
-    var obj = makeObj(1)
-    # Should be "obj: (foo: 1)" or similar.
-    check($obj == "(foo: 1)")
-  test "it should test equality based on fields":
-    check(makeObj(1) == makeObj(1))
diff --git a/tests/run/tofopr.nim b/tests/run/tofopr.nim
deleted file mode 100644
index 961d81bd3..000000000
--- a/tests/run/tofopr.nim
+++ /dev/null
@@ -1,26 +0,0 @@
-discard """
-  file: "tofopr.nim"
-  output: "falsetrue"
-"""
-# Test is operator
-
-type
-  TMyType = object {.inheritable.}
-    len: int
-    data: string
-    
-  TOtherType = object of TMyType
-   
-proc p(x: TMyType): bool = 
-  return x of TOtherType
-    
-var
-  m: TMyType
-  n: TOtherType
-
-write(stdout, p(m))
-write(stdout, p(n))
-
-#OUT falsetrue
-
-
diff --git a/tests/run/tonraise.nim b/tests/run/tonraise.nim
deleted file mode 100644
index 1a555dd94..000000000
--- a/tests/run/tonraise.nim
+++ /dev/null
@@ -1,34 +0,0 @@
-discard """
-  output: '''i: 1
-success'''
-"""
-
-type
-  ESomething = object of E_Base
-  ESomeOtherErr = object of E_Base
-
-proc genErrors(s: string) =
-  if s == "error!":
-    raise newException(ESomething, "Test")
-  else:
-    raise newException(EsomeotherErr, "bla")
-
-proc foo() =
-  var i = 0
-  try:
-    inc i
-    onRaise(proc (e: ref E_Base): bool =
-      echo "i: ", i)
-    genErrors("errssor!")
-  except ESomething:
-    echo("ESomething happened")
-  except:
-    echo("Some other error happened")
-    
-  # test that raise handler is gone:
-  try:
-    genErrors("error!")
-  except ESomething:
-    echo "success"
-
-foo()
diff --git a/tests/run/toop1.nim b/tests/run/toop1.nim
deleted file mode 100644
index 350799f51..000000000
--- a/tests/run/toop1.nim
+++ /dev/null
@@ -1,89 +0,0 @@
-discard """
-  file: "toop1.nim"
-  output: "34[]o 5"
-"""
-# Test the stuff in the tutorial
-import macros
-
-type
-  TFigure = object of TObject    # abstract base class:
-    draw: proc (my: var TFigure) {.nimcall.} # concrete classes implement this
-  
-proc init(f: var TFigure) = 
-  f.draw = nil
-
-type
-  TCircle = object of TFigure
-    radius: int
-  
-proc drawCircle(my: var TCircle) = stdout.writeln("o " & $my.radius)
-
-proc init(my: var TCircle) = 
-  init(TFigure(my)) # call base constructor
-  my.radius = 5
-  my.draw = cast[proc (my: var TFigure) {.nimcall.}](drawCircle)
-
-type
-  TRectangle = object of TFigure
-    width, height: int
-
-proc drawRectangle(my: var TRectangle) = stdout.write("[]")
-
-proc init(my: var TRectangle) = 
-  init(TFigure(my)) # call base constructor
-  my.width = 5
-  my.height = 10
-  my.draw = cast[proc (my: var TFigure) {.nimcall.}](drawRectangle)
-
-macro `!` (n: expr): stmt {.immediate.} = 
-  let n = callsite()
-  result = newNimNode(nnkCall, n)
-  var dot = newNimNode(nnkDotExpr, n)
-  dot.add(n[1])    # obj
-  if n[2].kind == nnkCall:
-    # transforms ``obj!method(arg1, arg2, ...)`` to
-    # ``(obj.method)(obj, arg1, arg2, ...)``
-    dot.add(n[2][0]) # method
-    result.add(dot)
-    result.add(n[1]) # obj
-    for i in 1..n[2].len-1:
-      result.add(n[2][i])
-  else:
-    # transforms ``obj!method`` to
-    # ``(obj.method)(obj)``
-    dot.add(n[2]) # method
-    result.add(dot)
-    result.add(n[1]) # obj
-
-type
-  TSocket* = object of TObject
-    FHost: int # cannot be accessed from the outside of the module
-               # the `F` prefix is a convention to avoid clashes since
-               # the accessors are named `host`
-               
-proc `host=`*(s: var TSocket, value: int) {.inline.} = 
-  ## setter of hostAddr
-  s.FHost = value
-
-proc host*(s: TSocket): int {.inline.} =
-  ## getter of hostAddr
-  return s.FHost
-  
-var 
-  s: TSocket
-s.host = 34  # same as `host=`(s, 34)
-stdout.write(s.host)
-
-# now use these classes:
-var
-  r: TRectangle
-  c: TCircle
-init(r)
-init(c)
-r!draw
-c!draw() 
-
-#OUT 34[]o 5
-
-
-
diff --git a/tests/run/topenarrayrepr.nim b/tests/run/topenarrayrepr.nim
deleted file mode 100644
index d276756bc..000000000
--- a/tests/run/topenarrayrepr.nim
+++ /dev/null
@@ -1,17 +0,0 @@
-discard """
-  file: "topenarrayrepr.nim"
-  output: "5 - [1]"
-"""
-type
-  TProc = proc (n: int, m: openarray[int64]) {.nimcall.}
-
-proc Foo(x: int, P: TProc) =
-  P(x, [ 1'i64 ])
-
-proc Bar(n: int, m: openarray[int64]) =
-  echo($n & " - " & repr(m))
-
-Foo(5, Bar) #OUT 5 - [1]
-
-
-
diff --git a/tests/run/topenlen.nim b/tests/run/topenlen.nim
deleted file mode 100644
index fec8e87b7..000000000
--- a/tests/run/topenlen.nim
+++ /dev/null
@@ -1,18 +0,0 @@
-discard """
-  file: "topenlen.nim"
-  output: "7"
-"""
-# Tests a special bug
-
-proc choose(b: openArray[string]): string = return b[0]
-
-proc p(a, b: openarray[string]): int =
-  result = a.len + b.len - 1
-  for j in 0 .. a.len: inc(result)
-  discard choose(a)
-  discard choose(b)
-
-discard choose(["sh", "-c", $p([""], ["a"])])
-echo($p(["", "ha", "abc"], ["xyz"])) #OUT 7
-
-
diff --git a/tests/run/toprprec.nim b/tests/run/toprprec.nim
deleted file mode 100644
index ce33934b5..000000000
--- a/tests/run/toprprec.nim
+++ /dev/null
@@ -1,39 +0,0 @@
-discard """
-  file: "toprprec.nim"
-  output: "done"
-"""
-# Test operator precedence: 
-
-template `@` (x: expr): expr {.immediate.} = self.x
-template `@!` (x: expr): expr {.immediate.} = x
-template `===` (x: expr): expr {.immediate.} = x
-
-type
-  TO = object
-    x: int
-  TA = tuple[a, b: int, obj: TO]
-  
-proc init(self: var TA): string =
-  @a = 3
-  === @b = 4
-  @obj.x = 4
-  @! === result = "abc"
-  result = @b.`$`
-
-assert 3+5*5-2 == 28- -26-28
-
-proc `^-` (x, y: int): int =  
-  # now right-associative!
-  result = x - y
-  
-assert 34 ^- 6 ^- 2 == 30
-assert 34 - 6 - 2 == 26
-
-
-var s: TA
-assert init(s) == "4"
-
-echo "done"
-
-
-
diff --git a/tests/run/toverflw.nim b/tests/run/toverflw.nim
deleted file mode 100644
index cd7b65acf..000000000
--- a/tests/run/toverflw.nim
+++ /dev/null
@@ -1,21 +0,0 @@
-discard """
-  file: "toverflw.nim"
-  output: "the computation overflowed"
-"""
-# Tests nimrod's ability to detect overflows

-

-{.push overflowChecks: on.}

-

-var

-  a, b: int

-a = high(int)

-b = -2

-try:

-  writeln(stdout, b - a)

-except EOverflow:

-  writeln(stdout, "the computation overflowed")

-

-{.pop.} # overflow check

-#OUT the computation overflowed

-
-
diff --git a/tests/run/toverflw2.nim b/tests/run/toverflw2.nim
deleted file mode 100644
index f7fe3d574..000000000
--- a/tests/run/toverflw2.nim
+++ /dev/null
@@ -1,10 +0,0 @@
-discard """
-  file: "toverflw2.nim"
-  outputsub: "Error: unhandled exception: over- or underflow [EOverflow]"
-  exitcode: "1"
-"""
-var a : int32 = 2147483647
-var b : int32 = 2147483647
-var c = a + b
-
-
diff --git a/tests/run/toverl2.nim b/tests/run/toverl2.nim
deleted file mode 100644
index ea0249e9f..000000000
--- a/tests/run/toverl2.nim
+++ /dev/null
@@ -1,33 +0,0 @@
-discard """
-  file: "toverl2.nim"
-  output: "true012innertrue"
-"""
-# Test new overloading resolution rules
-
-import strutils
-
-proc toverl2(x: int): string = return $x
-proc toverl2(x: bool): string = return $x
-
-iterator toverl2(x: int): int = 
-  var res = 0
-  while res < x: 
-    yield res
-    inc(res)
-
-var
-  pp: proc (x: bool): string {.nimcall.} = toverl2
-
-stdout.write(pp(true))
-
-for x in toverl2(3): 
-  stdout.write(toverl2(x))
-
-block:
-  proc toverl2(x: int): string = return "inner"
-  stdout.write(toverl2(5))
-  stdout.write(true)
-
-stdout.write("\n")
-#OUT true012innertrue
-
diff --git a/tests/run/toverl3.nim b/tests/run/toverl3.nim
deleted file mode 100644
index b3e0f2fa7..000000000
--- a/tests/run/toverl3.nim
+++ /dev/null
@@ -1,20 +0,0 @@
-discard """
-  file: "toverl3.nim"
-  output: '''m1
-tup1'''
-"""
-
-# Tests more specific generic match:

-

-proc m[T](x: T) = echo "m2"
-proc m[T](x: var ref T) = echo "m1"
-
-proc tup[S, T](x: tuple[a: S, b: ref T]) = echo "tup1"
-proc tup[S, T](x: tuple[a: S, b: T]) = echo "tup2"
-
-var
-  obj: ref int
-  tu: tuple[a: int, b: ref bool]
-  
-m(obj)
-tup(tu)
diff --git a/tests/run/toverwr.nim b/tests/run/toverwr.nim
deleted file mode 100644
index ef25e8913..000000000
--- a/tests/run/toverwr.nim
+++ /dev/null
@@ -1,13 +0,0 @@
-discard """
-  file: "toverwr.nim"
-  output: "hello"
-"""
-# Test the overloading resolution in connection with a qualifier

-

-proc write(t: TFile, s: string) =

-  nil # a nop

-

-system.write(stdout, "hello")

-#OUT hello

-
-
diff --git a/tests/run/tovfint.nim b/tests/run/tovfint.nim
deleted file mode 100644
index f0b1ccaa6..000000000
--- a/tests/run/tovfint.nim
+++ /dev/null
@@ -1,23 +0,0 @@
-discard """
-  file: "tovfint.nim"
-  output: "works!"
-"""
-# this tests the new overflow literals

-

-var

-  i: int

-i = int(0xffffffff'i32)

-when defined(cpu64):

-  if i == -1:

-    write(stdout, "works!\n")

-  else:

-    write(stdout, "broken!\n")

-else:

-  if i == -1:

-    write(stdout, "works!\n")

-  else:

-    write(stdout, "broken!\n")

-

-#OUT works!

-
-
diff --git a/tests/run/tpatterns.nim b/tests/run/tpatterns.nim
deleted file mode 100644
index 6bc8772e3..000000000
--- a/tests/run/tpatterns.nim
+++ /dev/null
@@ -1,17 +0,0 @@
-discard """
-  output: '''48
-hel'''
-"""
-
-template optZero{x+x}(x: int): int = x*3
-template andthen{`*`(x,3)}(x: int): int = x*4
-template optSubstr1{x = substr(x, a, b)}(x: string, a, b: int) = setlen(x, b+1)
-
-var y = 12
-echo y+y
-
-var s: array[0..2, string]
-s[0] = "hello"
-s[0] = substr(s[0], 0, 2)
-
-echo s[0]
diff --git a/tests/run/tpegs.nim b/tests/run/tpegs.nim
deleted file mode 100644
index bdd8db0f8..000000000
--- a/tests/run/tpegs.nim
+++ /dev/null
@@ -1,1770 +0,0 @@
-discard """
-  output: '''this
-is
-an
-example
-d
-e
-f
-('keyvalue' 'key'*)'''
-"""
-# PEGs module turned out to be a good test to detect memory management bugs.
-
-include "system/inclrtl"
-
-const
-  useUnicode = true ## change this to deactivate proper UTF-8 support
-
-import
-  strutils
-
-when useUnicode:
-  import unicode
-
-const
-  InlineThreshold = 5  ## number of leaves; -1 to disable inlining
-  MaxSubpatterns* = 10 ## defines the maximum number of subpatterns that
-                       ## can be captured. More subpatterns cannot be captured! 
-
-type
-  TPegKind = enum
-    pkEmpty,
-    pkAny,              ## any character (.)
-    pkAnyRune,          ## any Unicode character (_)
-    pkNewLine,          ## CR-LF, LF, CR
-    pkLetter,           ## Unicode letter
-    pkLower,            ## Unicode lower case letter
-    pkUpper,            ## Unicode upper case letter
-    pkTitle,            ## Unicode title character
-    pkWhitespace,       ## Unicode whitespace character
-    pkTerminal,
-    pkTerminalIgnoreCase,
-    pkTerminalIgnoreStyle,
-    pkChar,             ## single character to match
-    pkCharChoice,
-    pkNonTerminal,
-    pkSequence,         ## a b c ... --> Internal DSL: peg(a, b, c)
-    pkOrderedChoice,    ## a / b / ... --> Internal DSL: a / b or /[a, b, c]
-    pkGreedyRep,        ## a*     --> Internal DSL: *a
-                        ## a+     --> (a a*)
-    pkGreedyRepChar,    ## x* where x is a single character (superop)
-    pkGreedyRepSet,     ## [set]* (superop)
-    pkGreedyAny,        ## .* or _* (superop)
-    pkOption,           ## a?     --> Internal DSL: ?a
-    pkAndPredicate,     ## &a     --> Internal DSL: &a
-    pkNotPredicate,     ## !a     --> Internal DSL: !a
-    pkCapture,          ## {a}    --> Internal DSL: capture(a)
-    pkBackRef,          ## $i     --> Internal DSL: backref(i)
-    pkBackRefIgnoreCase,
-    pkBackRefIgnoreStyle,
-    pkSearch,           ## @a     --> Internal DSL: !*a
-    pkCapturedSearch,   ## {@} a  --> Internal DSL: !*\a
-    pkRule,             ## a <- b
-    pkList,             ## a, b
-    pkStartAnchor       ## ^      --> Internal DSL: startAnchor()
-  TNonTerminalFlag = enum
-    ntDeclared, ntUsed
-  TNonTerminal {.final.} = object ## represents a non terminal symbol
-    name: string                  ## the name of the symbol
-    line: int                     ## line the symbol has been declared/used in
-    col: int                      ## column the symbol has been declared/used in
-    flags: set[TNonTerminalFlag]  ## the nonterminal's flags
-    rule: TNode                   ## the rule that the symbol refers to
-  TNode {.final, shallow.} = object
-    case kind: TPegKind
-    of pkEmpty..pkWhitespace: nil
-    of pkTerminal, pkTerminalIgnoreCase, pkTerminalIgnoreStyle: term: string
-    of pkChar, pkGreedyRepChar: ch: char
-    of pkCharChoice, pkGreedyRepSet: charChoice: ref set[char]
-    of pkNonTerminal: nt: PNonTerminal
-    of pkBackRef..pkBackRefIgnoreStyle: index: range[0..MaxSubpatterns]
-    else: sons: seq[TNode]
-  PNonTerminal* = ref TNonTerminal
-  
-  TPeg* = TNode ## type that represents a PEG
-
-proc term*(t: string): TPeg {.rtl, extern: "npegs$1Str".} =
-  ## constructs a PEG from a terminal string
-  if t.len != 1:  
-    result.kind = pkTerminal
-    result.term = t
-  else:
-    result.kind = pkChar
-    result.ch = t[0]
-
-proc termIgnoreCase*(t: string): TPeg {.
-  rtl, extern: "npegs$1".} =
-  ## constructs a PEG from a terminal string; ignore case for matching
-  result.kind = pkTerminalIgnoreCase
-  result.term = t
-
-proc termIgnoreStyle*(t: string): TPeg {.
-  rtl, extern: "npegs$1".} =
-  ## constructs a PEG from a terminal string; ignore style for matching
-  result.kind = pkTerminalIgnoreStyle
-  result.term = t
-
-proc term*(t: char): TPeg {.rtl, extern: "npegs$1Char".} =
-  ## constructs a PEG from a terminal char
-  assert t != '\0'
-  result.kind = pkChar
-  result.ch = t
-  
-proc charSet*(s: set[char]): TPeg {.rtl, extern: "npegs$1".} =
-  ## constructs a PEG from a character set `s`
-  assert '\0' notin s
-  result.kind = pkCharChoice
-  new(result.charChoice)
-  result.charChoice[] = s
-
-proc len(a: TPeg): int {.inline.} = return a.sons.len
-proc add(d: var TPeg, s: TPeg) {.inline.} = add(d.sons, s)
-
-proc copyPeg(a: TPeg): TPeg = 
-  result.kind = a.kind
-  case a.kind
-  of pkEmpty..pkWhitespace: nil
-  of pkTerminal, pkTerminalIgnoreCase, pkTerminalIgnoreStyle: 
-    result.term = a.term
-  of pkChar, pkGreedyRepChar: 
-    result.ch = a.ch
-  of pkCharChoice, pkGreedyRepSet: 
-    new(result.charChoice)
-    result.charChoice[] = a.charChoice[]
-  of pkNonTerminal: result.nt = a.nt
-  of pkBackRef..pkBackRefIgnoreStyle: 
-    result.index = a.index
-  else: 
-    result.sons = a.sons
-
-proc addChoice(dest: var TPeg, elem: TPeg) =
-  var L = dest.len-1
-  if L >= 0 and dest.sons[L].kind == pkCharChoice: 
-    # caution! Do not introduce false aliasing here!
-    case elem.kind
-    of pkCharChoice:
-      dest.sons[L] = charSet(dest.sons[L].charChoice[] + elem.charChoice[])
-    of pkChar: 
-      dest.sons[L] = charSet(dest.sons[L].charChoice[] + {elem.ch})
-    else: add(dest, elem)
-  else: add(dest, elem)
-
-template multipleOp(k: TPegKind, localOpt: expr) =
-  result.kind = k
-  result.sons = @[]
-  for x in items(a):
-    if x.kind == k:
-      for y in items(x.sons):
-        localOpt(result, y)
-    else:
-      localOpt(result, x)
-  if result.len == 1:
-    result = result.sons[0]
-
-proc `/`*(a: varargs[TPeg]): TPeg {.
-  rtl, extern: "npegsOrderedChoice".} =
-  ## constructs an ordered choice with the PEGs in `a`
-  multipleOp(pkOrderedChoice, addChoice)
-
-proc addSequence(dest: var TPeg, elem: TPeg) =
-  var L = dest.len-1
-  if L >= 0 and dest.sons[L].kind == pkTerminal: 
-    # caution! Do not introduce false aliasing here!
-    case elem.kind
-    of pkTerminal: 
-      dest.sons[L] = term(dest.sons[L].term & elem.term)
-    of pkChar: 
-      dest.sons[L] = term(dest.sons[L].term & elem.ch)
-    else: add(dest, elem)
-  else: add(dest, elem)
-
-proc sequence*(a: varargs[TPeg]): TPeg {.
-  rtl, extern: "npegs$1".} =
-  ## constructs a sequence with all the PEGs from `a`
-  multipleOp(pkSequence, addSequence)
- 
-proc `?`*(a: TPeg): TPeg {.rtl, extern: "npegsOptional".} =
-  ## constructs an optional for the PEG `a`
-  if a.kind in {pkOption, pkGreedyRep, pkGreedyAny, pkGreedyRepChar,
-                pkGreedyRepSet}:
-    # a* ?  --> a*
-    # a? ?  --> a?
-    result = a
-  else:
-    result.kind = pkOption
-    result.sons = @[a]
-
-proc `*`*(a: TPeg): TPeg {.rtl, extern: "npegsGreedyRep".} =
-  ## constructs a "greedy repetition" for the PEG `a`
-  case a.kind
-  of pkGreedyRep, pkGreedyRepChar, pkGreedyRepSet, pkGreedyAny, pkOption:
-    assert false
-    # produces endless loop!
-  of pkChar:
-    result.kind = pkGreedyRepChar
-    result.ch = a.ch
-  of pkCharChoice:
-    result.kind = pkGreedyRepSet
-    result.charChoice = a.charChoice # copying a reference suffices!
-  of pkAny, pkAnyRune:
-    result.kind = pkGreedyAny
-  else:
-    result.kind = pkGreedyRep
-    result.sons = @[a]
-
-proc `!*`*(a: TPeg): TPeg {.rtl, extern: "npegsSearch".} =
-  ## constructs a "search" for the PEG `a`
-  result.kind = pkSearch
-  result.sons = @[a]
-
-proc `!*\`*(a: TPeg): TPeg {.rtl, 
-                             extern: "npgegsCapturedSearch".} =
-  ## constructs a "captured search" for the PEG `a`
-  result.kind = pkCapturedSearch
-  result.sons = @[a]
-  
-when false:
-  proc contains(a: TPeg, k: TPegKind): bool =
-    if a.kind == k: return true
-    case a.kind
-    of pkEmpty, pkAny, pkAnyRune, pkGreedyAny, pkNewLine, pkTerminal,
-       pkTerminalIgnoreCase, pkTerminalIgnoreStyle, pkChar, pkGreedyRepChar,
-       pkCharChoice, pkGreedyRepSet: nil
-    of pkNonTerminal: return true
-    else:
-      for i in 0..a.sons.len-1:
-        if contains(a.sons[i], k): return true
-
-proc `+`*(a: TPeg): TPeg {.rtl, extern: "npegsGreedyPosRep".} =
-  ## constructs a "greedy positive repetition" with the PEG `a`
-  return sequence(a, *a)
-  
-proc `&`*(a: TPeg): TPeg {.rtl, extern: "npegsAndPredicate".} =
-  ## constructs an "and predicate" with the PEG `a`
-  result.kind = pkAndPredicate
-  result.sons = @[a]
-
-proc `!`*(a: TPeg): TPeg {.rtl, extern: "npegsNotPredicate".} =
-  ## constructs a "not predicate" with the PEG `a`
-  result.kind = pkNotPredicate
-  result.sons = @[a]
-
-proc any*: TPeg {.inline.} =
-  ## constructs the PEG `any character`:idx: (``.``)
-  result.kind = pkAny
-
-proc anyRune*: TPeg {.inline.} =
-  ## constructs the PEG `any rune`:idx: (``_``)
-  result.kind = pkAnyRune
-
-proc newLine*: TPeg {.inline.} =
-  ## constructs the PEG `newline`:idx: (``\n``)
-  result.kind = pkNewline
-
-proc UnicodeLetter*: TPeg {.inline.} = 
-  ## constructs the PEG ``\letter`` which matches any Unicode letter.
-  result.kind = pkLetter
-  
-proc UnicodeLower*: TPeg {.inline.} = 
-  ## constructs the PEG ``\lower`` which matches any Unicode lowercase letter.
-  result.kind = pkLower 
-
-proc UnicodeUpper*: TPeg {.inline.} = 
-  ## constructs the PEG ``\upper`` which matches any Unicode lowercase letter.
-  result.kind = pkUpper 
-  
-proc UnicodeTitle*: TPeg {.inline.} = 
-  ## constructs the PEG ``\title`` which matches any Unicode title letter.
-  result.kind = pkTitle
-
-proc UnicodeWhitespace*: TPeg {.inline.} = 
-  ## constructs the PEG ``\white`` which matches any Unicode 
-  ## whitespace character.
-  result.kind = pkWhitespace
-
-proc startAnchor*: TPeg {.inline.} = 
-  ## constructs the PEG ``^`` which matches the start of the input.  
-  result.kind = pkStartAnchor
-
-proc endAnchor*: TPeg {.inline.} = 
-  ## constructs the PEG ``$`` which matches the end of the input.  
-  result = !any()
-
-proc capture*(a: TPeg): TPeg {.rtl, extern: "npegsCapture".} =
-  ## constructs a capture with the PEG `a`
-  result.kind = pkCapture
-  result.sons = @[a]
-
-proc backref*(index: range[1..MaxSubPatterns]): TPeg {.
-  rtl, extern: "npegs$1".} = 
-  ## constructs a back reference of the given `index`. `index` starts counting
-  ## from 1.
-  result.kind = pkBackRef
-  result.index = index-1
-
-proc backrefIgnoreCase*(index: range[1..MaxSubPatterns]): TPeg {.
-  rtl, extern: "npegs$1".} = 
-  ## constructs a back reference of the given `index`. `index` starts counting
-  ## from 1. Ignores case for matching.
-  result.kind = pkBackRefIgnoreCase
-  result.index = index-1
-
-proc backrefIgnoreStyle*(index: range[1..MaxSubPatterns]): TPeg {.
-  rtl, extern: "npegs$1".}= 
-  ## constructs a back reference of the given `index`. `index` starts counting
-  ## from 1. Ignores style for matching.
-  result.kind = pkBackRefIgnoreStyle
-  result.index = index-1
-
-proc spaceCost(n: TPeg): int =
-  case n.kind
-  of pkEmpty: nil
-  of pkTerminal, pkTerminalIgnoreCase, pkTerminalIgnoreStyle, pkChar,
-     pkGreedyRepChar, pkCharChoice, pkGreedyRepSet, 
-     pkAny..pkWhitespace, pkGreedyAny:
-    result = 1
-  of pkNonTerminal:
-    # we cannot inline a rule with a non-terminal
-    result = InlineThreshold+1
-  else:
-    for i in 0..n.len-1:
-      inc(result, spaceCost(n.sons[i]))
-      if result >= InlineThreshold: break
-
-proc nonterminal*(n: PNonTerminal): TPeg {.
-  rtl, extern: "npegs$1".} = 
-  ## constructs a PEG that consists of the nonterminal symbol
-  assert n != nil
-  if ntDeclared in n.flags and spaceCost(n.rule) < InlineThreshold:
-    when false: echo "inlining symbol: ", n.name
-    result = n.rule # inlining of rule enables better optimizations
-  else:
-    result.kind = pkNonTerminal
-    result.nt = n
-
-proc newNonTerminal*(name: string, line, column: int): PNonTerminal {.
-  rtl, extern: "npegs$1".} =
-  ## constructs a nonterminal symbol
-  new(result)
-  result.name = name
-  result.line = line
-  result.col = column
-
-template letters*: expr =
-  ## expands to ``charset({'A'..'Z', 'a'..'z'})``
-  charset({'A'..'Z', 'a'..'z'})
-  
-template digits*: expr =
-  ## expands to ``charset({'0'..'9'})``
-  charset({'0'..'9'})
-
-template whitespace*: expr =
-  ## expands to ``charset({' ', '\9'..'\13'})``
-  charset({' ', '\9'..'\13'})
-  
-template identChars*: expr =
-  ## expands to ``charset({'a'..'z', 'A'..'Z', '0'..'9', '_'})``
-  charset({'a'..'z', 'A'..'Z', '0'..'9', '_'})
-  
-template identStartChars*: expr =
-  ## expands to ``charset({'A'..'Z', 'a'..'z', '_'})``
-  charset({'a'..'z', 'A'..'Z', '_'})
-
-template ident*: expr =
-  ## same as ``[a-zA-Z_][a-zA-z_0-9]*``; standard identifier
-  sequence(charset({'a'..'z', 'A'..'Z', '_'}),
-           *charset({'a'..'z', 'A'..'Z', '0'..'9', '_'}))
-  
-template natural*: expr =
-  ## same as ``\d+``
-  +digits
-
-# ------------------------- debugging -----------------------------------------
-
-proc esc(c: char, reserved = {'\0'..'\255'}): string = 
-  case c
-  of '\b': result = "\\b"
-  of '\t': result = "\\t"
-  of '\c': result = "\\c"
-  of '\L': result = "\\l"
-  of '\v': result = "\\v"
-  of '\f': result = "\\f"
-  of '\e': result = "\\e"
-  of '\a': result = "\\a"
-  of '\\': result = "\\\\"
-  of 'a'..'z', 'A'..'Z', '0'..'9', '_': result = $c
-  elif c < ' ' or c >= '\128': result = '\\' & $ord(c)
-  elif c in reserved: result = '\\' & c
-  else: result = $c
-  
-proc singleQuoteEsc(c: Char): string = return "'" & esc(c, {'\''}) & "'"
-
-proc singleQuoteEsc(str: string): string = 
-  result = "'"
-  for c in items(str): add result, esc(c, {'\''})
-  add result, '\''
-  
-proc charSetEscAux(cc: set[char]): string = 
-  const reserved = {'^', '-', ']'}
-  result = ""
-  var c1 = 0
-  while c1 <= 0xff: 
-    if chr(c1) in cc: 
-      var c2 = c1
-      while c2 < 0xff and chr(succ(c2)) in cc: inc(c2)
-      if c1 == c2: 
-        add result, esc(chr(c1), reserved)
-      elif c2 == succ(c1): 
-        add result, esc(chr(c1), reserved) & esc(chr(c2), reserved)
-      else: 
-        add result, esc(chr(c1), reserved) & '-' & esc(chr(c2), reserved)
-      c1 = c2
-    inc(c1)
-  
-proc CharSetEsc(cc: set[char]): string =
-  if card(cc) >= 128+64: 
-    result = "[^" & CharSetEscAux({'\1'..'\xFF'} - cc) & ']'
-  else: 
-    result = '[' & CharSetEscAux(cc) & ']'
-  
-proc toStrAux(r: TPeg, res: var string) = 
-  case r.kind
-  of pkEmpty: add(res, "()")
-  of pkAny: add(res, '.')
-  of pkAnyRune: add(res, '_')
-  of pkLetter: add(res, "\\letter")
-  of pkLower: add(res, "\\lower")
-  of pkUpper: add(res, "\\upper")
-  of pkTitle: add(res, "\\title")
-  of pkWhitespace: add(res, "\\white")
-
-  of pkNewline: add(res, "\\n")
-  of pkTerminal: add(res, singleQuoteEsc(r.term))
-  of pkTerminalIgnoreCase:
-    add(res, 'i')
-    add(res, singleQuoteEsc(r.term))
-  of pkTerminalIgnoreStyle:
-    add(res, 'y')
-    add(res, singleQuoteEsc(r.term))
-  of pkChar: add(res, singleQuoteEsc(r.ch))
-  of pkCharChoice: add(res, charSetEsc(r.charChoice[]))
-  of pkNonTerminal: add(res, r.nt.name)
-  of pkSequence:
-    add(res, '(')
-    toStrAux(r.sons[0], res)
-    for i in 1 .. high(r.sons):
-      add(res, ' ')
-      toStrAux(r.sons[i], res)
-    add(res, ')')
-  of pkOrderedChoice:
-    add(res, '(')
-    toStrAux(r.sons[0], res)
-    for i in 1 .. high(r.sons):
-      add(res, " / ")
-      toStrAux(r.sons[i], res)
-    add(res, ')')
-  of pkGreedyRep:
-    toStrAux(r.sons[0], res)
-    add(res, '*')
-  of pkGreedyRepChar:
-    add(res, singleQuoteEsc(r.ch))
-    add(res, '*')
-  of pkGreedyRepSet:
-    add(res, charSetEsc(r.charChoice[]))
-    add(res, '*')
-  of pkGreedyAny:
-    add(res, ".*")
-  of pkOption:
-    toStrAux(r.sons[0], res)
-    add(res, '?')
-  of pkAndPredicate:
-    add(res, '&')
-    toStrAux(r.sons[0], res)
-  of pkNotPredicate:
-    add(res, '!')
-    toStrAux(r.sons[0], res)
-  of pkSearch:
-    add(res, '@')
-    toStrAux(r.sons[0], res)
-  of pkCapturedSearch:
-    add(res, "{@}")
-    toStrAux(r.sons[0], res)
-  of pkCapture:
-    add(res, '{')
-    toStrAux(r.sons[0], res)    
-    add(res, '}')
-  of pkBackRef: 
-    add(res, '$')
-    add(res, $r.index)
-  of pkBackRefIgnoreCase: 
-    add(res, "i$")
-    add(res, $r.index)
-  of pkBackRefIgnoreStyle: 
-    add(res, "y$")
-    add(res, $r.index)
-  of pkRule:
-    toStrAux(r.sons[0], res)    
-    add(res, " <- ")
-    toStrAux(r.sons[1], res)
-  of pkList:
-    for i in 0 .. high(r.sons):
-      toStrAux(r.sons[i], res)
-      add(res, "\n")  
-  of pkStartAnchor:
-    add(res, '^')
-
-proc `$` *(r: TPeg): string {.rtl, extern: "npegsToString".} =
-  ## converts a PEG to its string representation
-  result = ""
-  toStrAux(r, result)
-
-# --------------------- core engine -------------------------------------------
-
-type
-  TCaptures* {.final.} = object ## contains the captured substrings.
-    matches: array[0..maxSubpatterns-1, tuple[first, last: int]]
-    ml: int
-    origStart: int
-
-proc bounds*(c: TCaptures, 
-             i: range[0..maxSubpatterns-1]): tuple[first, last: int] = 
-  ## returns the bounds ``[first..last]`` of the `i`'th capture.
-  result = c.matches[i]
-
-when not useUnicode:
-  type
-    TRune = char
-  template fastRuneAt(s, i, ch: expr) =
-    ch = s[i]
-    inc(i)
-  template runeLenAt(s, i: expr): expr = 1
-
-  proc isAlpha(a: char): bool {.inline.} = return a in {'a'..'z','A'..'Z'}
-  proc isUpper(a: char): bool {.inline.} = return a in {'A'..'Z'}
-  proc isLower(a: char): bool {.inline.} = return a in {'a'..'z'}
-  proc isTitle(a: char): bool {.inline.} = return false
-  proc isWhiteSpace(a: char): bool {.inline.} = return a in {' ', '\9'..'\13'}
-
-proc rawMatch*(s: string, p: TPeg, start: int, c: var TCaptures): int {.
-               rtl, extern: "npegs$1".} =
-  ## low-level matching proc that implements the PEG interpreter. Use this 
-  ## for maximum efficiency (every other PEG operation ends up calling this
-  ## proc).
-  ## Returns -1 if it does not match, else the length of the match
-  case p.kind
-  of pkEmpty: result = 0 # match of length 0
-  of pkAny:
-    if s[start] != '\0': result = 1
-    else: result = -1
-  of pkAnyRune:
-    if s[start] != '\0':
-      result = runeLenAt(s, start)
-    else:
-      result = -1
-  of pkLetter: 
-    if s[start] != '\0':
-      var a: TRune
-      result = start
-      fastRuneAt(s, result, a)
-      if isAlpha(a): dec(result, start)
-      else: result = -1
-    else:
-      result = -1
-  of pkLower: 
-    if s[start] != '\0':
-      var a: TRune
-      result = start
-      fastRuneAt(s, result, a)
-      if isLower(a): dec(result, start)
-      else: result = -1
-    else:
-      result = -1
-  of pkUpper: 
-    if s[start] != '\0':
-      var a: TRune
-      result = start
-      fastRuneAt(s, result, a)
-      if isUpper(a): dec(result, start)
-      else: result = -1
-    else:
-      result = -1
-  of pkTitle: 
-    if s[start] != '\0':
-      var a: TRune
-      result = start
-      fastRuneAt(s, result, a)
-      if isTitle(a): dec(result, start) 
-      else: result = -1
-    else:
-      result = -1
-  of pkWhitespace: 
-    if s[start] != '\0':
-      var a: TRune
-      result = start
-      fastRuneAt(s, result, a)
-      if isWhitespace(a): dec(result, start)
-      else: result = -1
-    else:
-      result = -1
-  of pkGreedyAny:
-    result = len(s) - start
-  of pkNewLine:
-    if s[start] == '\L': result = 1
-    elif s[start] == '\C':
-      if s[start+1] == '\L': result = 2
-      else: result = 1
-    else: result = -1
-  of pkTerminal:
-    result = len(p.term)
-    for i in 0..result-1:
-      if p.term[i] != s[start+i]:
-        result = -1
-        break
-  of pkTerminalIgnoreCase:
-    var
-      i = 0
-      a, b: TRune
-    result = start
-    while i < len(p.term):
-      fastRuneAt(p.term, i, a)
-      fastRuneAt(s, result, b)
-      if toLower(a) != toLower(b):
-        result = -1
-        break
-    dec(result, start)
-  of pkTerminalIgnoreStyle:
-    var
-      i = 0
-      a, b: TRune
-    result = start
-    while i < len(p.term):
-      while true:
-        fastRuneAt(p.term, i, a)
-        if a != TRune('_'): break
-      while true:
-        fastRuneAt(s, result, b)
-        if b != TRune('_'): break
-      if toLower(a) != toLower(b):
-        result = -1
-        break
-    dec(result, start)
-  of pkChar:
-    if p.ch == s[start]: result = 1
-    else: result = -1
-  of pkCharChoice:
-    if contains(p.charChoice[], s[start]): result = 1
-    else: result = -1
-  of pkNonTerminal:
-    var oldMl = c.ml
-    when false: echo "enter: ", p.nt.name
-    result = rawMatch(s, p.nt.rule, start, c)
-    when false: echo "leave: ", p.nt.name
-    if result < 0: c.ml = oldMl
-  of pkSequence:
-    var oldMl = c.ml  
-    result = 0
-    assert(not isNil(p.sons))
-    for i in 0..high(p.sons):
-      var x = rawMatch(s, p.sons[i], start+result, c)
-      if x < 0:
-        c.ml = oldMl
-        result = -1
-        break
-      else: inc(result, x)
-  of pkOrderedChoice:
-    var oldMl = c.ml
-    for i in 0..high(p.sons):
-      result = rawMatch(s, p.sons[i], start, c)
-      if result >= 0: break
-      c.ml = oldMl
-  of pkSearch:
-    var oldMl = c.ml
-    result = 0
-    while start+result < s.len:
-      var x = rawMatch(s, p.sons[0], start+result, c)
-      if x >= 0:
-        inc(result, x)
-        return
-      inc(result)
-    result = -1
-    c.ml = oldMl
-  of pkCapturedSearch:
-    var idx = c.ml # reserve a slot for the subpattern
-    inc(c.ml)
-    result = 0
-    while start+result < s.len:
-      var x = rawMatch(s, p.sons[0], start+result, c)
-      if x >= 0:
-        if idx < maxSubpatterns:
-          c.matches[idx] = (start, start+result-1)
-        #else: silently ignore the capture
-        inc(result, x)
-        return
-      inc(result)
-    result = -1
-    c.ml = idx
-  of pkGreedyRep:
-    result = 0
-    while true:
-      var x = rawMatch(s, p.sons[0], start+result, c)
-      # if x == 0, we have an endless loop; so the correct behaviour would be
-      # not to break. But endless loops can be easily introduced:
-      # ``(comment / \w*)*`` is such an example. Breaking for x == 0 does the
-      # expected thing in this case.
-      if x <= 0: break
-      inc(result, x)
-  of pkGreedyRepChar:
-    result = 0
-    var ch = p.ch
-    while ch == s[start+result]: inc(result)
-  of pkGreedyRepSet:
-    result = 0
-    while contains(p.charChoice[], s[start+result]): inc(result)
-  of pkOption:
-    result = max(0, rawMatch(s, p.sons[0], start, c))
-  of pkAndPredicate:
-    var oldMl = c.ml
-    result = rawMatch(s, p.sons[0], start, c)
-    if result >= 0: result = 0 # do not consume anything
-    else: c.ml = oldMl
-  of pkNotPredicate:
-    var oldMl = c.ml
-    result = rawMatch(s, p.sons[0], start, c)
-    if result < 0: result = 0
-    else:
-      c.ml = oldMl
-      result = -1
-  of pkCapture:
-    var idx = c.ml # reserve a slot for the subpattern
-    inc(c.ml)
-    result = rawMatch(s, p.sons[0], start, c)
-    if result >= 0:
-      if idx < maxSubpatterns:
-        c.matches[idx] = (start, start+result-1)
-      #else: silently ignore the capture
-    else:
-      c.ml = idx
-  of pkBackRef..pkBackRefIgnoreStyle: 
-    if p.index >= c.ml: return -1
-    var (a, b) = c.matches[p.index]
-    var n: TPeg
-    n.kind = succ(pkTerminal, ord(p.kind)-ord(pkBackRef)) 
-    n.term = s.substr(a, b)
-    result = rawMatch(s, n, start, c)
-  of pkStartAnchor:
-    if c.origStart == start: result = 0
-    else: result = -1
-  of pkRule, pkList: assert false
-
-proc match*(s: string, pattern: TPeg, matches: var openarray[string],
-            start = 0): bool {.rtl, extern: "npegs$1Capture".} =
-  ## returns ``true`` if ``s[start..]`` matches the ``pattern`` and
-  ## the captured substrings in the array ``matches``. If it does not
-  ## match, nothing is written into ``matches`` and ``false`` is
-  ## returned.
-  var c: TCaptures
-  c.origStart = start
-  result = rawMatch(s, pattern, start, c) == len(s) -start
-  if result:
-    for i in 0..c.ml-1:
-      matches[i] = substr(s, c.matches[i][0], c.matches[i][1])
-
-proc match*(s: string, pattern: TPeg, 
-            start = 0): bool {.rtl, extern: "npegs$1".} =
-  ## returns ``true`` if ``s`` matches the ``pattern`` beginning from ``start``.
-  var c: TCaptures
-  c.origStart = start
-  result = rawMatch(s, pattern, start, c) == len(s)-start
-
-proc matchLen*(s: string, pattern: TPeg, matches: var openarray[string],
-               start = 0): int {.rtl, extern: "npegs$1Capture".} =
-  ## the same as ``match``, but it returns the length of the match,
-  ## if there is no match, -1 is returned. Note that a match length
-  ## of zero can happen. It's possible that a suffix of `s` remains
-  ## that does not belong to the match.
-  var c: TCaptures
-  c.origStart = start
-  result = rawMatch(s, pattern, start, c)
-  if result >= 0:
-    for i in 0..c.ml-1:
-      matches[i] = substr(s, c.matches[i][0], c.matches[i][1])
-
-proc matchLen*(s: string, pattern: TPeg, 
-               start = 0): int {.rtl, extern: "npegs$1".} =
-  ## the same as ``match``, but it returns the length of the match,
-  ## if there is no match, -1 is returned. Note that a match length
-  ## of zero can happen. It's possible that a suffix of `s` remains
-  ## that does not belong to the match.
-  var c: TCaptures
-  c.origStart = start
-  result = rawMatch(s, pattern, start, c)
-
-proc find*(s: string, pattern: TPeg, matches: var openarray[string],
-           start = 0): int {.rtl, extern: "npegs$1Capture".} =
-  ## returns the starting position of ``pattern`` in ``s`` and the captured
-  ## substrings in the array ``matches``. If it does not match, nothing
-  ## is written into ``matches`` and -1 is returned.
-  for i in start .. s.len-1:
-    if matchLen(s, pattern, matches, i) >= 0: return i
-  return -1
-  # could also use the pattern here: (!P .)* P
-  
-proc findBounds*(s: string, pattern: TPeg, matches: var openarray[string],
-                 start = 0): tuple[first, last: int] {.
-                 rtl, extern: "npegs$1Capture".} =
-  ## returns the starting position and end position of ``pattern`` in ``s`` 
-  ## and the captured
-  ## substrings in the array ``matches``. If it does not match, nothing
-  ## is written into ``matches`` and (-1,0) is returned.
-  for i in start .. s.len-1:
-    var L = matchLen(s, pattern, matches, i)
-    if L >= 0: return (i, i+L-1)
-  return (-1, 0)
-  
-proc find*(s: string, pattern: TPeg, 
-           start = 0): int {.rtl, extern: "npegs$1".} =
-  ## returns the starting position of ``pattern`` in ``s``. If it does not
-  ## match, -1 is returned.
-  for i in start .. s.len-1:
-    if matchLen(s, pattern, i) >= 0: return i
-  return -1
-  
-iterator findAll*(s: string, pattern: TPeg, start = 0): string = 
-  ## yields all matching captures of pattern in `s`.
-  var matches: array[0..MaxSubpatterns-1, string]
-  var i = start
-  while i < s.len:
-    var L = matchLen(s, pattern, matches, i)
-    if L < 0: break
-    for k in 0..maxSubPatterns-1: 
-      if isNil(matches[k]): break
-      yield matches[k]
-    inc(i, L)
-    
-proc findAll*(s: string, pattern: TPeg, start = 0): seq[string] {.
-  rtl, extern: "npegs$1".} = 
-  ## returns all matching captures of pattern in `s`.
-  ## If it does not match, @[] is returned.
-  accumulateResult(findAll(s, pattern, start))
-  
-template `=~`*(s: string, pattern: TPeg): expr =
-  ## This calls ``match`` with an implicit declared ``matches`` array that 
-  ## can be used in the scope of the ``=~`` call: 
-  ## 
-  ## .. code-block:: nimrod
-  ##
-  ##   if line =~ peg"\s* {\w+} \s* '=' \s* {\w+}": 
-  ##     # matches a key=value pair:
-  ##     echo("Key: ", matches[0])
-  ##     echo("Value: ", matches[1])
-  ##   elif line =~ peg"\s*{'#'.*}":
-  ##     # matches a comment
-  ##     # note that the implicit ``matches`` array is different from the
-  ##     # ``matches`` array of the first branch
-  ##     echo("comment: ", matches[0])
-  ##   else:
-  ##     echo("syntax error")
-  ##  
-  when not definedInScope(matches):
-    var matches {.inject.}: array[0..maxSubpatterns-1, string]
-  match(s, pattern, matches)
-
-# ------------------------- more string handling ------------------------------
-
-proc contains*(s: string, pattern: TPeg, start = 0): bool {.
-  rtl, extern: "npegs$1".} =
-  ## same as ``find(s, pattern, start) >= 0``
-  return find(s, pattern, start) >= 0
-
-proc contains*(s: string, pattern: TPeg, matches: var openArray[string],
-              start = 0): bool {.rtl, extern: "npegs$1Capture".} =
-  ## same as ``find(s, pattern, matches, start) >= 0``
-  return find(s, pattern, matches, start) >= 0
-
-proc startsWith*(s: string, prefix: TPeg, start = 0): bool {.
-  rtl, extern: "npegs$1".} =
-  ## returns true if `s` starts with the pattern `prefix`
-  result = matchLen(s, prefix, start) >= 0
-
-proc endsWith*(s: string, suffix: TPeg, start = 0): bool {.
-  rtl, extern: "npegs$1".} =
-  ## returns true if `s` ends with the pattern `prefix`
-  for i in start .. s.len-1:
-    if matchLen(s, suffix, i) == s.len - i: return true
-
-proc replacef*(s: string, sub: TPeg, by: string): string {.
-  rtl, extern: "npegs$1".} =
-  ## Replaces `sub` in `s` by the string `by`. Captures can be accessed in `by`
-  ## with the notation ``$i`` and ``$#`` (see strutils.`%`). Examples:
-  ##
-  ## .. code-block:: nimrod
-  ##   "var1=key; var2=key2".replace(peg"{\ident}'='{\ident}", "$1<-$2$2")
-  ##
-  ## Results in:
-  ##
-  ## .. code-block:: nimrod
-  ##
-  ##   "var1<-keykey; val2<-key2key2"
-  result = ""
-  var i = 0
-  var caps: array[0..maxSubpatterns-1, string]
-  while i < s.len:
-    var x = matchLen(s, sub, caps, i)
-    if x <= 0:
-      add(result, s[i])
-      inc(i)
-    else:
-      addf(result, by, caps)
-      inc(i, x)
-  add(result, substr(s, i))
-
-proc replace*(s: string, sub: TPeg, by = ""): string {.
-  rtl, extern: "npegs$1".} =
-  ## Replaces `sub` in `s` by the string `by`. Captures cannot be accessed
-  ## in `by`.
-  result = ""
-  var i = 0
-  var caps: array[0..maxSubpatterns-1, string]
-  while i < s.len:
-    var x = matchLen(s, sub, caps, i)
-    if x <= 0:
-      add(result, s[i])
-      inc(i)
-    else:
-      addf(result, by, caps)
-      inc(i, x)
-  add(result, substr(s, i))
-  
-proc parallelReplace*(s: string, subs: varargs[
-                      tuple[pattern: TPeg, repl: string]]): string {.
-                      rtl, extern: "npegs$1".} = 
-  ## Returns a modified copy of `s` with the substitutions in `subs`
-  ## applied in parallel.
-  result = ""
-  var i = 0
-  var caps: array[0..maxSubpatterns-1, string]
-  while i < s.len:
-    block searchSubs:
-      for j in 0..high(subs):
-        var x = matchLen(s, subs[j][0], caps, i)
-        if x > 0:
-          addf(result, subs[j][1], caps)
-          inc(i, x)
-          break searchSubs
-      add(result, s[i])
-      inc(i)
-  # copy the rest:
-  add(result, substr(s, i))  
-  
-proc transformFile*(infile, outfile: string,
-                    subs: varargs[tuple[pattern: TPeg, repl: string]]) {.
-                    rtl, extern: "npegs$1".} =
-  ## reads in the file `infile`, performs a parallel replacement (calls
-  ## `parallelReplace`) and writes back to `outfile`. Calls ``quit`` if an
-  ## error occurs. This is supposed to be used for quick scripting.
-  var x = readFile(infile)
-  if not isNil(x):
-    var f: TFile
-    if open(f, outfile, fmWrite):
-      write(f, x.parallelReplace(subs))
-      close(f)
-    else:
-      quit("cannot open for writing: " & outfile)
-  else:
-    quit("cannot open for reading: " & infile)
-  
-iterator split*(s: string, sep: TPeg): string =
-  ## Splits the string `s` into substrings.
-  ##
-  ## Substrings are separated by the PEG `sep`.
-  ## Examples:
-  ##
-  ## .. code-block:: nimrod
-  ##   for word in split("00232this02939is39an22example111", peg"\d+"):
-  ##     writeln(stdout, word)
-  ##
-  ## Results in:
-  ##
-  ## .. code-block:: nimrod
-  ##   "this"
-  ##   "is"
-  ##   "an"
-  ##   "example"
-  ##
-  var
-    first = 0
-    last = 0
-  while last < len(s):
-    var x = matchLen(s, sep, last)
-    if x > 0: inc(last, x)
-    first = last
-    while last < len(s):
-      inc(last)
-      x = matchLen(s, sep, last)
-      if x > 0: break
-    if first < last:
-      yield substr(s, first, last-1)
-
-proc split*(s: string, sep: TPeg): seq[string] {.
-  rtl, extern: "npegs$1".} =
-  ## Splits the string `s` into substrings.
-  accumulateResult(split(s, sep))
-
-# ------------------- scanner -------------------------------------------------
-
-type
-  TModifier = enum
-    modNone,
-    modVerbatim,
-    modIgnoreCase,
-    modIgnoreStyle
-  TTokKind = enum       ## enumeration of all tokens
-    tkInvalid,          ## invalid token
-    tkEof,              ## end of file reached
-    tkAny,              ## .
-    tkAnyRune,          ## _
-    tkIdentifier,       ## abc
-    tkStringLit,        ## "abc" or 'abc'
-    tkCharSet,          ## [^A-Z]
-    tkParLe,            ## '('
-    tkParRi,            ## ')'
-    tkCurlyLe,          ## '{'
-    tkCurlyRi,          ## '}'
-    tkCurlyAt,          ## '{@}'
-    tkArrow,            ## '<-'
-    tkBar,              ## '/'
-    tkStar,             ## '*'
-    tkPlus,             ## '+'
-    tkAmp,              ## '&'
-    tkNot,              ## '!'
-    tkOption,           ## '?'
-    tkAt,               ## '@'
-    tkBuiltin,          ## \identifier
-    tkEscaped,          ## \\
-    tkBackref,          ## '$'
-    tkDollar,           ## '$'
-    tkHat               ## '^'
-  
-  TToken {.final.} = object  ## a token
-    kind: TTokKind           ## the type of the token
-    modifier: TModifier
-    literal: string          ## the parsed (string) literal
-    charset: set[char]       ## if kind == tkCharSet
-    index: int               ## if kind == tkBackref
-  
-  TPegLexer {.inheritable.} = object          ## the lexer object.
-    bufpos: int               ## the current position within the buffer
-    buf: cstring              ## the buffer itself
-    LineNumber: int           ## the current line number
-    lineStart: int            ## index of last line start in buffer
-    colOffset: int            ## column to add
-    filename: string
-
-const
-  tokKindToStr: array[TTokKind, string] = [
-    "invalid", "[EOF]", ".", "_", "identifier", "string literal",
-    "character set", "(", ")", "{", "}", "{@}",
-    "<-", "/", "*", "+", "&", "!", "?",
-    "@", "built-in", "escaped", "$", "$", "^"
-  ]
-
-proc HandleCR(L: var TPegLexer, pos: int): int =
-  assert(L.buf[pos] == '\c')
-  inc(L.linenumber)
-  result = pos+1
-  if L.buf[result] == '\L': inc(result)
-  L.lineStart = result
-
-proc HandleLF(L: var TPegLexer, pos: int): int =
-  assert(L.buf[pos] == '\L')
-  inc(L.linenumber)
-  result = pos+1
-  L.lineStart = result
-
-proc init(L: var TPegLexer, input, filename: string, line = 1, col = 0) = 
-  L.buf = input
-  L.bufpos = 0
-  L.lineNumber = line
-  L.colOffset = col
-  L.lineStart = 0
-  L.filename = filename
-
-proc getColumn(L: TPegLexer): int {.inline.} = 
-  result = abs(L.bufpos - L.lineStart) + L.colOffset
-
-proc getLine(L: TPegLexer): int {.inline.} = 
-  result = L.linenumber
-  
-proc errorStr(L: TPegLexer, msg: string, line = -1, col = -1): string =
-  var line = if line < 0: getLine(L) else: line
-  var col = if col < 0: getColumn(L) else: col
-  result = "$1($2, $3) Error: $4" % [L.filename, $line, $col, msg]
-
-proc handleHexChar(c: var TPegLexer, xi: var int) = 
-  case c.buf[c.bufpos]
-  of '0'..'9': 
-    xi = (xi shl 4) or (ord(c.buf[c.bufpos]) - ord('0'))
-    inc(c.bufpos)
-  of 'a'..'f': 
-    xi = (xi shl 4) or (ord(c.buf[c.bufpos]) - ord('a') + 10)
-    inc(c.bufpos)
-  of 'A'..'F': 
-    xi = (xi shl 4) or (ord(c.buf[c.bufpos]) - ord('A') + 10)
-    inc(c.bufpos)
-  else: nil
-
-proc getEscapedChar(c: var TPegLexer, tok: var TToken) = 
-  inc(c.bufpos)
-  case c.buf[c.bufpos]
-  of 'r', 'R', 'c', 'C': 
-    add(tok.literal, '\c')
-    Inc(c.bufpos)
-  of 'l', 'L': 
-    add(tok.literal, '\L')
-    Inc(c.bufpos)
-  of 'f', 'F': 
-    add(tok.literal, '\f')
-    inc(c.bufpos)
-  of 'e', 'E': 
-    add(tok.literal, '\e')
-    Inc(c.bufpos)
-  of 'a', 'A': 
-    add(tok.literal, '\a')
-    Inc(c.bufpos)
-  of 'b', 'B': 
-    add(tok.literal, '\b')
-    Inc(c.bufpos)
-  of 'v', 'V': 
-    add(tok.literal, '\v')
-    Inc(c.bufpos)
-  of 't', 'T': 
-    add(tok.literal, '\t')
-    Inc(c.bufpos)
-  of 'x', 'X': 
-    inc(c.bufpos)
-    var xi = 0
-    handleHexChar(c, xi)
-    handleHexChar(c, xi)
-    if xi == 0: tok.kind = tkInvalid
-    else: add(tok.literal, Chr(xi))
-  of '0'..'9': 
-    var val = ord(c.buf[c.bufpos]) - ord('0')
-    Inc(c.bufpos)
-    var i = 1
-    while (i <= 3) and (c.buf[c.bufpos] in {'0'..'9'}): 
-      val = val * 10 + ord(c.buf[c.bufpos]) - ord('0')
-      inc(c.bufpos)
-      inc(i)
-    if val > 0 and val <= 255: add(tok.literal, chr(val))
-    else: tok.kind = tkInvalid
-  of '\0'..'\31':
-    tok.kind = tkInvalid
-  elif c.buf[c.bufpos] in strutils.letters:
-    tok.kind = tkInvalid
-  else:
-    add(tok.literal, c.buf[c.bufpos])
-    Inc(c.bufpos)
-  
-proc skip(c: var TPegLexer) = 
-  var pos = c.bufpos
-  var buf = c.buf
-  while true: 
-    case buf[pos]
-    of ' ', '\t': 
-      Inc(pos)
-    of '#':
-      while not (buf[pos] in {'\c', '\L', '\0'}): inc(pos)
-    of '\c':
-      pos = HandleCR(c, pos)
-      buf = c.buf
-    of '\L': 
-      pos = HandleLF(c, pos)
-      buf = c.buf
-    else: 
-      break                   # EndOfFile also leaves the loop
-  c.bufpos = pos
-  
-proc getString(c: var TPegLexer, tok: var TToken) = 
-  tok.kind = tkStringLit
-  var pos = c.bufPos + 1
-  var buf = c.buf
-  var quote = buf[pos-1]
-  while true: 
-    case buf[pos]
-    of '\\':
-      c.bufpos = pos
-      getEscapedChar(c, tok)
-      pos = c.bufpos
-    of '\c', '\L', '\0':
-      tok.kind = tkInvalid
-      break
-    elif buf[pos] == quote:
-      inc(pos)
-      break      
-    else:
-      add(tok.literal, buf[pos])
-      Inc(pos)
-  c.bufpos = pos
-  
-proc getDollar(c: var TPegLexer, tok: var TToken) = 
-  var pos = c.bufPos + 1
-  var buf = c.buf
-  if buf[pos] in {'0'..'9'}:
-    tok.kind = tkBackref
-    tok.index = 0
-    while buf[pos] in {'0'..'9'}:
-      tok.index = tok.index * 10 + ord(buf[pos]) - ord('0')
-      inc(pos)
-  else:
-    tok.kind = tkDollar
-  c.bufpos = pos
-  
-proc getCharSet(c: var TPegLexer, tok: var TToken) = 
-  tok.kind = tkCharSet
-  tok.charset = {}
-  var pos = c.bufPos + 1
-  var buf = c.buf
-  var caret = false
-  if buf[pos] == '^':
-    inc(pos)
-    caret = true
-  while true:
-    var ch: char
-    case buf[pos]
-    of ']':
-      inc(pos)
-      break
-    of '\\':
-      c.bufpos = pos
-      getEscapedChar(c, tok)
-      pos = c.bufpos
-      ch = tok.literal[tok.literal.len-1]
-    of '\C', '\L', '\0':
-      tok.kind = tkInvalid
-      break
-    else: 
-      ch = buf[pos]
-      Inc(pos)
-    incl(tok.charset, ch)
-    if buf[pos] == '-':
-      if buf[pos+1] == ']':
-        incl(tok.charset, '-')
-        inc(pos)
-      else:
-        inc(pos)
-        var ch2: char
-        case buf[pos]
-        of '\\':
-          c.bufpos = pos
-          getEscapedChar(c, tok)
-          pos = c.bufpos
-          ch2 = tok.literal[tok.literal.len-1]
-        of '\C', '\L', '\0':
-          tok.kind = tkInvalid
-          break
-        else: 
-          ch2 = buf[pos]
-          Inc(pos)
-        for i in ord(ch)+1 .. ord(ch2):
-          incl(tok.charset, chr(i))
-  c.bufpos = pos
-  if caret: tok.charset = {'\1'..'\xFF'} - tok.charset
-  
-proc getSymbol(c: var TPegLexer, tok: var TToken) = 
-  var pos = c.bufpos
-  var buf = c.buf
-  while true: 
-    add(tok.literal, buf[pos])
-    Inc(pos)
-    if buf[pos] notin strutils.IdentChars: break
-  c.bufpos = pos
-  tok.kind = tkIdentifier
-
-proc getBuiltin(c: var TPegLexer, tok: var TToken) =
-  if c.buf[c.bufpos+1] in strutils.Letters:
-    inc(c.bufpos)
-    getSymbol(c, tok)
-    tok.kind = tkBuiltin
-  else:
-    tok.kind = tkEscaped
-    getEscapedChar(c, tok) # may set tok.kind to tkInvalid
-
-proc getTok(c: var TPegLexer, tok: var TToken) = 
-  tok.kind = tkInvalid
-  tok.modifier = modNone
-  setlen(tok.literal, 0)
-  skip(c)
-  case c.buf[c.bufpos]
-  of '{':
-    inc(c.bufpos)
-    if c.buf[c.bufpos] == '@' and c.buf[c.bufpos+1] == '}':
-      tok.kind = tkCurlyAt
-      inc(c.bufpos, 2)
-      add(tok.literal, "{@}")
-    else:
-      tok.kind = tkCurlyLe
-      add(tok.literal, '{')
-  of '}': 
-    tok.kind = tkCurlyRi
-    inc(c.bufpos)
-    add(tok.literal, '}')
-  of '[': 
-    getCharset(c, tok)
-  of '(':
-    tok.kind = tkParLe
-    Inc(c.bufpos)
-    add(tok.literal, '(')
-  of ')':
-    tok.kind = tkParRi
-    Inc(c.bufpos)
-    add(tok.literal, ')')
-  of '.': 
-    tok.kind = tkAny
-    inc(c.bufpos)
-    add(tok.literal, '.')
-  of '_':
-    tok.kind = tkAnyRune
-    inc(c.bufpos)
-    add(tok.literal, '_')
-  of '\\': 
-    getBuiltin(c, tok)
-  of '\'', '"': getString(c, tok)
-  of '$': getDollar(c, tok)
-  of '\0': 
-    tok.kind = tkEof
-    tok.literal = "[EOF]"
-  of 'a'..'z', 'A'..'Z', '\128'..'\255':
-    getSymbol(c, tok)
-    if c.buf[c.bufpos] in {'\'', '"'} or 
-        c.buf[c.bufpos] == '$' and c.buf[c.bufpos+1] in {'0'..'9'}:
-      case tok.literal
-      of "i": tok.modifier = modIgnoreCase
-      of "y": tok.modifier = modIgnoreStyle
-      of "v": tok.modifier = modVerbatim
-      else: nil
-      setLen(tok.literal, 0)
-      if c.buf[c.bufpos] == '$':
-        getDollar(c, tok)
-      else:
-        getString(c, tok)
-      if tok.modifier == modNone: tok.kind = tkInvalid
-  of '+':
-    tok.kind = tkPlus
-    inc(c.bufpos)
-    add(tok.literal, '+')
-  of '*':
-    tok.kind = tkStar
-    inc(c.bufpos)
-    add(tok.literal, '+')
-  of '<':
-    if c.buf[c.bufpos+1] == '-':
-      inc(c.bufpos, 2)
-      tok.kind = tkArrow
-      add(tok.literal, "<-")
-    else:
-      add(tok.literal, '<')
-  of '/':
-    tok.kind = tkBar
-    inc(c.bufpos)
-    add(tok.literal, '/')
-  of '?':
-    tok.kind = tkOption
-    inc(c.bufpos)
-    add(tok.literal, '?')
-  of '!':
-    tok.kind = tkNot
-    inc(c.bufpos)
-    add(tok.literal, '!')
-  of '&':
-    tok.kind = tkAmp
-    inc(c.bufpos)
-    add(tok.literal, '!')
-  of '@':
-    tok.kind = tkAt
-    inc(c.bufpos)
-    add(tok.literal, '@')
-    if c.buf[c.bufpos] == '@': 
-      tok.kind = tkCurlyAt
-      inc(c.bufpos)
-      add(tok.literal, '@')
-  of '^':
-    tok.kind = tkHat
-    inc(c.bufpos)
-    add(tok.literal, '^')
-  else:
-    add(tok.literal, c.buf[c.bufpos])
-    inc(c.bufpos)
-
-proc arrowIsNextTok(c: TPegLexer): bool =
-  # the only look ahead we need
-  var pos = c.bufpos
-  while c.buf[pos] in {'\t', ' '}: inc(pos)
-  result = c.buf[pos] == '<' and c.buf[pos+1] == '-'
-
-# ----------------------------- parser ----------------------------------------
-    
-type
-  EInvalidPeg* = object of EInvalidValue ## raised if an invalid
-                                         ## PEG has been detected
-  TPegParser = object of TPegLexer ## the PEG parser object
-    tok: TToken
-    nonterms: seq[PNonTerminal]
-    modifier: TModifier
-    captures: int
-    identIsVerbatim: bool
-    skip: TPeg
-
-proc pegError(p: TPegParser, msg: string, line = -1, col = -1) =
-  var e: ref EInvalidPeg
-  new(e)
-  e.msg = errorStr(p, msg, line, col)
-  raise e
-
-proc getTok(p: var TPegParser) = 
-  getTok(p, p.tok)
-  if p.tok.kind == tkInvalid: pegError(p, "invalid token")
-
-proc eat(p: var TPegParser, kind: TTokKind) =
-  if p.tok.kind == kind: getTok(p)
-  else: pegError(p, tokKindToStr[kind] & " expected")
-
-proc parseExpr(p: var TPegParser): TPeg
-
-proc getNonTerminal(p: var TPegParser, name: string): PNonTerminal =
-  for i in 0..high(p.nonterms):
-    result = p.nonterms[i]
-    if cmpIgnoreStyle(result.name, name) == 0: return
-  # forward reference:
-  result = newNonTerminal(name, getLine(p), getColumn(p))
-  add(p.nonterms, result)
-
-proc modifiedTerm(s: string, m: TModifier): TPeg =
-  case m
-  of modNone, modVerbatim: result = term(s)
-  of modIgnoreCase: result = termIgnoreCase(s)
-  of modIgnoreStyle: result = termIgnoreStyle(s)
-
-proc modifiedBackref(s: int, m: TModifier): TPeg =
-  case m
-  of modNone, modVerbatim: result = backRef(s)
-  of modIgnoreCase: result = backRefIgnoreCase(s)
-  of modIgnoreStyle: result = backRefIgnoreStyle(s)
-
-proc builtin(p: var TPegParser): TPeg =
-  # do not use "y", "skip" or "i" as these would be ambiguous
-  case p.tok.literal
-  of "n": result = newLine()
-  of "d": result = charset({'0'..'9'})
-  of "D": result = charset({'\1'..'\xff'} - {'0'..'9'})
-  of "s": result = charset({' ', '\9'..'\13'})
-  of "S": result = charset({'\1'..'\xff'} - {' ', '\9'..'\13'})
-  of "w": result = charset({'a'..'z', 'A'..'Z', '_', '0'..'9'})
-  of "W": result = charset({'\1'..'\xff'} - {'a'..'z','A'..'Z','_','0'..'9'})
-  of "a": result = charset({'a'..'z', 'A'..'Z'})
-  of "A": result = charset({'\1'..'\xff'} - {'a'..'z', 'A'..'Z'})
-  of "ident": result = tpegs.ident
-  of "letter": result = UnicodeLetter()
-  of "upper": result = UnicodeUpper()
-  of "lower": result = UnicodeLower()
-  of "title": result = UnicodeTitle()
-  of "white": result = UnicodeWhitespace()
-  else: pegError(p, "unknown built-in: " & p.tok.literal)
-
-proc token(terminal: TPeg, p: TPegParser): TPeg = 
-  if p.skip.kind == pkEmpty: result = terminal
-  else: result = sequence(p.skip, terminal)
-
-proc primary(p: var TPegParser): TPeg =
-  case p.tok.kind
-  of tkAmp:
-    getTok(p)
-    return &primary(p)
-  of tkNot:
-    getTok(p)
-    return !primary(p)
-  of tkAt:
-    getTok(p)
-    return !*primary(p)
-  of tkCurlyAt:
-    getTok(p)
-    return !*\primary(p).token(p)
-  else: nil
-  case p.tok.kind
-  of tkIdentifier:
-    if p.identIsVerbatim: 
-      var m = p.tok.modifier
-      if m == modNone: m = p.modifier
-      result = modifiedTerm(p.tok.literal, m).token(p)
-      getTok(p)
-    elif not arrowIsNextTok(p):
-      var nt = getNonTerminal(p, p.tok.literal)
-      incl(nt.flags, ntUsed)
-      result = nonTerminal(nt).token(p)
-      getTok(p)
-    else:
-      pegError(p, "expression expected, but found: " & p.tok.literal)
-  of tkStringLit:
-    var m = p.tok.modifier
-    if m == modNone: m = p.modifier
-    result = modifiedTerm(p.tok.literal, m).token(p)
-    getTok(p)
-  of tkCharSet:
-    if '\0' in p.tok.charset:
-      pegError(p, "binary zero ('\\0') not allowed in character class")
-    result = charset(p.tok.charset).token(p)
-    getTok(p)
-  of tkParLe:
-    getTok(p)
-    result = parseExpr(p)
-    eat(p, tkParRi)
-  of tkCurlyLe:
-    getTok(p)
-    result = capture(parseExpr(p)).token(p)
-    eat(p, tkCurlyRi)
-    inc(p.captures)
-  of tkAny:
-    result = any().token(p)
-    getTok(p)
-  of tkAnyRune:
-    result = anyRune().token(p)
-    getTok(p)
-  of tkBuiltin:
-    result = builtin(p).token(p)
-    getTok(p)
-  of tkEscaped:
-    result = term(p.tok.literal[0]).token(p)
-    getTok(p)
-  of tkDollar: 
-    result = endAnchor()
-    getTok(p)
-  of tkHat: 
-    result = startAnchor()
-    getTok(p)
-  of tkBackref:
-    var m = p.tok.modifier
-    if m == modNone: m = p.modifier
-    result = modifiedBackRef(p.tok.index, m).token(p)
-    if p.tok.index < 0 or p.tok.index > p.captures: 
-      pegError(p, "invalid back reference index: " & $p.tok.index)
-    getTok(p)
-  else:
-    pegError(p, "expression expected, but found: " & p.tok.literal)
-    getTok(p) # we must consume a token here to prevent endless loops!
-  while true:
-    case p.tok.kind
-    of tkOption:
-      result = ?result
-      getTok(p)
-    of tkStar:
-      result = *result
-      getTok(p)
-    of tkPlus:
-      result = +result
-      getTok(p)
-    else: break
-
-proc seqExpr(p: var TPegParser): TPeg =
-  result = primary(p)
-  while true:
-    case p.tok.kind
-    of tkAmp, tkNot, tkAt, tkStringLit, tkCharset, tkParLe, tkCurlyLe,
-       tkAny, tkAnyRune, tkBuiltin, tkEscaped, tkDollar, tkBackref, 
-       tkHat, tkCurlyAt:
-      result = sequence(result, primary(p))
-    of tkIdentifier:
-      if not arrowIsNextTok(p):
-        result = sequence(result, primary(p))
-      else: break
-    else: break
-
-proc parseExpr(p: var TPegParser): TPeg =
-  result = seqExpr(p)
-  while p.tok.kind == tkBar:
-    getTok(p)
-    result = result / seqExpr(p)
-  
-proc parseRule(p: var TPegParser): PNonTerminal =
-  if p.tok.kind == tkIdentifier and arrowIsNextTok(p):
-    result = getNonTerminal(p, p.tok.literal)
-    if ntDeclared in result.flags:
-      pegError(p, "attempt to redefine: " & result.name)
-    result.line = getLine(p)
-    result.col = getColumn(p)
-    getTok(p)
-    eat(p, tkArrow)
-    result.rule = parseExpr(p)
-    incl(result.flags, ntDeclared) # NOW inlining may be attempted
-  else:
-    pegError(p, "rule expected, but found: " & p.tok.literal)
-  
-proc rawParse(p: var TPegParser): TPeg =
-  ## parses a rule or a PEG expression
-  while p.tok.kind == tkBuiltin:
-    case p.tok.literal
-    of "i":
-      p.modifier = modIgnoreCase
-      getTok(p)
-    of "y":
-      p.modifier = modIgnoreStyle
-      getTok(p)
-    of "skip":
-      getTok(p)
-      p.skip = ?primary(p)
-    else: break
-  if p.tok.kind == tkIdentifier and arrowIsNextTok(p):
-    result = parseRule(p).rule
-    while p.tok.kind != tkEof:
-      discard parseRule(p)
-  else:
-    p.identIsVerbatim = true
-    result = parseExpr(p)
-  if p.tok.kind != tkEof:
-    pegError(p, "EOF expected, but found: " & p.tok.literal)
-  for i in 0..high(p.nonterms):
-    var nt = p.nonterms[i]
-    if ntDeclared notin nt.flags:
-      pegError(p, "undeclared identifier: " & nt.name, nt.line, nt.col)
-    elif ntUsed notin nt.flags and i > 0:
-      pegError(p, "unused rule: " & nt.name, nt.line, nt.col)
-
-proc parsePeg*(pattern: string, filename = "pattern", line = 1, col = 0): TPeg =
-  ## constructs a TPeg object from `pattern`. `filename`, `line`, `col` are
-  ## used for error messages, but they only provide start offsets. `parsePeg`
-  ## keeps track of line and column numbers within `pattern`.
-  var p: TPegParser
-  init(TPegLexer(p), pattern, filename, line, col)
-  p.tok.kind = tkInvalid
-  p.tok.modifier = modNone
-  p.tok.literal = ""
-  p.tok.charset = {}
-  p.nonterms = @[]
-  p.identIsVerbatim = false
-  getTok(p)
-  result = rawParse(p)
-
-proc peg*(pattern: string): TPeg =
-  ## constructs a TPeg object from the `pattern`. The short name has been
-  ## chosen to encourage its use as a raw string modifier::
-  ##
-  ##   peg"{\ident} \s* '=' \s* {.*}"
-  result = parsePeg(pattern, "pattern")
-
-proc escapePeg*(s: string): string = 
-  ## escapes `s` so that it is matched verbatim when used as a peg.
-  result = ""
-  var inQuote = false
-  for c in items(s):  
-    case c
-    of '\0'..'\31', '\'', '"', '\\': 
-      if inQuote: 
-        result.add('\'')
-        inQuote = false
-      result.add("\\x")
-      result.add(toHex(ord(c), 2))
-    else:
-      if not inQuote: 
-        result.add('\'')
-        inQuote = true
-      result.add(c)
-  if inQuote: result.add('\'')
-
-when isMainModule:
-  doAssert escapePeg("abc''def'") == r"'abc'\x27\x27'def'\x27"
-  #doAssert match("(a b c)", peg"'(' @ ')'")
-  doAssert match("W_HI_Le", peg"\y 'while'")
-  doAssert(not match("W_HI_L", peg"\y 'while'"))
-  doAssert(not match("W_HI_Le", peg"\y v'while'"))
-  doAssert match("W_HI_Le", peg"y'while'")
-  
-  doAssert($ +digits == $peg"\d+")
-  doAssert "0158787".match(peg"\d+")
-  doAssert "ABC 0232".match(peg"\w+\s+\d+")
-  doAssert "ABC".match(peg"\d+ / \w+")
-
-  for word in split("00232this02939is39an22example111", peg"\d+"):
-    writeln(stdout, word)
-
-  doAssert matchLen("key", ident) == 3
-
-  var pattern = sequence(ident, *whitespace, term('='), *whitespace, ident)
-  doAssert matchLen("key1=  cal9", pattern) == 11
-  
-  var ws = newNonTerminal("ws", 1, 1)
-  ws.rule = *whitespace
-  
-  var expr = newNonTerminal("expr", 1, 1)
-  expr.rule = sequence(capture(ident), *sequence(
-                nonterminal(ws), term('+'), nonterminal(ws), nonterminal(expr)))
-  
-  var c: TCaptures
-  var s = "a+b +  c +d+e+f"
-  doAssert rawMatch(s, expr.rule, 0, c) == len(s)
-  var a = ""
-  for i in 0..c.ml-1:
-    a.add(substr(s, c.matches[i][0], c.matches[i][1]))
-  doAssert a == "abcdef"
-  #echo expr.rule
-
-  #const filename = "lib/devel/peg/grammar.txt"
-  #var grammar = parsePeg(newFileStream(filename, fmRead), filename)
-  #echo "a <- [abc]*?".match(grammar)
-  doAssert find("_____abc_______", term("abc"), 2) == 5
-  doAssert match("_______ana", peg"A <- 'ana' / . A")
-  doAssert match("abcs%%%", peg"A <- ..A / .A / '%'")
-
-  if "abc" =~ peg"{'a'}'bc' 'xyz' / {\ident}":
-    doAssert matches[0] == "abc"
-  else:
-    doAssert false
-  
-  var g2 = peg"""S <- A B / C D
-                 A <- 'a'+
-                 B <- 'b'+
-                 C <- 'c'+
-                 D <- 'd'+
-              """
-  doAssert($g2 == "((A B) / (C D))")
-  doAssert match("cccccdddddd", g2)
-  doAssert("var1=key; var2=key2".replacef(peg"{\ident}'='{\ident}", "$1<-$2$2") ==
-         "var1<-keykey; var2<-key2key2")
-  doAssert "var1=key; var2=key2".endsWith(peg"{\ident}'='{\ident}")
-
-  if "aaaaaa" =~ peg"'aa' !. / ({'a'})+":
-    doAssert matches[0] == "a"
-  else:
-    doAssert false
-  
-  block:
-    var matches: array[0..2, string]
-    if match("abcdefg", peg"c {d} ef {g}", matches, 2): 
-      doAssert matches[0] == "d"
-      doAssert matches[1] == "g"
-    else:
-      doAssert false
-
-  for x in findAll("abcdef", peg"{.}", 3):
-    echo x
-    
-  if "f(a, b)" =~ peg"{[0-9]+} / ({\ident} '(' {@} ')')":
-    doAssert matches[0] == "f"
-    doAssert matches[1] == "a, b"
-  else:
-    doAssert false
-  
-  doAssert match("eine übersicht und außerdem", peg"(\letter \white*)+")
-  # ß is not a lower cased letter?!
-  doAssert match("eine übersicht und auerdem", peg"(\lower \white*)+")
-  doAssert match("EINE ÜBERSICHT UND AUSSERDEM", peg"(\upper \white*)+")
-  doAssert(not match("456678", peg"(\letter)+"))
-
-  doAssert("var1 = key; var2 = key2".replacef(
-    peg"\skip(\s*) {\ident}'='{\ident}", "$1<-$2$2") ==
-         "var1<-keykey;var2<-key2key2")
-
-  doAssert match("prefix/start", peg"^start$", 7)
-  
-  # tricky test to check for false aliasing:
-  block:
-    var a = term"key"
-    echo($sequence(sequence(a, term"value"), *a))
-
diff --git a/tests/run/tpos.nim b/tests/run/tpos.nim
deleted file mode 100644
index 3d72536dd..000000000
--- a/tests/run/tpos.nim
+++ /dev/null
@@ -1,35 +0,0 @@
-discard """
-  file: "tpos.nim"
-  output: "6"
-"""
-# test this particular function

-

-proc mypos(sub, s: string, start: int = 0): int =

-  var

-    i, j, M, N: int

-  M = sub.len

-  N = s.len

-  i = start

-  j = 0

-  if i >= N:

-    result = -1

-  else:

-    while True:

-      if s[i] == sub[j]:

-        Inc(i)

-        Inc(j)

-      else:

-        i = i - j + 1

-        j = 0

-      if (j >= M) or (i >= N): break

-    if j >= M:

-      result = i - M

-    else:

-      result = -1

-

-var sub = "hello"

-var s = "world hello"

-write(stdout, mypos(sub, s))

-#OUT 6

-
-
diff --git a/tests/run/tprecedence.nim b/tests/run/tprecedence.nim
deleted file mode 100644
index 6b1b250a2..000000000
--- a/tests/run/tprecedence.nim
+++ /dev/null
@@ -1,11 +0,0 @@
-discard """
-  output: "true"
-"""
-
-# Test the new predence rules
-
-proc `\+` (x, y: int): int = result = x + y
-proc `\*` (x, y: int): int = result = x * y
-
-echo 5 \+ 1 \* 9 == 14
-
diff --git a/tests/run/tprintf.nim b/tests/run/tprintf.nim
deleted file mode 100644
index c8fb51cdc..000000000
--- a/tests/run/tprintf.nim
+++ /dev/null
@@ -1,16 +0,0 @@
-discard """
-  file: "tprintf.nim"
-  output: "Andreas Rumpf"
-"""
-# Test a printf proc

-

-proc printf(file: TFile, args: openarray[string]) =

-  var i = 0

-  while i < args.len:

-    write(file, args[i])

-    inc(i)

-

-printf(stdout, ["Andreas ", "Rumpf\n"])

-#OUT Andreas Rumpf

-
-
diff --git a/tests/run/tprocvar.nim b/tests/run/tprocvar.nim
deleted file mode 100644
index 237e2ef7a..000000000
--- a/tests/run/tprocvar.nim
+++ /dev/null
@@ -1,32 +0,0 @@
-discard """
-  file: "tprocvar.nim"
-  output: "papbpcpdpe7"
-"""
-# test variables of type proc

-
-proc pa() {.cdecl.} = write(stdout, "pa")
-proc pb() {.cdecl.} = write(stdout, "pb")
-proc pc() {.cdecl.} = write(stdout, "pc")
-proc pd() {.cdecl.} = write(stdout, "pd")
-proc pe() {.cdecl.} = write(stdout, "pe")
-
-const
-  algos = [pa, pb, pc, pd, pe]
-

-var

-  x: proc (a, b: int): int {.cdecl.}

-

-proc ha(c, d: int): int {.cdecl.} =

-  echo(c + d)

-  result = c + d

-
-for a in items(algos):
-  a()
-

-x = ha

-discard x(3, 4)

-

-#OUT papbpcpdpe7

-

-
-
diff --git a/tests/run/tquotewords.nim b/tests/run/tquotewords.nim
deleted file mode 100644
index 76b8d8af7..000000000
--- a/tests/run/tquotewords.nim
+++ /dev/null
@@ -1,26 +0,0 @@
-discard """
-  file: "tquotewords.nim"
-  output: "thisanexample"
-"""
-# Test an idea I recently had:
-
-import macros
-
-macro quoteWords(n: expr): expr {.immediate.} = 
-  let n = callsite()
-  result = newNimNode(nnkBracket, n)
-  for i in 1..n.len-1:
-    expectKind(n[i], nnkIdent)
-    result.add(toStrLit(n[i]))
-  
-const
-  myWordList = quoteWords(this, an, example)
-
-var s = ""
-for w in items(myWordList):
-  s.add(w)
-
-echo s #OUT thisanexample
-
-
-
diff --git a/tests/run/tregex.nim b/tests/run/tregex.nim
deleted file mode 100644
index bb4695f02..000000000
--- a/tests/run/tregex.nim
+++ /dev/null
@@ -1,31 +0,0 @@
-discard """
-  file: "tregex.nim"
-  output: "key: keyAYes!"
-"""
-# Test the new regular expression module

-# which is based on the PCRE library

-
-when defined(powerpc64):
-  # cheat as our powerpc test machine has no PCRE installed:
-  echo "key: keyAYes!"
-
-else:

-  import

-    re

-

-  if "keyA = valueA" =~ re"\s*(\w+)\s*\=\s*(\w+)":

-    write(stdout, "key: ", matches[0])

-  elif "# comment!" =~ re.re"\s*(\#.*)": 

-    # test re.re"" syntax

-    echo("comment: ", matches[0])

-  else: 

-    echo("Bug!")

-

-  if "Username".match(re"[A-Za-z]+"):

-    echo("Yes!")

-  else:

-    echo("Bug!")

-

-  #OUT key: keyAYes!

-
-
diff --git a/tests/run/treguse.nim b/tests/run/treguse.nim
deleted file mode 100644
index a610ad725..000000000
--- a/tests/run/treguse.nim
+++ /dev/null
@@ -1,27 +0,0 @@
-discard """
-  file: "treguse.nim"
-  output: "055this should be the casehugh"
-"""
-# Test the register usage of the virtual machine and

-# the blocks in var statements

-

-proc main(a, b: int) =

-  var x = 0

-  write(stdout, x)

-  if x == 0:

-    var y = 55

-    write(stdout, y)

-    write(stdout, "this should be the case")

-    var input = "<no input>"

-    if input == "Andreas":

-      write(stdout, "wow")

-    else:

-      write(stdout, "hugh")

-  else:

-    var z = 66

-    write(stdout, z) # "bug!")

-

-main(45, 1000)

-#OUT 055this should be the casehugh

-
-
diff --git a/tests/run/trepr.nim b/tests/run/trepr.nim
deleted file mode 100644
index 41c830621..000000000
--- a/tests/run/trepr.nim
+++ /dev/null
@@ -1,29 +0,0 @@
-discard """
-  file: "trepr.nim"
-  output: "{a, b}{'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'}"
-"""
-
-type
-  TEnum = enum
-    a, b
-    
-var val = {a, b}
-stdout.write(repr(val))
-stdout.writeln(repr({'a'..'z', 'A'..'Z'}))
-
-type
-  TObj {.pure, inheritable.} = object
-    data: int
-  TFoo = ref object of TObj
-    d2: float
-var foo: TFoo
-new(foo)
-
-when false:
-  # cannot capture this output as it contains a memory address :-/
-  echo foo.repr
-#var testseq: seq[string] = @[
-#  "a", "b", "c", "d", "e"
-#]
-#echo(repr(testseq))
-
diff --git a/tests/run/treraise.nim b/tests/run/treraise.nim
deleted file mode 100644
index cbd0b5f8a..000000000
--- a/tests/run/treraise.nim
+++ /dev/null
@@ -1,24 +0,0 @@
-discard """
-  file: "treraise.nim"
-  outputsub: "Error: unhandled exception: bla [ESomeOtherErr]"
-  exitcode: "1"
-"""
-type
-  ESomething = object of E_Base
-  ESomeOtherErr = object of E_Base
-
-proc genErrors(s: string) =
-  if s == "error!":
-    raise newException(ESomething, "Test")
-  else:
-    raise newException(EsomeotherErr, "bla")
-
-try:
-  genErrors("errssor!")
-except ESomething:
-  echo("Error happened")
-except:
-  raise
-
-
-
diff --git a/tests/run/trettypeinference.nim b/tests/run/trettypeinference.nim
deleted file mode 100644
index 41b4aa5ef..000000000
--- a/tests/run/trettypeinference.nim
+++ /dev/null
@@ -1,33 +0,0 @@
-discard """
-  msg:    "instantiated for string\ninstantiated for int\ninstantiated for bool"
-  output: "int\nseq[string]\nA\nB\n100\ntrue"
-"""
-
-import typetraits
-
-proc plus(a, b): auto = a + b
-proc makePair(a, b): auto = (first: a, second: b)
-
-proc `+`(a, b: string): seq[string] = @[a, b]
-
-var i = plus(10, 20)
-var s = plus("A", "B")
-
-var p = makePair("key", 100)
-static: assert p[0].type is string
-
-echo i.type.name
-echo s.type.name
-
-proc inst(a): auto =
-  static: echo "instantiated for ", a.type.name
-  result = a
-
-echo inst("A")
-echo inst("B")
-echo inst(100)
-echo inst(true)
-
-# XXX: [string, tyGenericParam] is cached instead of [string, string]
-# echo inst[string, string]("C")
-
diff --git a/tests/run/tromans.nim b/tests/run/tromans.nim
deleted file mode 100644
index fa6a63595..000000000
--- a/tests/run/tromans.nim
+++ /dev/null
@@ -1,71 +0,0 @@
-discard """
-  file: "tromans.nim"
-  output: "success"
-"""
-import
-  strutils
-
-## Convert an integer to a Roman numeral
-# See http://en.wikipedia.org/wiki/Roman_numerals for reference
-
-proc raiseInvalidValue(msg: string) {.noreturn.} =
-  # Yes, we really need a shorthand for this code...
-  var e: ref EInvalidValue
-  new(e)
-  e.msg = msg
-  raise e
-
-# I should use a class, perhaps.
-# --> No. Why introduce additional state into such a simple and nice
-# interface? State is evil. :D
-
-proc RomanToDecimal(romanVal: string): int =
-  result = 0
-  var prevVal = 0
-  for i in countdown(romanVal.len - 1, 0):
-    var val = 0
-    case romanVal[i]
-    of 'I', 'i': val = 1
-    of 'V', 'v': val = 5
-    of 'X', 'x': val = 10
-    of 'L', 'l': val = 50
-    of 'C', 'c': val = 100
-    of 'D', 'd': val = 500
-    of 'M', 'm': val = 1000
-    else: raiseInvalidValue("Incorrect character in roman numeral! (" & 
-                            $romanVal[i] & ")")
-    if val >= prevVal:
-      inc(result, val)
-    else:
-      dec(result, val)
-    prevVal = val
-
-proc DecimalToRoman(decValParam: int): string =
-  # Apparently numbers cannot be above 4000
-  # Well, they can be (using overbar or parenthesis notation)
-  # but I see little interest (beside coding challenge) in coding them as
-  # we rarely use huge Roman numeral.
-  const romanComposites = [
-    ("M", 1000), ("CM", 900),
-    ("D", 500), ("CD", 400), ("C", 100),
-    ("XC", 90), ("L", 50), ("XL", 40), ("X", 10), ("IX", 9),
-    ("V", 5), ("IV", 4), ("I", 1)]     
-  if decValParam < 1 or decValParam > 3999:
-    raiseInvalidValue("number not representable")
-  result = ""
-  var decVal = decValParam
-  for key, val in items(romanComposites):
-    while decVal >= val:
-      dec(decVal, val)
-      result.add(key)
-
-for i in 1..100:
-  if RomanToDecimal(DecimalToRoman(i)) != i: quit "BUG"
-
-for i in items([1238, 1777, 3830, 2401, 379, 33, 940, 3973]):
-  if RomanToDecimal(DecimalToRoman(i)) != i: quit "BUG"
- 
-echo "success" #OUT success
-
-
-
diff --git a/tests/run/tsemistatic.nim b/tests/run/tsemistatic.nim
deleted file mode 100644
index d187f153c..000000000
--- a/tests/run/tsemistatic.nim
+++ /dev/null
@@ -1,24 +0,0 @@
-discard """
-  msg: "static 10\ndynamic\nstatic 20\n"
-  output: "s\nd\nd\ns"
-"""
-
-proc foo(x: semistatic[int]) =
-  when isStatic(x):
-    static: echo "static ", x
-    echo "s"
-  else:
-    static: echo "dynamic"
-    echo "d"
-
-foo 10
-
-var
-  x = 10
-  y: int
-
-foo x
-foo y
-
-foo 20
-
diff --git a/tests/run/tseqcon.nim b/tests/run/tseqcon.nim
deleted file mode 100644
index 6e0a5b56d..000000000
--- a/tests/run/tseqcon.nim
+++ /dev/null
@@ -1,51 +0,0 @@
-discard """
-  file: "tseqcon.nim"
-  output: "Hithere, what\'s your name?Hathere, what\'s your name?"
-"""
-# Test the add proc for sequences and strings

-

-const

-  nestedFixed = true

-

-type

-  TRec {.final.} = object

-    x, y: int

-    s: string

-    seq: seq[string]

-  TRecSeq = seq[TRec]

-

-proc test() =

-  var s, b: seq[string]

-  s = @[]

-  add(s, "Hi")

-  add(s, "there, ")

-  add(s, "what's your name?")

-

-  b = s # deep copying here!

-  b[0][1] = 'a'

-

-  for i in 0 .. len(s)-1:

-    write(stdout, s[i])

-  for i in 0 .. len(b)-1:

-    write(stdout, b[i])

-

-

-when nestedFixed:

-  proc nested() =

-    var

-      s: seq[seq[string]]

-    for i in 0..10_000: # test if the garbage collector

-      # now works with sequences

-      s = @[

-        @["A", "B", "C", "D"],

-        @["E", "F", "G", "H"],

-        @["I", "J", "K", "L"],

-        @["M", "N", "O", "P"]]

-

-test()

-when nestedFixed:

-  nested()

-

-#OUT Hithere, what's your name?Hathere, what's your name?

-
-
diff --git a/tests/run/tseqtuple.nim b/tests/run/tseqtuple.nim
deleted file mode 100644
index 7ef92f7f1..000000000
--- a/tests/run/tseqtuple.nim
+++ /dev/null
@@ -1,28 +0,0 @@
-discard """
-  file: "tseqtuple.nim"
-  output: "fA13msg1falsefB14msg2truefC15msg3false"
-"""
-
-type
-  TMsg = tuple[
-    file: string,
-    line: int,       
-    msg: string,
-    err: bool]
-
-var s: seq[TMsg] = @[]
-
-s.add(("fA", 13, "msg1", false))
-s.add(("fB", 14, "msg2", true))
-s.add(("fC", 15, "msg3", false))
-
-for file, line, msg, err in items(s):
-  stdout.write(file)
-  stdout.write($line)
-  stdout.write(msg)
-  stdout.write($err)
-
-#OUT fA13msg1falsefB14msg2truefC15msg3false
-
-
-
diff --git a/tests/run/tsequtils.nim b/tests/run/tsequtils.nim
deleted file mode 100644
index 7bc15ef9c..000000000
--- a/tests/run/tsequtils.nim
+++ /dev/null
@@ -1,55 +0,0 @@
-discard """
-file: "tsequtils.nim"
-output: '''Zip: [{"Field0": 1, "Field1": 2}, {"Field0": 3, "Field1": 4}, {"Field0": 5, "Field1": 6}]
-Filter Iterator: 3
-Filter Iterator: 5
-Filter Iterator: 7
-Filter: [3, 5, 7]
-FilterIt: [1, 3, 7]
-Concat: [1, 3, 5, 7, 2, 4, 6]
-Distnct: [1, 2, 3, 4, 5, 7]'''
-
-"""
-
-import sequtils, marshal
-
-proc testFindWhere(item : int) : bool =
-  if item != 1: return true
-
-var seq1: seq[int] = @[]
-
-seq1.add(1)
-seq1.add(3)
-seq1.add(5)
-seq1.add(7)
-
-var seq2: seq[int] = @[2, 4, 6]
-var final = zip(seq1, seq2)
-
-echo "Zip: ", $$(final)
-
-#Test findWhere as a iterator
-
-for itms in filter(seq1, testFindWhere):
-  echo "Filter Iterator: ", $$(itms)
-
-
-#Test findWhere as a proc
-
-var fullseq: seq[int] = filter(seq1, testFindWhere)
-
-echo "Filter: ", $$(fullseq)
-
-#Test findIt as a template
-
-var finditval: seq[int] = filterIt(seq1, it!=5)
-
-echo "FilterIt: ", $$(finditval)
-
-var concatseq = concat(seq1,seq2)
-echo "Concat: ", $$(concatseq)
-
-var seq3 = @[1,2,3,4,5,5,5,7]
-var discntseq = distnct(seq3)
-echo "Distnct: ", $$(discntseq)
-
diff --git a/tests/run/tsets.nim b/tests/run/tsets.nim
deleted file mode 100644
index 7b806f15b..000000000
--- a/tests/run/tsets.nim
+++ /dev/null
@@ -1,64 +0,0 @@
-discard """
-  file: "tsets.nim"
-  output: "Ha ein F ist in s!"
-"""
-# Test the handling of sets

-

-import

-  strutils

-

-proc testSets(s: var set[char]) =

-  s = {'A', 'B', 'C', 'E'..'G'} + {'Z'} + s

-

-# test sets if the first element is different from 0:

-type

-  TAZ = range['a'..'z']

-  TAZset = set[TAZ]

-

-  TTokType* = enum 

-    tkInvalid, tkEof,

-    tkSymbol,

-    tkAddr, tkAnd, tkAs, tkAsm, tkBlock, tkBreak, tkCase, tkCast, tkConst, 

-    tkContinue, tkConverter, tkDiscard, tkDiv, tkElif, tkElse, tkEnd, tkEnum, 

-    tkExcept, tkException, tkFinally, tkFor, tkFrom, tkGeneric, tkIf, tkImplies, 

-    tkImport, tkIn, tkInclude, tkIs, tkIsnot, tkIterator, tkLambda, tkMacro, 

-    tkMethod, tkMod, tkNil, tkNot, tkNotin, tkObject, tkOf, tkOr, tkOut, tkProc, 

-    tkPtr, tkRaise, tkRecord, tkRef, tkReturn, tkShl, tkShr, tkTemplate, tkTry, 

-    tkType, tkVar, tkWhen, tkWhere, tkWhile, tkWith, tkWithout, tkXor, tkYield,

-    tkIntLit, tkInt8Lit, tkInt16Lit, tkInt32Lit, tkInt64Lit, tkFloatLit, 

-    tkFloat32Lit, tkFloat64Lit, tkStrLit, tkRStrLit, tkTripleStrLit, tkCharLit, 

-    tkRCharLit, tkParLe, tkParRi, tkBracketLe, tkBracketRi, tkCurlyLe, 

-    tkCurlyRi, tkBracketDotLe, tkBracketDotRi, 

-    tkCurlyDotLe, tkCurlyDotRi, 

-    tkParDotLe, tkParDotRi,

-    tkComma, tkSemiColon, tkColon, tkEquals, tkDot, tkDotDot, tkHat, tkOpr, 

-    tkComment, tkAccent, tkInd, tkSad, tkDed,

-    tkSpaces, tkInfixOpr, tkPrefixOpr, tkPostfixOpr

-  TTokTypeRange = range[tkSymbol..tkDed]

-  TTokTypes* = set[TTokTypeRange]

-

-const

-  toktypes: TTokTypes = {TTokTypeRange(tkSymbol)..pred(tkIntLit), 
-                         tkStrLit..tkTripleStrLit}

-

-var

-  s: set[char]

-  a: TAZset

-s = {'0'..'9'}

-testSets(s)

-if 'F' in s: write(stdout, "Ha ein F ist in s!\n")

-else: write(stdout, "BUG: F ist nicht in s!\n")

-a = {} #{'a'..'z'}

-for x in low(TAZ) .. high(TAZ):

-  incl(a, x)

-  if x in a: nil

-  else: write(stdout, "BUG: something not in a!\n")

-

-for x in low(TTokTypeRange) .. high(TTokTypeRange):

-  if x in tokTypes:

-    nil
-    #writeln(stdout, "the token '$1' is in the set" % repr(x))

-

-#OUT Ha ein F ist in s!

-
-
diff --git a/tests/run/tsets2.nim b/tests/run/tsets2.nim
deleted file mode 100644
index ac977096b..000000000
--- a/tests/run/tsets2.nim
+++ /dev/null
@@ -1,62 +0,0 @@
-discard """
-  output: '''true'''
-  cmd: "nimrod cc --hints:on $# $#"
-"""
-
-import hashes, sets
-
-const
-  data = [
-    "34", "12",
-    "90", "0",
-    "1", "2",
-    "3", "4",
-    "5", "6",
-    "7", "8",
-    "9", "---00",
-    "10", "11", "19",
-    "20", "30", "40",
-    "50", "60", "70",
-    "80"]
-
-block tableTest1:
-  var t = initSet[tuple[x, y: int]]()
-  t.incl((0,0))
-  t.incl((1,0))
-  assert(not t.containsOrIncl((0,1)))
-  t.incl((1,1))
-
-  for x in 0..1:
-    for y in 0..1:
-      assert((x,y) in t)
-  #assert($t == 
-  #  "{(x: 0, y: 0), (x: 0, y: 1), (x: 1, y: 0), (x: 1, y: 1)}")
-
-block setTest2:
-  var t = initSet[string]()
-  t.incl("test")
-  t.incl("111")
-  t.incl("123")
-  t.excl("111")
-  
-  t.incl("012")
-  t.incl("123") # test duplicates
-  
-  assert "123" in t
-  assert "111" notin t # deleted
-  
-  for key in items(data): t.incl(key)
-  for key in items(data): assert key in t
-  
-
-block orderedSetTest1:
-  var t = data.toOrderedSet
-  for key in items(data): assert key in t
-  var i = 0
-  # `items` needs to yield in insertion order:
-  for key in items(t):
-    assert key == data[i]
-    inc(i)
-
-echo "true"
-
diff --git a/tests/run/tsidee2.nim b/tests/run/tsidee2.nim
deleted file mode 100644
index e73c89608..000000000
--- a/tests/run/tsidee2.nim
+++ /dev/null
@@ -1,17 +0,0 @@
-discard """
-  file: "tsidee2.nim"
-  output: "5"
-"""
-
-var
-  global: int
-
-proc dontcare(x: int): int = return x
-
-proc SideEffectLyer(x, y: int): int {.noSideEffect.} = 
-  return x + y + dontcare(x)
-  
-echo SideEffectLyer(1, 3) #OUT 5
-
-
-
diff --git a/tests/run/tsidee3.nim b/tests/run/tsidee3.nim
deleted file mode 100644
index e0c427ab6..000000000
--- a/tests/run/tsidee3.nim
+++ /dev/null
@@ -1,17 +0,0 @@
-discard """
-  file: "tsidee3.nim"
-  output: "5"
-"""
-
-var
-  global: int
-
-proc dontcare(x: int): int {.noSideEffect.} = return x
-
-proc noSideEffect(x, y: int, p: proc (a: int): int {.noSideEffect.}): int {.noSideEffect.} = 
-  return x + y + dontcare(x)
-  
-echo noSideEffect(1, 3, dontcare) #OUT 5
-
-
-
diff --git a/tests/run/tsimmeth.nim b/tests/run/tsimmeth.nim
deleted file mode 100644
index 11ff2674f..000000000
--- a/tests/run/tsimmeth.nim
+++ /dev/null
@@ -1,14 +0,0 @@
-discard """
-  file: "tsimmeth.nim"
-  output: "HELLO WORLD!"
-"""
-# Test method simulation
-
-import strutils
-
-var x = "hello world!".toLower.toUpper
-x.echo()
-#OUT HELLO WORLD!
-
-
-
diff --git a/tests/run/tsimplesort.nim b/tests/run/tsimplesort.nim
deleted file mode 100644
index 0167ca78a..000000000
--- a/tests/run/tsimplesort.nim
+++ /dev/null
@@ -1,313 +0,0 @@
-discard """
-  output: '''true'''
-"""
-  
-import hashes, math
-
-
-when defined(shallowADT):
-  {.pragma: myShallow, shallow.}
-else:
-  {.pragma: myShallow.}
-
-type
-  TSlotEnum = enum seEmpty, seFilled, seDeleted
-  TKeyValuePair[A, B] = tuple[slot: TSlotEnum, key: A, val: B]
-  TKeyValuePairSeq[A, B] = seq[TKeyValuePair[A, B]]
-  TTable* {.final, myShallow.}[A, B] = object
-    data: TKeyValuePairSeq[A, B]
-    counter: int
-
-proc len*[A, B](t: TTable[A, B]): int =
-  ## returns the number of keys in `t`.
-  result = t.counter
-
-iterator pairs*[A, B](t: TTable[A, B]): tuple[key: A, val: B] =
-  ## iterates over any (key, value) pair in the table `t`.
-  for h in 0..high(t.data):
-    if t.data[h].slot == seFilled: yield (t.data[h].key, t.data[h].val)
-
-iterator keys*[A, B](t: TTable[A, B]): A =
-  ## iterates over any key in the table `t`.
-  for h in 0..high(t.data):
-    if t.data[h].slot == seFilled: yield t.data[h].key
-
-iterator values*[A, B](t: TTable[A, B]): B =
-  ## iterates over any value in the table `t`.
-  for h in 0..high(t.data):
-    if t.data[h].slot == seFilled: yield t.data[h].val
-
-const
-  growthFactor = 2
-
-proc mustRehash(length, counter: int): bool {.inline.} =
-  assert(length > counter)
-  result = (length * 2 < counter * 3) or (length - counter < 4)
-
-proc nextTry(h, maxHash: THash): THash {.inline.} =
-  result = ((5 * h) + 1) and maxHash
-
-template rawGetImpl() =
-  var h: THash = hash(key) and high(t.data) # start with real hash value
-  while t.data[h].slot != seEmpty:
-    if t.data[h].key == key and t.data[h].slot == seFilled:
-      return h
-    h = nextTry(h, high(t.data))
-  result = -1
-
-template rawInsertImpl() =
-  var h: THash = hash(key) and high(data)
-  while data[h].slot == seFilled:
-    h = nextTry(h, high(data))
-  data[h].key = key
-  data[h].val = val
-  data[h].slot = seFilled
-
-proc RawGet[A, B](t: TTable[A, B], key: A): int =
-  rawGetImpl()
-
-proc `[]`*[A, B](t: TTable[A, B], key: A): B =
-  ## retrieves the value at ``t[key]``. If `key` is not in `t`,
-  ## default empty value for the type `B` is returned
-  ## and no exception is raised. One can check with ``hasKey`` whether the key
-  ## exists.
-  var index = RawGet(t, key)
-  if index >= 0: result = t.data[index].val
-
-proc hasKey*[A, B](t: TTable[A, B], key: A): bool =
-  ## returns true iff `key` is in the table `t`.
-  result = rawGet(t, key) >= 0
-
-proc RawInsert[A, B](t: var TTable[A, B], data: var TKeyValuePairSeq[A, B],
-                     key: A, val: B) =
-  rawInsertImpl()
-
-proc Enlarge[A, B](t: var TTable[A, B]) =
-  var n: TKeyValuePairSeq[A, B]
-  newSeq(n, len(t.data) * growthFactor)
-  for i in countup(0, high(t.data)):
-    if t.data[i].slot == seFilled: RawInsert(t, n, t.data[i].key, t.data[i].val)
-  swap(t.data, n)
-
-template PutImpl() =
-  var index = RawGet(t, key)
-  if index >= 0:
-    t.data[index].val = val
-  else:
-    if mustRehash(len(t.data), t.counter): Enlarge(t)
-    RawInsert(t, t.data, key, val)
-    inc(t.counter)
-
-proc `[]=`*[A, B](t: var TTable[A, B], key: A, val: B) =
-  ## puts a (key, value)-pair into `t`.
-  putImpl()
-
-proc del*[A, B](t: var TTable[A, B], key: A) =
-  ## deletes `key` from hash table `t`.
-  var index = RawGet(t, key)
-  if index >= 0:
-    t.data[index].slot = seDeleted
-    dec(t.counter)
-
-proc initTable*[A, B](initialSize=64): TTable[A, B] =
-  ## creates a new hash table that is empty. `initialSize` needs to be
-  ## a power of two.
-  assert isPowerOfTwo(initialSize)
-  result.counter = 0
-  newSeq(result.data, initialSize)
-
-proc toTable*[A, B](pairs: openarray[tuple[key: A, 
-                    val: B]]): TTable[A, B] =
-  ## creates a new hash table that contains the given `pairs`.
-  result = initTable[A, B](nextPowerOfTwo(pairs.len+10))
-  for key, val in items(pairs): result[key] = val
-
-template dollarImpl(): stmt =
-  if t.len == 0:
-    result = "{:}"
-  else:
-    result = "{"
-    for key, val in pairs(t):
-      if result.len > 1: result.add(", ")
-      result.add($key)
-      result.add(": ")
-      result.add($val)
-    result.add("}")
-
-proc `$`*[A, B](t: TTable[A, B]): string =
-  ## The `$` operator for hash tables.
-  dollarImpl()
-
-# ------------------------------ count tables -------------------------------
-
-type
-  TCountTable* {.final, myShallow.}[
-      A] = object ## table that counts the number of each key
-    data: seq[tuple[key: A, val: int]]
-    counter: int
-
-proc len*[A](t: TCountTable[A]): int =
-  ## returns the number of keys in `t`.
-  result = t.counter
-
-iterator pairs*[A](t: TCountTable[A]): tuple[key: A, val: int] =
-  ## iterates over any (key, value) pair in the table `t`.
-  for h in 0..high(t.data):
-    if t.data[h].val != 0: yield (t.data[h].key, t.data[h].val)
-
-iterator keys*[A](t: TCountTable[A]): A =
-  ## iterates over any key in the table `t`.
-  for h in 0..high(t.data):
-    if t.data[h].val != 0: yield t.data[h].key
-
-iterator values*[A](t: TCountTable[A]): int =
-  ## iterates over any value in the table `t`.
-  for h in 0..high(t.data):
-    if t.data[h].val != 0: yield t.data[h].val
-
-proc RawGet[A](t: TCountTable[A], key: A): int =
-  var h: THash = hash(key) and high(t.data) # start with real hash value
-  while t.data[h].val != 0:
-    if t.data[h].key == key: return h
-    h = nextTry(h, high(t.data))
-  result = -1
-
-proc `[]`*[A](t: TCountTable[A], key: A): int =
-  ## retrieves the value at ``t[key]``. If `key` is not in `t`,
-  ## 0 is returned. One can check with ``hasKey`` whether the key
-  ## exists.
-  var index = RawGet(t, key)
-  if index >= 0: result = t.data[index].val
-
-proc hasKey*[A](t: TCountTable[A], key: A): bool =
-  ## returns true iff `key` is in the table `t`.
-  result = rawGet(t, key) >= 0
-
-proc RawInsert[A](t: TCountTable[A], data: var seq[tuple[key: A, val: int]],
-                  key: A, val: int) =
-  var h: THash = hash(key) and high(data)
-  while data[h].val != 0: h = nextTry(h, high(data))
-  data[h].key = key
-  data[h].val = val
-
-proc Enlarge[A](t: var TCountTable[A]) =
-  var n: seq[tuple[key: A, val: int]]
-  newSeq(n, len(t.data) * growthFactor)
-  for i in countup(0, high(t.data)):
-    if t.data[i].val != 0: RawInsert(t, n, t.data[i].key, t.data[i].val)
-  swap(t.data, n)
-
-proc `[]=`*[A](t: var TCountTable[A], key: A, val: int) =
-  ## puts a (key, value)-pair into `t`. `val` has to be positive.
-  assert val > 0
-  PutImpl()
-
-proc initCountTable*[A](initialSize=64): TCountTable[A] =
-  ## creates a new count table that is empty. `initialSize` needs to be
-  ## a power of two.
-  assert isPowerOfTwo(initialSize)
-  result.counter = 0
-  newSeq(result.data, initialSize)
-
-proc toCountTable*[A](keys: openArray[A]): TCountTable[A] =
-  ## creates a new count table with every key in `keys` having a count of 1.
-  result = initCountTable[A](nextPowerOfTwo(keys.len+10))
-  for key in items(keys): result[key] = 1
-
-proc `$`*[A](t: TCountTable[A]): string =
-  ## The `$` operator for count tables.
-  dollarImpl()
-
-proc inc*[A](t: var TCountTable[A], key: A, val = 1) = 
-  ## increments `t[key]` by `val`.
-  var index = RawGet(t, key)
-  if index >= 0:
-    inc(t.data[index].val, val)
-  else:
-    if mustRehash(len(t.data), t.counter): Enlarge(t)
-    RawInsert(t, t.data, key, val)
-    inc(t.counter)
-
-proc Smallest*[A](t: TCountTable[A]): tuple[key: A, val: int] =
-  ## returns the largest (key,val)-pair. Efficiency: O(n)
-  assert t.len > 0
-  var minIdx = 0
-  for h in 1..high(t.data):
-    if t.data[h].val > 0 and t.data[minIdx].val > t.data[h].val: minIdx = h
-  result.key = t.data[minIdx].key
-  result.val = t.data[minIdx].val
-
-proc Largest*[A](t: TCountTable[A]): tuple[key: A, val: int] =
-  ## returns the (key,val)-pair with the largest `val`. Efficiency: O(n)
-  assert t.len > 0
-  var maxIdx = 0
-  for h in 1..high(t.data):
-    if t.data[maxIdx].val < t.data[h].val: maxIdx = h
-  result.key = t.data[maxIdx].key
-  result.val = t.data[maxIdx].val
-
-proc sort*[A](t: var TCountTable[A]) =
-  ## sorts the count table so that the entry with the highest counter comes
-  ## first. This is destructive! You must not modify `t` afterwards!
-  ## You can use the iterators `pairs`,  `keys`, and `values` to iterate over
-  ## `t` in the sorted order.
-
-  # we use shellsort here; fast enough and simple
-  var h = 1
-  while true:
-    h = 3 * h + 1
-    if h >= high(t.data): break
-  while true:
-    h = h div 3
-    for i in countup(h, high(t.data)):
-      var j = i
-      while t.data[j-h].val <= t.data[j].val:
-        var xyz = t.data[j]
-        t.data[j] = t.data[j-h]
-        t.data[j-h] = xyz
-        j = j-h
-        if j < h: break
-    if h == 1: break
-
-
-const
-  data = {
-    "34": 123456, "12": 789,
-    "90": 343, "0": 34404,
-    "1": 344004, "2": 344774,
-    "3": 342244, "4": 3412344,
-    "5": 341232144, "6": 34214544,
-    "7": 3434544, "8": 344544,
-    "9": 34435644, "---00": 346677844,
-    "10": 34484, "11": 34474, "19": 34464,
-    "20": 34454, "30": 34141244, "40": 344114,
-    "50": 344490, "60": 344491, "70": 344492,
-    "80": 344497}
-
-proc countTableTest1 =
-  var s = initTable[string, int](64)
-  for key, val in items(data): s[key] = val
-  var w: tuple[key: string, val: int] #type(otherCountTable.data[0])
-
-  var t = initCountTable[string]()
-  for k, v in items(data): t.inc(k)
-  for k in t.keys: assert t[k] == 1
-  t.inc("90", 3)
-  t.inc("12", 2)
-  t.inc("34", 1)
-  assert t.largest()[0] == "90"
-  t.sort()
-
-  var i = 0
-  for k, v in t.pairs:
-    case i
-    of 0: assert k == "90" and v == 4
-    of 1: assert k == "12" and v == 3
-    of 2: assert k == "34" and v == 2
-    else: break
-    inc i
-
-countTableTest1()
-echo true
-
-
diff --git a/tests/run/tslices.nim b/tests/run/tslices.nim
deleted file mode 100644
index 0de1171e3..000000000
--- a/tests/run/tslices.nim
+++ /dev/null
@@ -1,59 +0,0 @@
-discard """
-  file: "tslices.nim"
-  output: '''456456
-456456
-456456
-Zugr5nd
-egerichtetd
-verichtetd
-'''
-"""
-
-# Test the new slices.
-
-import strutils
-
-var mystr = "Abgrund"
-mystr[..1] = "Zu"
-
-mystr[4..4] = "5"
-
-type
-  TEnum = enum e1, e2, e3, e4, e5, e6
-
-var myarr: array[TEnum, int] = [1, 2, 3, 4, 5, 6]
-myarr[e1..e3] = myarr[e4..e6]
-myarr[..e3] = myarr[e4..e6]
-
-for x in items(myarr): stdout.write(x)
-echo()
-
-var myarr2: array[0..5, int] = [1, 2, 3, 4, 5, 6]
-myarr2[0..2] = myarr2[3..5]
-
-for x in items(myarr2): stdout.write(x)
-echo()
-
-
-var myseq = @[1, 2, 3, 4, 5, 6]
-myseq[0..2] = myseq[-3.. -1]
-
-for x in items(myseq): stdout.write(x)
-echo()
-
-echo mystr
-
-mystr[4..4] = "u"
-
-# test full replacement
-mystr[.. -2] = "egerichtet"
-
-echo mystr
-
-mystr[0..2] = "ve"
-echo mystr
-
-var s = "abcdef"
-s[1 .. -2] = "xyz"
-assert s == "axyzf"
-
diff --git a/tests/run/tsortdev.nim b/tests/run/tsortdev.nim
deleted file mode 100644
index d7d42d22c..000000000
--- a/tests/run/tsortdev.nim
+++ /dev/null
@@ -1,59 +0,0 @@
-discard """
-  output: "done"
-"""
-
-import algorithm, strutils
-
-proc cmpPlatforms(a, b: string): int =
-  if a == b: return 0
-  var dashes = a.split('-')
-  var dashes2 = b.split('-')
-  if dashes[0] == dashes2[0]:
-    if dashes[1] == dashes2[1]: return system.cmp(a,b)
-    case dashes[1]
-    of "x86":
-      return 1
-    of "x86_64":
-      if dashes2[1] == "x86": return -1
-      else: return 1
-    of "ppc64":
-      if dashes2[1] == "x86" or dashes2[1] == "x86_64": return -1
-      else: return 1
-    else:
-      return system.cmp(dashes[1], dashes2[1])
-  else:
-    case dashes[0]
-    of "linux":
-      return 1
-    of "windows":
-      if dashes2[0] == "linux": return -1
-      else: return 1
-    of "macosx":
-      if dashes2[0] == "linux" or dashes2[0] == "windows": return -1
-      else: return 1
-    else:
-      if dashes2[0] == "linux" or dashes2[0] == "windows" or
-         dashes2[0] == "macosx": return -1
-      else:
-        return system.cmp(a, b)
-
-proc sorted[T](a: openArray[T]): bool = 
-  result = true
-  for i in 0 .. < a.high:
-    if cmpPlatforms(a[i], a[i+1]) > 0: 
-      echo "Out of order: ", a[i], " ", a[i+1]
-      result = false
-
-proc main() =
-  var testData = @["netbsd-x86_64", "windows-x86", "linux-x86_64", "linux-x86", 
-    "linux-ppc64", "macosx-x86-1058", "macosx-x86-1068"]
-    
-  sort(testData, cmpPlatforms)
-
-  doAssert sorted(testData)
-
-for i in 0..1_000:
-  main()
-
-echo "done"
-
diff --git a/tests/run/tsplit.nim b/tests/run/tsplit.nim
deleted file mode 100644
index 25bad33e2..000000000
--- a/tests/run/tsplit.nim
+++ /dev/null
@@ -1,20 +0,0 @@
-discard """
-  file: "tsplit.nim"
-  output: "true"
-"""
-import strutils
-
-var s = ""
-for w in split("|abc|xy|z", {'|'}):
-  s.add("#")
-  s.add(w)
-
-if s == "#abc#xy#z":
-  echo "true"
-else:
-  echo "false"
-  
-#OUT true
-
-
-
diff --git a/tests/run/tstaticparams.nim b/tests/run/tstaticparams.nim
deleted file mode 100644
index b1377443b..000000000
--- a/tests/run/tstaticparams.nim
+++ /dev/null
@@ -1,31 +0,0 @@
-discard """
-  file: "tstaticparams.nim"
-  output: "abracadabra\ntest\n3"
-"""
-
-type 
-  TFoo[T; Val: static[string]] = object
-    data: array[4, T]
-
-  TBar[T; I: static[int]] = object
-    data: array[I, T]
-
-  TA1[T; I: static[int]] = array[I, T]
-  # TA2[T; I: static[int]] = array[0..I, T]
-  # TA3[T; I: static[int]] = array[I-1, T]
-
-proc takeFoo(x: TFoo) =
-  echo "abracadabra"
-  echo TFoo.Val
-
-var x: TFoo[int, "test"]
-takeFoo(x)
-
-var y: TBar[float, 4]
-echo high(y.data)
-
-var
-  t1: TA1[float, 1]
-  # t2: TA2[string, 4]
-  # t3: TA3[int, 10]
-
diff --git a/tests/run/tstempl.nim b/tests/run/tstempl.nim
deleted file mode 100644
index 2b4a8baa0..000000000
--- a/tests/run/tstempl.nim
+++ /dev/null
@@ -1,24 +0,0 @@
-discard """
-  output: '''global = levB, arg = levA, test = false
-levB'''
-"""
-
-# tstempl.nim
-import strutils
-
-type 
-  TLev = enum
-    levA,
-    levB
-
-var abclev = levB
-
-template tstLev(abclev: TLev) =
-  bind tstempl.abclev, `%`
-  writeln(stdout, "global = $1, arg = $2, test = $3" % [
-    $tstempl.abclev, $abclev, $(tstempl.abclev == abclev)])
-  # evaluates to true, but must be false
-
-
-tstLev(levA)
-writeln(stdout, $abclev)
diff --git a/tests/run/tstmtexprs.nim b/tests/run/tstmtexprs.nim
deleted file mode 100644
index 497a2f6d0..000000000
--- a/tests/run/tstmtexprs.nim
+++ /dev/null
@@ -1,71 +0,0 @@
-discard """
-  output: '''(bar: bar)
-1244
-6
-abcdefghijklmnopqrstuvwxyz
-145 23'''
-"""
-
-import strutils
-
-when true:
-  proc test(foo: proc (x, y: int): bool) =
-    echo foo(5, 5)
-
-
-  type Foo = object
-    bar: string
-
-  proc newfoo(): Foo =
-    result.bar = "bar"
-
-  echo($newfoo())
-   
-
-  proc retInt(x, y: int): int = 
-    if (var yy = 0; yy != 0):
-      echo yy
-    else:
-      echo(try: parseInt("1244") except EINvalidValue: -1)
-    result = case x
-             of 23: 3
-             of 64: 
-                    case y
-                    of 1: 2
-                    of 2: 3
-                    of 3: 6
-                    else: 8
-             else: 1
-
-  echo retInt(64, 3)
-
-  proc buildString(): string =
-    result = ""
-    for x in 'a'..'z':
-      result.add(x)
-
-  echo buildString()
-
-#test(
-#  proc (x, y: int): bool =
-#  if x == 5: return true
-#  if x == 2: return false
-#  if y == 78: return true
-#)
-
-proc q(): int {.discardable.} = 145
-proc p(): int =
-  q()
-
-proc p2(a: int): int =
-  # result enforces a void context:
-  if a == 2:
-    result = 23
-  q()
-
-echo p(), " ", p2(2)
-
-proc semiProblem() =
-  if false: echo "aye"; echo "indeed"
-
-semiProblem()
diff --git a/tests/run/tstrange.nim b/tests/run/tstrange.nim
deleted file mode 100644
index 3947755fc..000000000
--- a/tests/run/tstrange.nim
+++ /dev/null
@@ -1,23 +0,0 @@
-discard """
-  file: "tstrange.nim"
-  output: "hallo4"
-"""
-# test for extremely strange bug

-

-proc ack(x: int, y: int): int =

-  if x != 0:

-    if y != 5:

-      return y

-    return x

-  return x+y

-

-proc gen[T](a: T) =

-  write(stdout, a)

-

-

-gen("hallo")

-write(stdout, ack(5, 4))

-#OUT hallo4

-

-
-
diff --git a/tests/run/tstringinterp.nim b/tests/run/tstringinterp.nim
deleted file mode 100644
index f030213e0..000000000
--- a/tests/run/tstringinterp.nim
+++ /dev/null
@@ -1,74 +0,0 @@
-discard """
-  file: "tstringinterp.nim"
-  output: "Hello Alice, 64 | Hello Bob, 10$"
-"""
-
-import macros, parseutils, strutils
-
-proc concat(strings: varargs[string]): string =
-  result = newString(0)
-  for s in items(strings): result.add(s)
-
-template ProcessInterpolations(e: expr) =
-  var s = e[1].strVal
-  for f in interpolatedFragments(s):
-    case f.kind
-    of ikStr:         addString(f.value)
-    of ikDollar:      addDollar()
-    of ikVar, ikExpr: addExpr(newCall("$", parseExpr(f.value)))
-
-macro formatStyleInterpolation(e: expr): expr =
-  let e = callsite()
-  var 
-    formatString = ""
-    arrayNode = newNimNode(nnkBracket)
-    idx = 1
-
-  proc addString(s: string) =
-    formatString.add(s)
-
-  proc addExpr(e: PNimrodNode) =
-    arrayNode.add(e)
-    formatString.add("$" & $(idx))
-    inc idx
-
-  proc addDollar() =
-    formatString.add("$$")
-    
-  ProcessInterpolations(e)
-
-  result = parseExpr("\"x\" % [y]")
-  result[1].strVal = formatString
-  result[2] = arrayNode
-
-macro concatStyleInterpolation(e: expr): expr =
-  let e = callsite()
-  var args: seq[PNimrodNode]
-  newSeq(args, 0)
-
-  proc addString(s: string)    = args.add(newStrLitNode(s))
-  proc addExpr(e: PNimrodNode) = args.add(e)
-  proc addDollar()             = args.add(newStrLitNode"$")
-
-  ProcessInterpolations(e)
-
-  result = newCall("concat", args)
-
-###
-
-proc sum(a, b, c: int): int =
-  return (a + b + c)
-
-var 
-  alice = "Alice"
-  bob = "Bob"
-  a = 10
-  b = 20
-  c = 34
-
-var
-  s1 = concatStyleInterpolation"Hello ${alice}, ${sum(a, b, c)}"
-  s2 = formatStyleInterpolation"Hello ${bob}, ${sum(alice.len, bob.len, 2)}$$"
-
-write(stdout, s1 & " | " & s2)
-
diff --git a/tests/run/tstrlits.nim b/tests/run/tstrlits.nim
deleted file mode 100644
index 1cd43975a..000000000
--- a/tests/run/tstrlits.nim
+++ /dev/null
@@ -1,20 +0,0 @@
-discard """
-  file: "tstrlits.nim"
-  output: "a\"\"long string\"\"\"\"\"abc\"def"
-"""
-# Test the new different string literals
-
-const
-  tripleEmpty = """"long string"""""""" # "long string """""
-  
-  rawQuote = r"a"""
-  
-  raw = r"abc""def"
-
-stdout.write(rawQuote)
-stdout.write(tripleEmpty)
-stdout.write(raw)
-#OUT a""long string"""""abc"def
-
-
-
diff --git a/tests/run/tstrutil.nim b/tests/run/tstrutil.nim
deleted file mode 100644
index 80c2f3870..000000000
--- a/tests/run/tstrutil.nim
+++ /dev/null
@@ -1,45 +0,0 @@
-discard """
-  file: "tstrutil.nim"
-  output: "ha/home/a1xyz/usr/bin"
-"""
-# test the new strutils module

-

-import

-  strutils

-

-proc testStrip() =

-  write(stdout, strip("  ha  "))

-

-proc main() = 

-  testStrip()

-  for p in split("/home/a1:xyz:/usr/bin", {':'}):

-    write(stdout, p)

-
-proc testDelete = 
-  var s = "0123456789ABCDEFGH"
-  delete(s, 4, 5)
-  assert s == "01236789ABCDEFGH"
-  delete(s, s.len-1, s.len-1)
-  assert s == "01236789ABCDEFG"
-  delete(s, 0, 0)
-  assert s == "1236789ABCDEFG"
-
-testDelete()  
-    

-assert(insertSep($1000_000) == "1_000_000")
-assert(insertSep($232) == "232")
-assert(insertSep($12345, ',') == "12,345")
-assert(insertSep($0) == "0")
-

-assert(editDistance("prefix__hallo_suffix", "prefix__hallo_suffix") == 0)

-assert(editDistance("prefix__hallo_suffix", "prefix__hallo_suffi1") == 1)

-assert(editDistance("prefix__hallo_suffix", "prefix__HALLO_suffix") == 5)

-assert(editDistance("prefix__hallo_suffix", "prefix__ha_suffix") == 3)

-assert(editDistance("prefix__hallo_suffix", "prefix") == 14)

-assert(editDistance("prefix__hallo_suffix", "suffix") == 14)

-assert(editDistance("prefix__hallo_suffix", "prefix__hao_suffix") == 2)

-

-main()

-#OUT ha/home/a1xyz/usr/bin

-
-
diff --git a/tests/run/tsubrange.nim b/tests/run/tsubrange.nim
deleted file mode 100644
index b3e02fd29..000000000
--- a/tests/run/tsubrange.nim
+++ /dev/null
@@ -1,19 +0,0 @@
-discard """
-  file: "tsubrange.nim"
-  outputsub: "value out of range: 50 [EOutOfRange]"
-  exitcode: "1"
-"""
-
-type
-  TRange = range[0..40]
-  
-proc p(r: TRange) =
-  nil
-  
-var
-  r: TRange
-  y = 50
-r = y
-
-#p y
-  
diff --git a/tests/run/tsubrange2.nim b/tests/run/tsubrange2.nim
deleted file mode 100644
index 51598713b..000000000
--- a/tests/run/tsubrange2.nim
+++ /dev/null
@@ -1,17 +0,0 @@
-discard """
-  file: "tsubrange2.nim"
-  outputsub: "value out of range: 50 [EOutOfRange]"
-  exitcode: "1"
-"""
-
-type
-  TRange = range[0..40]
-  
-proc p(r: TRange) =
-  nil
-  
-var
-  r: TRange
-  y = 50
-p y
-  
diff --git a/tests/run/ttables.nim b/tests/run/ttables.nim
deleted file mode 100644
index 681ff5424..000000000
--- a/tests/run/ttables.nim
+++ /dev/null
@@ -1,129 +0,0 @@
-discard """
-  output: '''true'''
-  cmd: "nimrod cc --hints:on $# $#"
-"""
-
-import hashes, tables
-
-const
-  data = {
-    "34": 123456, "12": 789,
-    "90": 343, "0": 34404,
-    "1": 344004, "2": 344774,
-    "3": 342244, "4": 3412344,
-    "5": 341232144, "6": 34214544,
-    "7": 3434544, "8": 344544,
-    "9": 34435644, "---00": 346677844,
-    "10": 34484, "11": 34474, "19": 34464,
-    "20": 34454, "30": 34141244, "40": 344114,
-    "50": 344490, "60": 344491, "70": 344492,
-    "80": 344497}
-
-  sorteddata = {
-    "---00": 346677844,
-    "0": 34404,
-    "1": 344004,
-    "10": 34484, 
-    "11": 34474,
-    "12": 789,
-    "19": 34464,
-    "2": 344774, "20": 34454, 
-    "3": 342244, "30": 34141244,
-    "34": 123456,
-    "4": 3412344, "40": 344114,
-    "5": 341232144, "50": 344490, 
-    "6": 34214544, "60": 344491,
-    "7": 3434544, "70": 344492,
-    "8": 344544, "80": 344497,
-    "9": 34435644,
-    "90": 343}
-
-block tableTest1:
-  var t = initTable[tuple[x, y: int], string]()
-  t[(0,0)] = "00"
-  t[(1,0)] = "10"
-  t[(0,1)] = "01"
-  t[(1,1)] = "11"
-  for x in 0..1:
-    for y in 0..1:
-      assert t[(x,y)] == $x & $y
-  assert($t == 
-    "{(x: 0, y: 0): 00, (x: 0, y: 1): 01, (x: 1, y: 0): 10, (x: 1, y: 1): 11}")
-
-block tableTest2:
-  var t = initTable[string, float]()
-  t["test"] = 1.2345
-  t["111"] = 1.000043
-  t["123"] = 1.23
-  t.del("111")
-  
-  t["012"] = 67.9
-  t["123"] = 1.5 # test overwriting
-  
-  assert t["123"] == 1.5
-  assert t["111"] == 0.0 # deleted
-  assert(not hasKey(t, "111"))
-  
-  for key, val in items(data): t[key] = val.toFloat
-  for key, val in items(data): assert t[key] == val.toFloat
-  
-
-block orderedTableTest1:
-  var t = initOrderedTable[string, int](2)
-  for key, val in items(data): t[key] = val
-  for key, val in items(data): assert t[key] == val
-  var i = 0
-  # `pairs` needs to yield in insertion order:
-  for key, val in pairs(t):
-    assert key == data[i][0]
-    assert val == data[i][1]
-    inc(i)
-
-  for key, val in mpairs(t): val = 99
-  for val in mvalues(t): assert val == 99
-
-block countTableTest1:
-  var s = data.toTable
-  var t = initCountTable[string]()
-  for k in s.Keys: t.inc(k)
-  for k in t.keys: assert t[k] == 1
-  t.inc("90", 3)
-  t.inc("12", 2)
-  t.inc("34", 1)
-  assert t.largest()[0] == "90"
-
-  t.sort()
-  var i = 0
-  for k, v in t.pairs:
-    case i
-    of 0: assert k == "90" and v == 4
-    of 1: assert k == "12" and v == 3
-    of 2: assert k == "34" and v == 2
-    else: break
-    inc i
-
-block SyntaxTest:
-  var x = toTable[int, string]({:})
-
-proc orderedTableSortTest() =
-  var t = initOrderedTable[string, int](2)
-  for key, val in items(data): t[key] = val
-  for key, val in items(data): assert t[key] == val
-  t.sort(proc (x, y: tuple[key: string, val: int]): int = cmp(x.key, y.key))
-  var i = 0
-  # `pairs` needs to yield in sorted order:
-  for key, val in pairs(t):
-    doAssert key == sorteddata[i][0]
-    doAssert val == sorteddata[i][1]
-    inc(i)
-
-  # check that lookup still works:
-  for key, val in pairs(t):
-    doAssert val == t[key]
-  # check that insert still works:
-  t["newKeyHere"] = 80
-
-
-orderedTableSortTest()
-echo "true"
-
diff --git a/tests/run/ttables2.nim b/tests/run/ttables2.nim
deleted file mode 100644
index b88c8dfbf..000000000
--- a/tests/run/ttables2.nim
+++ /dev/null
@@ -1,21 +0,0 @@
-discard """
-  output: '''true'''
-  cmd: "nimrod cc --hints:on $# $#"
-"""
-
-import tables
-
-proc TestHashIntInt() =
-  var tab = initTable[int,int]()
-  for i in 1..1_000_000:
-    tab[i] = i
-  for i in 1..1_000_000:
-    var x = tab[i]
-    if x != i : echo "not found ", i
-
-proc run1() =         # occupied Memory stays constant, but
-  for i in 1 .. 50:   # aborts at run: 44 on win32 with 3.2GB with out of memory
-    TestHashIntInt()
-
-run1()
-echo "true"
diff --git a/tests/run/ttoseq.nim b/tests/run/ttoseq.nim
deleted file mode 100644
index 34cc4824b..000000000
--- a/tests/run/ttoseq.nim
+++ /dev/null
@@ -1,18 +0,0 @@
-discard """
-  output: "2345623456"
-"""
-
-import sequtils
-
-for x in toSeq(countup(2, 6)): 
-  stdout.write(x)
-for x in items(toSeq(countup(2, 6))): 
-  stdout.write(x)
-
-import strutils
-
-var y: type("a b c".split)
-y = "xzy"
-
-
-
diff --git a/tests/run/ttypedesc1.nim b/tests/run/ttypedesc1.nim
deleted file mode 100644
index 0c6f5dce4..000000000
--- a/tests/run/ttypedesc1.nim
+++ /dev/null
@@ -1,42 +0,0 @@
-import unittest, typetraits
-
-type 
-  TFoo[T, U] = object
-    x: T
-    y: U
-
-proc getTypeName(t: typedesc): string = t.name
-
-proc foo(T: typedesc[float], a: expr): string =
-  result = "float " & $(a.len > 5)
-
-proc foo(T: typedesc[TFoo], a: int): string =
-  result = "TFoo "  & $(a)
-
-proc foo(T: typedesc[int or bool]): string =
-  var a: T
-  a = 10
-  result = "int or bool " & ($a)
-
-template foo(T: typedesc[seq]): expr = "seq"
-
-test "types can be used as proc params":
-  # XXX: `check` needs to know that TFoo[int, float] is a type and 
-  # cannot be assigned for a local variable for later inspection
-  check ((string.getTypeName == "string"))
-  check ((getTypeName(int) == "int"))
-  
-  check ((foo(TFoo[int, float], 1000) == "TFoo 1000"))
-  
-  var f = 10.0
-  check ((foo(float, "long string") == "float true"))
-  check ((foo(type(f), [1, 2, 3]) == "float false"))
-  
-  check ((foo(int) == "int or bool 10"))
-
-  check ((foo(seq[int]) == "seq"))
-  check ((foo(seq[TFoo[bool, string]]) == "seq"))
-
-when false:
-  proc foo(T: typedesc[seq], s: T) = nil
-
diff --git a/tests/run/ttypetraits.nim b/tests/run/ttypetraits.nim
deleted file mode 100644
index 4344855eb..000000000
--- a/tests/run/ttypetraits.nim
+++ /dev/null
@@ -1,59 +0,0 @@
-discard """
-  msg:    "int\nstring\nTBar[int]"
-  output: "int\nstring\nTBar[int]\nint\nrange 0..2(int)\nstring"
-"""
-
-import typetraits
-
-# simple case of type trait usage inside/outside of static blocks
-proc foo(x) =
-  static:
-    var t = type(x)
-    echo t.name
-
-  echo x.type.name
-
-type
-  TBar[U] = object
-    x: U
-
-var bar: TBar[int]
-
-foo 10
-foo "test"
-foo bar
-
-# generic params on user types work too
-proc foo2[T](x: TBar[T]) =
-  echo T.name
-
-foo2 bar
-
-# less usual generic params on built-in types
-var arr: array[0..2, int] = [1, 2, 3]
-
-proc foo3[R, T](x: array[R, T]) =
-  echo name(R)
-
-foo3 arr
-
-const TypeList = [int, string, seq[int]]
-
-macro selectType(inType: typedesc): typedesc =
-  var typeSeq = @[float, TBar[int]]
-  
-  for t in TypeList:
-    typeSeq.add(t)
-
-  typeSeq.add(inType)
-  typeSeq.add(type(10))
-  
-  var typeSeq2: seq[typedesc] = @[]
-  typeSeq2 = typeSeq
-
-  result = typeSeq2[5]
-  
-var xvar: selectType(string)
-xvar = "proba"
-echo xvar.type.name
-
diff --git a/tests/run/tunhandledexc.nim b/tests/run/tunhandledexc.nim
deleted file mode 100644
index f24881aef..000000000
--- a/tests/run/tunhandledexc.nim
+++ /dev/null
@@ -1,23 +0,0 @@
-discard """
-  file: "tunhandledexc.nim"
-  outputsub: "Error: unhandled exception: bla [ESomeOtherErr]"
-  exitcode: "1"
-"""
-type
-  ESomething = object of E_Base
-  ESomeOtherErr = object of E_Base
-
-proc genErrors(s: string) =
-  if s == "error!":
-    raise newException(ESomething, "Test")
-  else:
-    raise newException(EsomeotherErr, "bla")
-
-when True:
-  try:
-    genErrors("errssor!")
-  except ESomething:
-    echo("Error happened")
-  
-
-
diff --git a/tests/run/tunidecode.nim b/tests/run/tunidecode.nim
deleted file mode 100644
index cb6589d60..000000000
--- a/tests/run/tunidecode.nim
+++ /dev/null
@@ -1,12 +0,0 @@
-discard """
-  cmd: "nimrod cc --hints:on -d:embedUnidecodeTable $# $#"
-  output: "Ausserst"
-"""
-
-import unidecode
-
-loadUnidecodeTable("lib/pure/unidecode/unidecode.dat")
-
-#assert unidecode("\x53\x17\x4E\xB0") == "Bei Jing"
-echo unidecode("Äußerst")
-
diff --git a/tests/run/tunittests.nim b/tests/run/tunittests.nim
deleted file mode 100644
index c77f691d9..000000000
--- a/tests/run/tunittests.nim
+++ /dev/null
@@ -1 +0,0 @@
-import utemplates, uclosures
diff --git a/tests/run/tuserassert.nim b/tests/run/tuserassert.nim
deleted file mode 100644
index 8710ee486..000000000
--- a/tests/run/tuserassert.nim
+++ /dev/null
@@ -1,13 +0,0 @@
-discard """
-  output: "x == 45ugh"
-"""
-
-template myAssert(cond: expr) = 
-  when rand(3) < 3:
-    let c = cond.astToStr
-    if not cond:
-      echo c, "ugh"
-  
-var x = 454
-myAssert(x == 45)
-
diff --git a/tests/run/tusertypeclasses.nim b/tests/run/tusertypeclasses.nim
deleted file mode 100644
index 4c2f07b85..000000000
--- a/tests/run/tusertypeclasses.nim
+++ /dev/null
@@ -1,28 +0,0 @@
-discard """
-  output: "Sortable\nSortable\nContainer"
-"""
-
-import typetraits
-
-type
-  TObj = object
-    x: int
-
-  Sortable = generic x, y
-    (x < y) is bool
-
-  ObjectContainer = generic C
-    C.len is ordinal
-    for v in items(C):
-      v.type is tuple|object
-
-proc foo(c: ObjectContainer) =
-  echo "Container"
-
-proc foo(x: Sortable) =
-  echo "Sortable"
-
-foo 10
-foo "test"
-foo(@[TObj(x: 10), TObj(x: 20)])
-
diff --git a/tests/run/tusingstatement.nim b/tests/run/tusingstatement.nim
deleted file mode 100644
index a33aced4c..000000000
--- a/tests/run/tusingstatement.nim
+++ /dev/null
@@ -1,89 +0,0 @@
-discard """
-  file: "tusingstatement.nim"
-  output: "Using test.Closing test."
-"""
-
-import 
-  macros
-
-# This macro mimics the using statement from C#
-#
-# It's kept only as a test for the macro system
-# Nimrod's destructors offer a mechanism for automatic 
-# disposal of resources.
-#
-macro autoClose(e: expr): stmt {.immediate.} =
-  let e = callsite()
-  if e.len != 3:
-    error "Using statement: unexpected number of arguments. Got " &
-      $e.len & ", expected: 1 or more variable assignments and a block"
-
-  var args = e
-  var body = e[2]
-  
-  var 
-    variables : seq[PNimrodNode]
-    closingCalls : seq[PNimrodNode]
-
-  newSeq(variables, 0)
-  newSeq(closingCalls, 0)
-  
-  for i in countup(1, args.len-2):
-    if args[i].kind == nnkExprEqExpr:
-      var varName = args[i][0]
-      var varValue = args[i][1]
- 
-      var varAssignment = newNimNode(nnkIdentDefs)
-      varAssignment.add(varName)
-      varAssignment.add(newNimNode(nnkEmpty)) # empty means no type
-      varAssignment.add(varValue)
-      variables.add(varAssignment)
-
-      closingCalls.add(newCall(!"close", varName))
-    else:
-      error "Using statement: Unexpected expression. Got " &
-        $args[i].kind & " instead of assignment."
-  
-  var varSection = newNimNode(nnkVarSection)
-  varSection.add(variables)
-
-  var finallyBlock = newNimNode(nnkStmtList)
-  finallyBlock.add(closingCalls)
-
-  # XXX: Use a template here once getAst is working properly
-  var targetAst = parseStmt"""block:
-    var
-      x = foo()
-      y = bar()
-
-    try:
-      body()
-
-    finally:
-      close x
-      close y
-  """
-
-  targetAst[0][1][0] = varSection
-  targetAst[0][1][1][0] = body
-  targetAst[0][1][1][1][0] = finallyBlock
-  
-  result = targetAst
-
-type 
-  TResource* = object
-    field*: string
-
-proc openResource(param: string): TResource =
-  result.field = param
-
-proc close(r: var TResource) =
-  write(stdout, "Closing " & r.field & ".")
-
-proc use(r: var TResource) =
-  write(stdout, "Using " & r.field & ".")
-
-autoClose(r = openResource("test")):
-  use r
-
-
diff --git a/tests/run/tvarargs_vs_generic.nim b/tests/run/tvarargs_vs_generic.nim
deleted file mode 100644
index 122f3e453..000000000
--- a/tests/run/tvarargs_vs_generic.nim
+++ /dev/null
@@ -1,26 +0,0 @@
-discard """
-  output: "direct\ngeneric\ngeneric"
-"""
-
-proc withDirectType(args: string) =
-  echo "direct"
-
-proc withDirectType[T](arg: T) =
-  echo "generic"
-
-proc withOpenArray(args: openarray[string]) =
-  echo "openarray"
-
-proc withOpenArray[T](arg: T) =
-  echo "generic"
-
-proc withVarargs(args: varargs[string]) =
-  echo "varargs"
-
-proc withVarargs[T](arg: T) =
-  echo "generic"
-
-withDirectType "string"
-withOpenArray "string"
-withVarargs "string"
-
diff --git a/tests/run/tvardecl.nim b/tests/run/tvardecl.nim
deleted file mode 100644
index 5cc6f4960..000000000
--- a/tests/run/tvardecl.nim
+++ /dev/null
@@ -1,15 +0,0 @@
-discard """
-  file: "tvardecl.nim"
-  output: "44"
-"""
-# Test the new variable declaration syntax

-

-var

-  x = 0

-  s = "Hallo"

-  a, b: int = 4

-

-write(stdout, a)

-write(stdout, b) #OUT 44

-
-
diff --git a/tests/run/tvariantasgn.nim b/tests/run/tvariantasgn.nim
deleted file mode 100644
index 46cc23dd1..000000000
--- a/tests/run/tvariantasgn.nim
+++ /dev/null
@@ -1,30 +0,0 @@
-discard """
-  file: "tvariantasgn.nim"
-  output: "came here"
-"""
-#BUG
-type
-  TAnyKind = enum
-    nkInt,
-    nkFloat,
-    nkString
-  TAny = object
-    case kind: TAnyKind
-    of nkInt: intVal: int
-    of nkFloat: floatVal: float
-    of nkString: strVal: string
-
-var s: TAny
-s.kind = nkString
-s.strVal = "test"
-
-var nr: TAny
-nr.kind = nkint
-nr.intVal = 78
-
-
-# s = nr # works
-nr = s # fails!
-echo "came here"
-
-
diff --git a/tests/run/tvariantstack.nim b/tests/run/tvariantstack.nim
deleted file mode 100644
index d81f6e001..000000000
--- a/tests/run/tvariantstack.nim
+++ /dev/null
@@ -1,52 +0,0 @@
-discard """
-  file: "tvariantstack.nim"
-  output: "came here"
-"""
-#BUG
-type
-  TAnyKind = enum
-    nkInt,
-    nkFloat,
-    nkString
-  PAny = ref TAny
-  TAny = object
-    case kind: TAnyKind
-    of nkInt: intVal: int
-    of nkFloat: floatVal: float
-    of nkString: strVal: string
-
-  TStack* = object
-    list*: seq[TAny]
-
-proc newStack(): TStack =
-  result.list = @[]
-
-proc push(Stack: var TStack, item: TAny) =
-  var nSeq: seq[TAny] = @[item]
-  for i in items(Stack.list):
-    nSeq.add(i)
-  Stack.list = nSeq
-
-proc pop(Stack: var TStack): TAny =
-  result = Stack.list[0]
-  Stack.list.delete(0)
-
-var stack = newStack()
-
-var s: TAny
-s.kind = nkString
-s.strVal = "test"
-
-stack.push(s)
-
-var nr: TAny
-nr.kind = nkint
-nr.intVal = 78
-
-stack.push(nr)
-
-var t = stack.pop()
-echo "came here"
-
-
-
diff --git a/tests/run/tvarious1.nim b/tests/run/tvarious1.nim
deleted file mode 100644
index 6e4612ae3..000000000
--- a/tests/run/tvarious1.nim
+++ /dev/null
@@ -1,41 +0,0 @@
-discard """
-  file: "tlenopenarray.nim"
-  output: '''1
-0
-Whopie
-12'''
-"""
-
-echo len([1_000_000]) #OUT 1
-
-type 
-  TArray = array[0..3, int]
-  TVector = distinct array[0..3, int]
-proc `[]`(v: TVector; idx: int): int = TArray(v)[idx]
-var v: TVector
-echo v[2]
-
-# bug #569
-
-import queues
-
-type
-  TWidget = object
-    names: TQueue[string]
-
-var w = TWidget(names: initQueue[string]())
-
-add(w.names, "Whopie")
-
-for n in w.names: echo(n)
-
-# bug #681
-
-type TSomeRange = object
-  hour: range[0..23]
-
-var value: string
-var val12 = TSomeRange(hour: 12)
-
-value = $(if val12.hour > 12: val12.hour - 12 else: val12.hour)
-echo value
diff --git a/tests/run/tvarnums.nim b/tests/run/tvarnums.nim
deleted file mode 100644
index 4f99df8b9..000000000
--- a/tests/run/tvarnums.nim
+++ /dev/null
@@ -1,142 +0,0 @@
-discard """
-  file: "tvarnums.nim"
-  output: "Success!"
-"""
-# Test variable length binary integers

-

-import

-  strutils

-

-type

-  TBuffer = array [0..10, int8]

-

-proc toVarNum(x: int32, b: var TBuffer) =

-  # encoding: first bit indicates end of number (0 if at end)

-  # second bit of the first byte denotes the sign (1 --> negative)

-  var a = x

-  if x != low(x):

-    # low(int) is a special case,

-    # because abs() does not work here!

-    # we leave x as it is and use the check >% instead of >

-    # for low(int) this is needed and positive numbers are not affected

-    # anyway

-    a = abs(x)

-  # first 6 bits:

-  b[0] = toU8(ord(a >% 63'i32) shl 7 or (ord(x < 0'i32) shl 6) or (int(a) and 63))

-  a = a shr 6'i32 # skip first 6 bits

-  var i = 1

-  while a != 0'i32:

-    b[i] = toU8(ord(a >% 127'i32) shl 7 or (int(a) and 127))

-    inc(i)

-    a = a shr 7'i32

-

-proc toVarNum64(x: int64, b: var TBuffer) =

-  # encoding: first bit indicates end of number (0 if at end)

-  # second bit of the first byte denotes the sign (1 --> negative)

-  var a = x

-  if x != low(x):

-    # low(int) is a special case,

-    # because abs() does not work here!

-    # we leave x as it is and use the check >% instead of >

-    # for low(int) this is needed and positive numbers are not affected

-    # anyway

-    a = abs(x)

-  # first 6 bits:

-  b[0] = toU8(ord(a >% 63'i64) shl 7 or (ord(x < 0'i64) shl 6) or int(a and 63))

-  a = a shr 6 # skip first 6 bits

-  var i = 1

-  while a != 0'i64:

-    b[i] = toU8(ord(a >% 127'i64) shl 7 or int(a and 127))

-    inc(i)

-    a = a shr 7

-

-proc toNum64(b: TBuffer): int64 =

-  # treat first byte different:

-  result = ze64(b[0]) and 63

-  var

-    i = 0

-    Shift = 6'i64

-  while (ze(b[i]) and 128) != 0:

-    inc(i)

-    result = result or ((ze64(b[i]) and 127) shl Shift)

-    inc(Shift, 7)

-  if (ze(b[0]) and 64) != 0: # sign bit set?

-    result = not result +% 1

-    # this is the same as ``- result``

-    # but gives no overflow error for low(int)

-

-proc toNum(b: TBuffer): int32 =

-  # treat first byte different:

-  result = ze(b[0]) and 63

-  var

-    i = 0

-    Shift = 6'i32

-  while (ze(b[i]) and 128) != 0:

-    inc(i)

-    result = result or ((int32(ze(b[i])) and 127'i32) shl Shift)

-    Shift = shift + 7'i32

-  if (ze(b[0]) and (1 shl 6)) != 0: # sign bit set?

-    result = (not result) +% 1'i32

-    # this is the same as ``- result``

-    # but gives no overflow error for low(int)

-

-proc toBinary(x: int64): string =

-  result = newString(64)

-  for i in 0..63:

-    result[63-i] = chr((int(x shr i) and 1) + ord('0'))

-

-proc t64(i: int64) =

-  var

-    b: TBuffer

-  toVarNum64(i, b)

-  var x = toNum64(b)

-  if x != i:

-    writeln(stdout, $i)

-    writeln(stdout, toBinary(i))

-    writeln(stdout, toBinary(x))

-

-proc t32(i: int32) =

-  var

-    b: TBuffer

-  toVarNum(i, b)

-  var x = toNum(b)

-  if x != i:

-    writeln(stdout, toBinary(i))

-    writeln(stdout, toBinary(x))

-

-proc tm(i: int32) =

-  var

-    b: TBuffer

-  toVarNum64(i, b)

-  var x = toNum(b)

-  if x != i:

-    writeln(stdout, toBinary(i))

-    writeln(stdout, toBinary(x))

-

-t32(0)

-t32(1)

-t32(-1)

-t32(-100_000)

-t32(100_000)

-t32(low(int32))

-t32(high(int32))

-

-t64(low(int64))

-t64(high(int64))

-t64(0)

-t64(-1)

-t64(1)

-t64(1000_000)

-t64(-1000_000)

-

-tm(0)

-tm(1)

-tm(-1)

-tm(-100_000)

-tm(100_000)

-tm(low(int32))

-tm(high(int32))

-

-writeln(stdout, "Success!") #OUT Success!

-
-
diff --git a/tests/run/tvarres1.nim b/tests/run/tvarres1.nim
deleted file mode 100644
index a48c961df..000000000
--- a/tests/run/tvarres1.nim
+++ /dev/null
@@ -1,15 +0,0 @@
-discard """
-  output: "45"
-"""
-
-var
-  g = 5
-
-proc p(): var int = 
-  var bla = addr(g) #: array [0..7, int]
-  result = bla[]
-  
-p() = 45
-
-echo g
-
diff --git a/tests/run/tvarres2.nim b/tests/run/tvarres2.nim
deleted file mode 100644
index 119560e7b..000000000
--- a/tests/run/tvarres2.nim
+++ /dev/null
@@ -1,20 +0,0 @@
-discard """
-  output: "45 hallo"
-"""
-
-type
-  TKachel = tuple[i: int, s: string]
-  TSpielwiese = object
-    k: seq[TKachel]
-
-var
-  spielwiese: TSpielwiese
-newSeq(spielwiese.k, 64)
-
-proc at*(s: var TSpielwiese, x, y: int): var TKachel =
-  result = s.k[y * 8 + x]
-
-spielwiese.at(3, 4) = (45, "hallo")
-
-echo spielwiese.at(3,4)[0], " ", spielwiese.at(3,4)[1]
-
diff --git a/tests/run/tvartup.nim b/tests/run/tvartup.nim
deleted file mode 100644
index f885cdf37..000000000
--- a/tests/run/tvartup.nim
+++ /dev/null
@@ -1,17 +0,0 @@
-discard """
-  file: "tvartup.nim"
-  output: "2 3"
-"""
-# Test the new tuple unpacking
-
-proc divmod(a, b: int): tuple[di, mo: int] =
-  return (a div b, a mod b)
-  
-var (x, y) = divmod(15, 6)
-stdout.write(x)
-stdout.write(" ")
-stdout.write(y)
-
-#OUT 2 3
-
-
diff --git a/tests/run/tvtable.nim b/tests/run/tvtable.nim
deleted file mode 100644
index 51894618c..000000000
--- a/tests/run/tvtable.nim
+++ /dev/null
@@ -1,74 +0,0 @@
-discard """
-  output: '''
-OBJ 1 foo
-10
-OBJ 1 bar
-OBJ 2 foo
-5
-OBJ 2 bar
-'''
-"""
-
-type
-  # these are the signatures of the virtual procs for each type
-  fooProc[T] = proc (o: var T): int
-  barProc[T] = proc (o: var T)
-
-  # an untyped table to store the proc pointers
-  # it's also possible to use a strongly typed tuple here
-  VTable = array[0..1, pointer]
-  
-  TBase = object {.inheritable.}
-    vtbl: ptr VTable
-
-  TUserObject1 = object of TBase
-    x: int
-
-  TUserObject2 = object of TBase
-    y: int
-
-proc foo(o: var TUserObject1): int =
-  echo "OBJ 1 foo"
-  return 10
-
-proc bar(o: var TUserObject1) =
-  echo "OBJ 1 bar"
-
-proc foo(o: var TUserObject2): int =
-  echo "OBJ 2 foo"
-  return 5
-
-proc bar(o: var TUserObject2) =
-  echo "OBJ 2 bar"
-
-proc getVTable(T: typedesc): ptr VTable =
-  # pay attention to what's going on here
-  # this will initialize the vtable for each type at program start-up
-  #
-  # fooProc[T](foo) is a type coercion - it looks for a proc named foo
-  # matching the signature fooProc[T] (e.g. proc (o: var TUserObject1): int)
-  var vtbl {.global.} = [
-    cast[pointer](fooProc[T](foo)),
-    cast[pointer](barProc[T](bar))
-  ]
-
-  return vtbl.addr
-
-proc create(T: typedesc): T =
-  result.vtbl = getVTable(T)
-
-proc baseFoo(o: var TBase): int =
-  return cast[fooProc[TBase]](o.vtbl[0]) (o)
-
-proc baseBar(o: var TBase) =
-  cast[barProc[TBase]](o.vtbl[1]) (o)
-
-var a = TUserObject1.create
-var b = TUserObject2.create
-
-echo a.baseFoo
-a.baseBar
-
-echo b.baseFoo
-b.baseBar
-
diff --git a/tests/run/twrongexc.nim b/tests/run/twrongexc.nim
deleted file mode 100644
index 755f7d979..000000000
--- a/tests/run/twrongexc.nim
+++ /dev/null
@@ -1,13 +0,0 @@
-discard """
-  file: "twrongexc.nim"
-  outputsub: "Error: unhandled exception:  [EInvalidValue]"
-  exitcode: "1"
-"""
-try:
-  raise newException(EInvalidValue, "")
-except EOverflow:
-  echo("Error caught")
-  
-
-
-
diff --git a/tests/run/txmlgen.nim b/tests/run/txmlgen.nim
deleted file mode 100644
index 917427abc..000000000
--- a/tests/run/txmlgen.nim
+++ /dev/null
@@ -1,12 +0,0 @@
-discard """
-  file: "txmlgen.nim"
-  output: "<h1><a href=\"http://force7.de/nimrod\">Nimrod</a></h1>"
-"""
-import htmlgen
-
-var nim = "Nimrod"
-echo h1(a(href="http://force7.de/nimrod", nim))
-
-
-
-
diff --git a/tests/run/txmltree.nim b/tests/run/txmltree.nim
deleted file mode 100644
index 931871f15..000000000
--- a/tests/run/txmltree.nim
+++ /dev/null
@@ -1,13 +0,0 @@
-discard """
-  file: "txmltree.nim"
-  output: "true"
-"""
-
-import xmltree, strtabs
-
-var x = <>a(href="nimrod.de", newText("www.nimrod-test.de"))
-
-echo($x == "<a href=\"nimrod.de\">www.nimrod-test.de</a>")
-
-
-
diff --git a/tests/run/tzeroarray.nim b/tests/run/tzeroarray.nim
deleted file mode 100644
index b784b601e..000000000
--- a/tests/run/tzeroarray.nim
+++ /dev/null
@@ -1,18 +0,0 @@
-discard """
-  output: done
-"""
-
-for i in 0 .. 1:
-  var a: array[0..4, int]
-  if a[0] != 0: quit "bug"
-  a[0] = 6
-
-proc main =
-  for i in 0 .. 1:
-    var a: array[0..4, int]
-    if a[0] != 0: quit "bug"
-    a[0] = 6
-
-main()
-echo "done"
-
diff --git a/tests/run/uclosures.nim b/tests/run/uclosures.nim
deleted file mode 100644
index 6eea29ca1..000000000
--- a/tests/run/uclosures.nim
+++ /dev/null
@@ -1,12 +0,0 @@
-import unittest
-
-test "loop variables are captured by copy":
-  var funcs: seq[proc (): int {.closure.}] = @[]
-  
-  for i in 0..10:
-    let ii = i
-    funcs.add do -> int: return ii * ii
-
-  check funcs[0]() == 0
-  check funcs[3]() == 9
-
diff --git a/tests/run/utemplates.nim b/tests/run/utemplates.nim
deleted file mode 100644
index 68fbb23a6..000000000
--- a/tests/run/utemplates.nim
+++ /dev/null
@@ -1,32 +0,0 @@
-import unittest
-
-template t(a: int): expr = "int"
-template t(a: string): expr = "string"
-
-test "templates can be overloaded":
-  check t(10) == "int"
-  check t("test") == "string"
-
-test "previous definitions can be further overloaded or hidden in local scopes":
-  template t(a: bool): expr = "bool"
-
-  check t(true) == "bool"
-  check t(10) == "int"
-  
-  template t(a: int): expr = "inner int"
-  check t(10) == "inner int"
-  check t("test") == "string"
-
-test "templates can be redefined multiple times":
-  template customAssert(cond: bool, msg: string): stmt =
-    if not cond: fail(msg)
-
-  template assertion_failed(body: stmt) {.immediate.} =
-    template fail(msg: string): stmt = body
-
-  assertion_failed: check msg == "first fail path"
-  customAssert false, "first fail path"
-
-  assertion_failed: check msg == "second fail path"  
-  customAssert false, "second fail path"
-
diff --git a/tests/run/utypeclasses.nim b/tests/run/utypeclasses.nim
deleted file mode 100644
index 06bab375e..000000000
--- a/tests/run/utypeclasses.nim
+++ /dev/null
@@ -1,13 +0,0 @@
-import unittest
-
-proc concat(a, b): string =
-  result = $a & $b
-
-test "if proc param types are not supplied, the params are assumed to be generic":
-  check concat(1, "test") == "1test"
-  check concat(1, 20) == "120"
-  check concat("foo", "bar") == "foobar"
-
-test "explicit param types can still be specified":
-  check concat[cstring, cstring]("x", "y") == "xy"
-