summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorArne Döring <arne.doering@gmx.net>2018-12-03 19:12:59 +0100
committerAraq <rumpf_a@web.de>2018-12-11 21:23:21 +0100
commit2a4c09ff8887350ec3fa283fe8d562e71b68406b (patch)
treebc09dd0a9b3960b1d4c194aa13d159711bd9a423 /tests
parentfb1f5c62b5e74b1a532ddfe9d6c373fc61eff878 (diff)
downloadNim-2a4c09ff8887350ec3fa283fe8d562e71b68406b.tar.gz
megatest can be executed
Diffstat (limited to 'tests')
-rw-r--r--tests/array/tarray.nim2
-rw-r--r--tests/async/tasyncfile.nim3
-rw-r--r--tests/ccgbugs/tconstobj.nim16
-rw-r--r--tests/collections/thashsets.nim (renamed from tests/collections/tsets.nim)0
-rw-r--r--tests/compilerapi/tcompilerapi.nim3
-rw-r--r--tests/concepts/trandomvars2.nim (renamed from tests/concepts/trandom_vars.nim)0
-rw-r--r--tests/iter/titerconcat.nim (renamed from tests/iter/tconcat.nim)0
-rw-r--r--tests/macros/tmacrogensym.nim (renamed from tests/macros/tgensym.nim)0
-rw-r--r--tests/metatype/tmeta_typeclasses.nim (renamed from tests/metatype/ttypeclasses.nim)0
-rw-r--r--tests/metatype/tmetatypematrix.nim (renamed from tests/metatype/tmatrix.nim)0
-rw-r--r--tests/misc/tradix.nim100
-rw-r--r--tests/stdlib/tsqlparser.nim2
-rw-r--r--tests/stdlib/tstdlib_various.nim2
-rw-r--r--tests/system/tostring.nim5
-rw-r--r--tests/types/tissues_types.nim (renamed from tests/types/tissues.nim)0
-rw-r--r--tests/vm/tconstobj.nim22
-rw-r--r--tests/vm/tmitems_vm.nim (renamed from tests/vm/tmitems.nim)0
-rw-r--r--tests/vm/tvmmisc.nim3
18 files changed, 31 insertions, 127 deletions
diff --git a/tests/array/tarray.nim b/tests/array/tarray.nim
index d12808668..96e90c97a 100644
--- a/tests/array/tarray.nim
+++ b/tests/array/tarray.nim
@@ -356,7 +356,7 @@ block troofregression:
   echo testStr[testStr.len - 8 .. testStr.len - 1] & "__" & testStr[0 .. testStr.len - pred(rot)]
 
   var
-    instructions = readFile(getAppDir() / "troofregression2.txt").split(',')
+    instructions = readFile(parentDir(currentSourcePath) / "troofregression2.txt").split(',')
     programs = "abcdefghijklmnop"
 
   proc dance(dancers: string): string =
diff --git a/tests/async/tasyncfile.nim b/tests/async/tasyncfile.nim
index 3043b680a..d95850c31 100644
--- a/tests/async/tasyncfile.nim
+++ b/tests/async/tasyncfile.nim
@@ -53,8 +53,7 @@ proc main() {.async.} =
 
   # Issue #7347
   block:
-    let appDir = getAppDir()
-    var file = openAsync(appDir & DirSep & "hello.txt")
+    var file = openAsync( parentDir(currentSourcePath) / "hello.txt")
     echo file.getFileSize()
     echo await file.readAll()
     echo file.getFilePos()
diff --git a/tests/ccgbugs/tconstobj.nim b/tests/ccgbugs/tconstobj.nim
deleted file mode 100644
index 51cf661ee..000000000
--- a/tests/ccgbugs/tconstobj.nim
+++ /dev/null
@@ -1,16 +0,0 @@
-discard """
-  output: '''(FirstName: "James", LastName: "Franco")'''
-"""
-
-# bug #1547
-import tables
-
-type Person* = object
-    FirstName*: string
-    LastName*: string
-
-let people = {
-    "001": Person(FirstName: "James", LastName: "Franco")
-}.toTable()
-
-echo people["001"]
diff --git a/tests/collections/tsets.nim b/tests/collections/thashsets.nim
index cd4401511..cd4401511 100644
--- a/tests/collections/tsets.nim
+++ b/tests/collections/thashsets.nim
diff --git a/tests/compilerapi/tcompilerapi.nim b/tests/compilerapi/tcompilerapi.nim
index 30007eff0..2a7db04eb 100644
--- a/tests/compilerapi/tcompilerapi.nim
+++ b/tests/compilerapi/tcompilerapi.nim
@@ -15,7 +15,7 @@ import std / [os]
 
 proc main() =
   let std = findNimStdLibCompileTime()
-  var intr = createInterpreter("myscript.nim", [std, getAppDir()])
+  var intr = createInterpreter("myscript.nim",[std, parentDir(currentSourcePath)])
   intr.implementRoutine("*", "exposed", "addFloats", proc (a: VmArgs) =
     setResult(a, getFloat(a, 0) + getFloat(a, 1) + getFloat(a, 2))
   )
@@ -51,4 +51,3 @@ block issue9180:
 
   evalString("echo 10+1")
   evalString("echo 10+2")
-
diff --git a/tests/concepts/trandom_vars.nim b/tests/concepts/trandomvars2.nim
index 861e876a7..861e876a7 100644
--- a/tests/concepts/trandom_vars.nim
+++ b/tests/concepts/trandomvars2.nim
diff --git a/tests/iter/tconcat.nim b/tests/iter/titerconcat.nim
index 477ac5e26..477ac5e26 100644
--- a/tests/iter/tconcat.nim
+++ b/tests/iter/titerconcat.nim
diff --git a/tests/macros/tgensym.nim b/tests/macros/tmacrogensym.nim
index 1237b8bf7..1237b8bf7 100644
--- a/tests/macros/tgensym.nim
+++ b/tests/macros/tmacrogensym.nim
diff --git a/tests/metatype/ttypeclasses.nim b/tests/metatype/tmeta_typeclasses.nim
index 720527088..720527088 100644
--- a/tests/metatype/ttypeclasses.nim
+++ b/tests/metatype/tmeta_typeclasses.nim
diff --git a/tests/metatype/tmatrix.nim b/tests/metatype/tmetatypematrix.nim
index 076009eb9..076009eb9 100644
--- a/tests/metatype/tmatrix.nim
+++ b/tests/metatype/tmetatypematrix.nim
diff --git a/tests/misc/tradix.nim b/tests/misc/tradix.nim
index 5009dfcfb..e6dde73f6 100644
--- a/tests/misc/tradix.nim
+++ b/tests/misc/tradix.nim
@@ -126,7 +126,7 @@ proc excl*(r: PRadixNode, a: ByteAddress): bool =
 proc addLeaf(r: var PRadixNode, a: int): bool =
   if r == nil:
     # a linear node:
-    var x = cast[ptr TRadixNodeLinear](alloc(sizeof(TRadixNodeLinear)))
+    var x = cast[ptr TRadixNodeLinear](alloc0(sizeof(TRadixNodeLinear)))
     x.kind = rnLeafLinear
     x.len = 1'i8
     x.keys[0] = toU8(a)
@@ -162,7 +162,7 @@ proc addInner(r: var PRadixNode, a: int, d: int): bool =
   var k = a shr d and 0xff
   if r == nil:
     # a linear node:
-    var x = cast[ptr TRadixNodeLinear](alloc(sizeof(TRadixNodeLinear)))
+    var x = cast[ptr TRadixNodeLinear](alloc0(sizeof(TRadixNodeLinear)))
     x.kind = rnLinear
     x.len = 1'i8
     x.keys[0] = toU8(k)
@@ -246,99 +246,3 @@ proc main() =
   for x in elements(r): echo(x)
 
 main()
-
-
-when false:
-  proc traverse(r: PRadixNode, prefix: int, d: int) =
-    if r == nil: return
-    case r.kind
-    of rnLeafBits:
-      assert(d == 0)
-      var x = cast[ptr TRadixNodeLeafBits](r)
-      # iterate over any bit:
-      for i in 0..high(x.b):
-        if x.b[i] != 0: # test all bits for zero
-          for j in 0..BitsPerUnit-1:
-            if testBit(x.b[i], j):
-              visit(prefix or i*BitsPerUnit+j)
-    of rnLeafLinear:
-      assert(d == 0)
-      var x = cast[ptr TRadixNodeLeafLinear](r)
-      for i in 0..ze(x.len)-1:
-        visit(prefix or ze(x.keys[i]))
-    of rnFull:
-      var x = cast[ptr TRadixNodeFull](r)
-      for i in 0..high(r.b):
-        if r.b[i] != nil:
-          traverse(r.b[i], prefix or (i shl d), d-8)
-    of rnLinear:
-      var x = cast[ptr TRadixNodeLinear](r)
-      for i in 0..ze(x.len)-1:
-        traverse(x.vals[i], prefix or (ze(x.keys[i]) shl d), d-8)
-
-  type
-    TRadixIter {.final.} = object
-      r: PRadixNode
-      p: int
-      x: int
-
-  proc init(i: var TRadixIter, r: PRadixNode) =
-    i.r = r
-    i.x = 0
-    i.p = 0
-
-  proc nextr(i: var TRadixIter): PRadixNode =
-    if i.r == nil: return nil
-    case i.r.kind
-    of rnFull:
-      var r = cast[ptr TRadixNodeFull](i.r)
-      while i.x <= high(r.b):
-        if r.b[i.x] != nil:
-          i.p = i.x
-          return r.b[i.x]
-        inc(i.x)
-    of rnLinear:
-      var r = cast[ptr TRadixNodeLinear](i.r)
-      if i.x < ze(r.len):
-        i.p = ze(r.keys[i.x])
-        result = r.vals[i.x]
-        inc(i.x)
-    else: assert(false)
-
-  proc nexti(i: var TRadixIter): int =
-    result = -1
-    case i.r.kind
-    of rnLeafBits:
-      var r = cast[ptr TRadixNodeLeafBits](i.r)
-      # iterate over any bit:
-      for i in 0..high(r.b):
-        if x.b[i] != 0: # test all bits for zero
-          for j in 0..BitsPerUnit-1:
-            if testBit(x.b[i], j):
-              visit(prefix or i*BitsPerUnit+j)
-    of rnLeafLinear:
-      var r = cast[ptr TRadixNodeLeafLinear](i.r)
-      if i.x < ze(r.len):
-        result = ze(r.keys[i.x])
-        inc(i.x)
-
-  iterator elements(r: PRadixNode): ByteAddress {.inline.} =
-    var
-      a, b, c, d: TRadixIter
-    init(a, r)
-    while true:
-      var x = nextr(a)
-      if x != nil:
-        init(b, x)
-        while true:
-          var y = nextr(b)
-          if y != nil:
-            init(c, y)
-            while true:
-              var z = nextr(c)
-              if z != nil:
-                init(d, z)
-                while true:
-                  var q = nexti(d)
-                  if q != -1:
-                    yield a.p shl 24 or b.p shl 16 or c.p shl 8 or q
diff --git a/tests/stdlib/tsqlparser.nim b/tests/stdlib/tsqlparser.nim
index 4a7b2f7d7..11ee22e2b 100644
--- a/tests/stdlib/tsqlparser.nim
+++ b/tests/stdlib/tsqlparser.nim
@@ -6,7 +6,7 @@ discard """
 
 import parsesql, streams, os
 
-var tree = parseSql(newFileStream(getAppDir() / "somesql.sql"), "somesql")
+var tree = parseSql(newFileStream(parentDir(currentSourcePath) / "somesql.sql"), "somesql")
 discard renderSql(tree)
 
 echo "true"
diff --git a/tests/stdlib/tstdlib_various.nim b/tests/stdlib/tstdlib_various.nim
index 7abc9a391..d1723df78 100644
--- a/tests/stdlib/tstdlib_various.nim
+++ b/tests/stdlib/tstdlib_various.nim
@@ -219,7 +219,7 @@ block tsplit2:
 
 block tsqlparser:
   # Just check that we can parse 'somesql' and render it without crashes.
-  var tree = parseSql(newFileStream(getAppDir() / "somesql.sql"), "somesql")
+  var tree = parseSql(newFileStream( parentDir(currentSourcePath) / "somesql.sql"), "somesql")
   discard renderSql(tree)
 
 
diff --git a/tests/system/tostring.nim b/tests/system/tostring.nim
index 04b37f133..ea4a44417 100644
--- a/tests/system/tostring.nim
+++ b/tests/system/tostring.nim
@@ -1,5 +1,5 @@
 discard """
-  output: ""
+  output: "DONE: tostring.nim"
 """
 
 doAssert "@[23, 45]" == $(@[23, 45])
@@ -115,3 +115,6 @@ block:
   var s: string
   s.addQuoted a2
   doAssert s == "\"fo\\\"o2\""
+
+
+echo "DONE: tostring.nim"
diff --git a/tests/types/tissues.nim b/tests/types/tissues_types.nim
index 97c796302..97c796302 100644
--- a/tests/types/tissues.nim
+++ b/tests/types/tissues_types.nim
diff --git a/tests/vm/tconstobj.nim b/tests/vm/tconstobj.nim
index 38fcdd844..021fcb728 100644
--- a/tests/vm/tconstobj.nim
+++ b/tests/vm/tconstobj.nim
@@ -1,10 +1,12 @@
 discard """
-  output: '''(name: "hello")
-(-1, 0)'''
+  output: '''
+(name: "hello")
+(-1, 0)
+(FirstName: "James", LastName: "Franco")
+'''
 """
 
 # bug #2774, bug #3195
-
 type Foo = object
   name: string
 
@@ -14,7 +16,6 @@ const fooArray = [
 
 echo fooArray[0]
 
-
 type
     Position = object
         x, y: int
@@ -34,3 +35,16 @@ const
      ]
 
 echo offset[1]
+
+# bug #1547
+import tables
+
+type Person* = object
+    FirstName*: string
+    LastName*: string
+
+let people = {
+    "001": Person(FirstName: "James", LastName: "Franco")
+}.toTable()
+
+echo people["001"]
diff --git a/tests/vm/tmitems.nim b/tests/vm/tmitems_vm.nim
index 87835d1cd..87835d1cd 100644
--- a/tests/vm/tmitems.nim
+++ b/tests/vm/tmitems_vm.nim
diff --git a/tests/vm/tvmmisc.nim b/tests/vm/tvmmisc.nim
index 85de26e39..35deea224 100644
--- a/tests/vm/tvmmisc.nim
+++ b/tests/vm/tvmmisc.nim
@@ -70,7 +70,8 @@ block:
 # Tests for VM ops
 block:
   static:
-    assert "vm" in getProjectPath()
+    # for joint test, the project path is different
+    assert "vm" in getProjectPath() or "Nim" in getProjectPath()
 
     let b = getEnv("UNSETENVVAR")
     assert b == ""