summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--testament/categories.nim60
-rw-r--r--testament/specs.nim6
-rw-r--r--testament/tester.nim16
-rw-r--r--tests/ccgbugs/tmissinginit.nim2
-rw-r--r--tests/ccgbugs/tobjconstr_bad_aliasing.nim3
-rw-r--r--tests/concepts/trandomvars.nim4
-rw-r--r--tests/errmsgs/treportunused.nim1
-rw-r--r--tests/generics/tgeneric3.nim95
-rw-r--r--tests/generics/tgenericvariant.nim4
-rw-r--r--tests/generics/tparser_generator.nim31
-rw-r--r--tests/generics/trtree.nim130
-rw-r--r--tests/misc/tshadow_magic_type.nim7
-rw-r--r--tests/objects/tobjconstr.nim31
-rw-r--r--tests/overload/toverload_issues.nim34
-rw-r--r--tests/stdlib/tnativesockets.nim11
-rw-r--r--tests/typerel/texplicitcmp.nim11
16 files changed, 231 insertions, 215 deletions
diff --git a/testament/categories.nim b/testament/categories.nim
index 8bb89c0ae..978719307 100644
--- a/testament/categories.nim
+++ b/testament/categories.nim
@@ -591,9 +591,10 @@ const specialDisabedTests = [
   "tests/system/trealloc.nim",       # out of memory
   "tests/system/t7894.nim",          # causes out of memory in later tests
   "tests/types/tissues_types.nim",   # causes out of memory with --gc:boehm
+  "tests/pragmas/tused.nim",         # paths in nimout differ when imported
 ]
 
-proc parseAllSpecs(): void =
+proc runJoinedTest(): void =
   var specs: array[TTestAction, seq[TSpec]]
   var specialTests = 0
   var ignoredTests = 0
@@ -601,6 +602,7 @@ proc parseAllSpecs(): void =
   var specsWithCustomCmd: seq[TSpec]
   var specsEarlyExit: seq[TSpec]
   var specsWithInput: seq[TSpec]
+  var specsNonCtarget: seq[TSpec]
 
   for file in os.walkFiles("tests/*/t*.nim"):
 
@@ -643,6 +645,10 @@ proc parseAllSpecs(): void =
       specsWithInput.add spec
       continue
 
+    if card(spec.targets) > 0 and spec.targets != {targetC}:
+      specsNonCtarget.add spec
+      continue
+
     specs[spec.action].add spec
 
   for action, specs in specs.pairs:
@@ -653,16 +659,52 @@ proc parseAllSpecs(): void =
   echo "special: ", specialTests
   echo "ignored: ", ignoredTests
   echo "withInput: ", specsWithInput.len
+  echo "nonCtarget: ", specsNonCtarget.len
 
   var megatest: string
-
   for runSpec in specs[actionRun]:
-    if targetC in runSpec.targets or runSpec.targets == {}:
-      megatest.add "echo \"------------------------------: "
-      megatest.add runSpec.file
-      megatest.add "\"\n"
-      megatest.add "import \""
-      megatest.add runSpec.file
-      megatest.add "\"\n"
+    megatest.add "import \""
+    megatest.add runSpec.file
+    megatest.add "\"\n"
 
   writeFile("megatest.nim", megatest)
+
+  let args = ["c", "-d:testing", "--gc:boehm", "megatest.nim"]
+  var (buf, exitCode) = execCmdEx2(command = "nim", args = args, options = {poStdErrToStdOut, poUsePath}, input = "")
+  if exitCode != 0:
+    quit("megatest compilation failed")
+
+  echo "compilation ok"
+
+  var nimoutOK = true
+  for runSpec in specs[actionRun]:
+    for line in runSpec.nimout.splitLines:
+      if buf.find(line) < 0:
+        echo "could not find: ", line
+        echo runSpec.file
+        nimoutOK = false
+
+  if nimoutOK:
+    echo "nimout OK"
+  else:
+    echo "nimout FAIL"
+
+  (buf, exitCode) = execCmdEx2("./megatest", [], {}, "")
+  if exitCode != 0:
+    quit("megatest execution failed")
+
+  echo "run ok"
+
+  var outputOK = true
+  for runSpec in specs[actionRun]:
+    for line in runSpec.output.splitLines:
+      if buf.find(line) < 0:
+        echo "could not find: ", line
+        echo runSpec.file
+        outputOK = false
+  if outputOK:
+    echo "output OK"
+  else:
+    echo "output FAIL"
+
+  removeFile("megatest.nim")
diff --git a/testament/specs.nim b/testament/specs.nim
index e3bc12376..e3ad3a4ff 100644
--- a/testament/specs.nim
+++ b/testament/specs.nim
@@ -57,7 +57,7 @@ type
     input*: string
     outputCheck*: TOutputCheck
     sortoutput*: bool
-    outp*: string
+    output*: string
     line*, column*: int
     tfile*: string
     tline*, tcolumn*: int
@@ -161,12 +161,12 @@ proc parseSpec*(filename: string): TSpec =
         discard parseInt(e.value, result.tcolumn)
       of "output":
         result.outputCheck = ocEqual
-        result.outp = strip(e.value)
+        result.output = strip(e.value)
       of "input":
         result.input = e.value
       of "outputsub":
         result.outputCheck = ocSubstr
-        result.outp = strip(e.value)
+        result.output = strip(e.value)
       of "sortoutput":
         try:
           result.sortoutput  = parseCfgBool(e.value)
diff --git a/testament/tester.nim b/testament/tester.nim
index 0d736fb3e..73aae0bc7 100644
--- a/testament/tester.nim
+++ b/testament/tester.nim
@@ -141,7 +141,7 @@ proc callCompiler(cmdTemplate, filename, options: string,
   close(p)
   result.msg = ""
   result.file = ""
-  result.outp = ""
+  result.output = ""
   result.line = 0
   result.column = 0
   result.tfile = ""
@@ -173,7 +173,7 @@ proc callCCompiler(cmdTemplate, filename, options: string,
   result.nimout = ""
   result.msg = ""
   result.file = ""
-  result.outp = ""
+  result.output = ""
   result.line = -1
   while outp.readLine(x.TaintedString) or running(p):
     result.nimout.add(x & "\n")
@@ -400,12 +400,12 @@ proc testSpec(r: var TResults, test: TTest, targets: set[TTarget] = {}) =
         exeFile = changeFileExt(test.name, ExeExt)
 
       if not existsFile(exeFile):
-        r.addResult(test, target, expected.outp, "executable not found", reExeNotFound)
+        r.addResult(test, target, expected.output, "executable not found", reExeNotFound)
         continue
 
       let nodejs = if isJsTarget: findNodeJs() else: ""
       if isJsTarget and nodejs == "":
-        r.addResult(test, target, expected.outp, "nodejs binary not in PATH",
+        r.addResult(test, target, expected.output, "nodejs binary not in PATH",
                     reExeNotFound)
         continue
 
@@ -438,10 +438,10 @@ proc testSpec(r: var TResults, test: TTest, targets: set[TTarget] = {}) =
                           bufB, reExitCodesDiffer)
         continue
 
-      if (expected.outputCheck == ocEqual  and expected.outp !=  bufB) or
-         (expected.outputCheck == ocSubstr and expected.outp notin bufB):
+      if (expected.outputCheck == ocEqual  and expected.output !=  bufB) or
+         (expected.outputCheck == ocSubstr and expected.output notin bufB):
         given.err = reOutputsDiffer
-        r.addResult(test, target, expected.outp, bufB, reOutputsDiffer)
+        r.addResult(test, target, expected.output, bufB, reOutputsDiffer)
         continue
 
       compilerOutputTests(test, target, given, expected, r)
@@ -582,7 +582,7 @@ proc main() =
   of "html":
     generateHtml(resultsFile, optFailing)
   of "stats":
-    parseAllSpecs()
+    runJoinedTest()
   else:
     quit Usage
 
diff --git a/tests/ccgbugs/tmissinginit.nim b/tests/ccgbugs/tmissinginit.nim
index b4087008a..8806a2f21 100644
--- a/tests/ccgbugs/tmissinginit.nim
+++ b/tests/ccgbugs/tmissinginit.nim
@@ -27,4 +27,4 @@ echo bug()[0]
 echo bug()[0]
 echo bug()[0]
 
-when isMainModule: test()
+test()
diff --git a/tests/ccgbugs/tobjconstr_bad_aliasing.nim b/tests/ccgbugs/tobjconstr_bad_aliasing.nim
index ea51ecacb..9f6045364 100644
--- a/tests/ccgbugs/tobjconstr_bad_aliasing.nim
+++ b/tests/ccgbugs/tobjconstr_bad_aliasing.nim
@@ -22,5 +22,4 @@ proc dosomething(): seq[TThing] =
 
   result = @[TThing(data: 10, children: result)]
 
-when isMainModule:
-  echo($dosomething()[0])
+echo($dosomething()[0])
diff --git a/tests/concepts/trandomvars.nim b/tests/concepts/trandomvars.nim
index db41aa901..1f04b9ecf 100644
--- a/tests/concepts/trandomvars.nim
+++ b/tests/concepts/trandomvars.nim
@@ -41,7 +41,8 @@ proc lift1[A, B](f: proc(a: A): B, r: RandomVar[A]): ClosureVar[B] =
 
   return inner
 
-when isMainModule:
+
+proc main() =
   proc sq(x: float): float = x * x
 
   let
@@ -59,3 +60,4 @@ when isMainModule:
   echo rng.sample(u)
   echo rng.sample(t)
 
+main()
diff --git a/tests/errmsgs/treportunused.nim b/tests/errmsgs/treportunused.nim
index 929da8843..f83ad5633 100644
--- a/tests/errmsgs/treportunused.nim
+++ b/tests/errmsgs/treportunused.nim
@@ -12,6 +12,7 @@ treportunused.nim(27, 5) Hint: 's9' is declared but not used [XDeclaredButNotUse
 treportunused.nim(21, 10) Hint: 's3' is declared but not used [XDeclaredButNotUsed]
 treportunused.nim(28, 6) Hint: 's10' is declared but not used [XDeclaredButNotUsed]
 '''
+action: compile
 """
 
 # bug #9764
diff --git a/tests/generics/tgeneric3.nim b/tests/generics/tgeneric3.nim
index 34b415446..4cb12f91b 100644
--- a/tests/generics/tgeneric3.nim
+++ b/tests/generics/tgeneric3.nim
@@ -430,55 +430,50 @@ iterator keys* [T,D] (n: PNode[T,D]): T =
         i = Path[level].Xi
         inc(i)
 
-
-when isMainModule:
-
-  proc test() =
-    var oldvalue: int
-    var root = internalPut[int, int](nil, 312, 312, oldvalue)
-    var someOtherRoot = internalPut[string, int](nil, "312", 312, oldvalue)
-    var it1 = internalFind(root, 312)
-    echo it1.value
-
-    for i in 1..1_000_000:
-      root = internalPut(root, i, i, oldvalue)
-
-    var cnt = 0
-    oldvalue = -1
-    when true : # code compiles, when this or the other when is switched to false
-      for k in root.keys :
-        if k <= oldvalue :
-          echo k
-        oldvalue = k
-        inc(cnt)
-      echo cnt
+proc test() =
+  var oldvalue: int
+  var root = internalPut[int, int](nil, 312, 312, oldvalue)
+  var someOtherRoot = internalPut[string, int](nil, "312", 312, oldvalue)
+  var it1 = internalFind(root, 312)
+  echo it1.value
+
+  for i in 1..1_000_000:
+    root = internalPut(root, i, i, oldvalue)
+
+  var cnt = 0
+  oldvalue = -1
+  when true : # code compiles, when this or the other when is switched to false
+    for k in root.keys :
+      if k <= oldvalue :
+        echo k
+      oldvalue = k
+      inc(cnt)
+    echo cnt
+  when true :
+    cnt = 0
+    VisitAll(root, proc(key, val: int) = inc(cnt))
+    echo cnt
     when true :
-      cnt = 0
-      VisitAll(root, proc(key, val: int) = inc(cnt))
-      echo cnt
-      when true :
-        root = VisitAll(root, proc(key: int, value: var int): bool =
-          return key mod 2 == 0 )
-      cnt = 0
-      oldvalue = -1
-      VisitAll(root, proc(key: int, value: int) {.closure.} =
-        if key <= oldvalue :
-          echo key
-        oldvalue = key
-        inc(cnt) )
-      echo cnt
       root = VisitAll(root, proc(key: int, value: var int): bool =
-        return key mod 2 != 0 )
-      cnt = 0
-      oldvalue = -1
-      VisitAll(root, proc(key: int, value: int) {.closure.} =
-        if key <= oldvalue :
-          echo "error ", key
-        oldvalue = key
-        inc(cnt) )
-      echo cnt
-      #traceTree(root)
-
-
-
-  test()
+        return key mod 2 == 0 )
+    cnt = 0
+    oldvalue = -1
+    VisitAll(root, proc(key: int, value: int) {.closure.} =
+      if key <= oldvalue :
+        echo key
+      oldvalue = key
+      inc(cnt) )
+    echo cnt
+    root = VisitAll(root, proc(key: int, value: var int): bool =
+      return key mod 2 != 0 )
+    cnt = 0
+    oldvalue = -1
+    VisitAll(root, proc(key: int, value: int) {.closure.} =
+      if key <= oldvalue :
+        echo "error ", key
+      oldvalue = key
+      inc(cnt) )
+    echo cnt
+    #traceTree(root)
+
+test()
diff --git a/tests/generics/tgenericvariant.nim b/tests/generics/tgenericvariant.nim
index 73c8af825..5ba3a2e7c 100644
--- a/tests/generics/tgenericvariant.nim
+++ b/tests/generics/tgenericvariant.nim
@@ -26,9 +26,11 @@ proc safeReadLine(): TMaybe[string] =
   if r == "": return Nothing[string]()
   else: return Just(r)
 
-when isMainModule:
+proc main() =
   var Test = Just("Test")
   echo(Test.value)
   var mSomething = safeReadLine()
   echo(mSomething.value)
   mSomething = safeReadLine()
+
+main()
diff --git a/tests/generics/tparser_generator.nim b/tests/generics/tparser_generator.nim
index 01ddd29b8..a94506d62 100644
--- a/tests/generics/tparser_generator.nim
+++ b/tests/generics/tparser_generator.nim
@@ -397,19 +397,18 @@ template grammar*[K](Kind, Text, Symbol: typedesc; default: K, code: untyped): t
 template grammar*[K](Kind: typedesc; default: K, code: untyped): typed {.hint[XDeclaredButNotUsed]: off.} =
   grammar(Kind, string, char, default, code)
 
-when isMainModule:
-  block:
-    type DummyKind = enum dkDefault
-    grammar(DummyKind, string, char, dkDefault):
-      let rule = token("h[a]+m") + ignore(token(r"\s+")) + (literal("eggs") / literal("beans"))
-      var text = "ham beans"
-      discard rule.parse(text)
-
-      var recursive = newRule()
-      recursive -> (literal("(") + recursive + literal(")")) / token(r"\d+")
-      for test in ["spam", "57", "(25)", "((25))"]:
-        discard recursive.parse(test)
-
-      let repeated = +literal("spam") + ?literal("ham") + *literal("salami")
-      for test in ["ham", "spam", "spamspamspam" , "spamham", "spamsalami", "spamsalamisalami"]:
-        discard  repeated.parse(test)
+block:
+  type DummyKind = enum dkDefault
+  grammar(DummyKind, string, char, dkDefault):
+    let rule = token("h[a]+m") + ignore(token(r"\s+")) + (literal("eggs") / literal("beans"))
+    var text = "ham beans"
+    discard rule.parse(text)
+
+    var recursive = newRule()
+    recursive -> (literal("(") + recursive + literal(")")) / token(r"\d+")
+    for test in ["spam", "57", "(25)", "((25))"]:
+      discard recursive.parse(test)
+
+    let repeated = +literal("spam") + ?literal("ham") + *literal("salami")
+    for test in ["ham", "spam", "spamspamspam" , "spamham", "spamsalami", "spamsalamisalami"]:
+      discard  repeated.parse(test)
diff --git a/tests/generics/trtree.nim b/tests/generics/trtree.nim
index 321b31df6..3fb080335 100644
--- a/tests/generics/trtree.nim
+++ b/tests/generics/trtree.nim
@@ -589,70 +589,68 @@ proc delete*[M, D: Dim; RT, LT](t: RTree[M, D, RT, LT]; leaf: L[D, RT, LT]): boo
       t.root.parent = nil
     return true
 
-when isMainModule:
-
-  var t = [4, 1, 3, 2]
-  var xt = 7
-  sortPlus(t, xt, system.cmp, SortOrder.Ascending)
-  echo xt, " ", t
-
-  type
-    RSE = L[2, int, int]
-    RSeq = seq[RSE]
-
-  proc rseq_search(rs: RSeq; rse: RSE): seq[int] =
-    result = newSeq[int]()
-    for i in rs:
-      if intersect(i.b, rse.b):
-        result.add(i.l)
-
-  proc rseq_delete(rs: var RSeq; rse: RSE): bool =
-    for i in 0 .. rs.high:
-      if rs[i] == rse:
-        #rs.delete(i)
-        rs[i] = rs[rs.high]
-        rs.setLen(rs.len - 1)
-        return true
-
-  import random, algorithm
-
-  proc test(n: int) =
-    var b: Box[2, int]
-    echo center(b)
-    var x1, x2, y1, y2: int
-    var t = newRStarTree[8, 2, int, int]()
-    #var t = newRTree[8, 2, int, int]()
-    var rs = newSeq[RSE]()
-    for i in 0 .. 5:
-      for i in 0 .. n - 1:
-        x1 = rand(1000)
-        y1 = rand(1000)
-        x2 = x1 + rand(25)
-        y2 = y1 + rand(25)
-        b = [(x1, x2), (y1, y2)]
-        let el: L[2, int, int] = (b, i + 7)
-        t.insert(el)
-        rs.add(el)
-
-      for i in 0 .. (n div 4):
-        let j = rand(rs.high)
-        var el = rs[j]
-        assert t.delete(el)
-        assert rs.rseq_delete(el)
-
-      for i in 0 .. n - 1:
-        x1 = rand(1000)
-        y1 = rand(1000)
-        x2 = x1 + rand(100)
-        y2 = y1 + rand(100)
-        b = [(x1, x2), (y1, y2)]
-        let el: L[2, int, int] = (b, i)
-        let r = search(t, b)
-        let r2 = rseq_search(rs, el)
-        assert r.len == r2.len
-        assert r.sorted(system.cmp) == r2.sorted(system.cmp)
-
-  test(1500)
-
-  # 651 lines
 
+var t = [4, 1, 3, 2]
+var xt = 7
+sortPlus(t, xt, system.cmp, SortOrder.Ascending)
+echo xt, " ", t
+
+type
+  RSE = L[2, int, int]
+  RSeq = seq[RSE]
+
+proc rseq_search(rs: RSeq; rse: RSE): seq[int] =
+  result = newSeq[int]()
+  for i in rs:
+    if intersect(i.b, rse.b):
+      result.add(i.l)
+
+proc rseq_delete(rs: var RSeq; rse: RSE): bool =
+  for i in 0 .. rs.high:
+    if rs[i] == rse:
+      #rs.delete(i)
+      rs[i] = rs[rs.high]
+      rs.setLen(rs.len - 1)
+      return true
+
+import random, algorithm
+
+proc test(n: int) =
+  var b: Box[2, int]
+  echo center(b)
+  var x1, x2, y1, y2: int
+  var t = newRStarTree[8, 2, int, int]()
+  #var t = newRTree[8, 2, int, int]()
+  var rs = newSeq[RSE]()
+  for i in 0 .. 5:
+    for i in 0 .. n - 1:
+      x1 = rand(1000)
+      y1 = rand(1000)
+      x2 = x1 + rand(25)
+      y2 = y1 + rand(25)
+      b = [(x1, x2), (y1, y2)]
+      let el: L[2, int, int] = (b, i + 7)
+      t.insert(el)
+      rs.add(el)
+
+    for i in 0 .. (n div 4):
+      let j = rand(rs.high)
+      var el = rs[j]
+      assert t.delete(el)
+      assert rs.rseq_delete(el)
+
+    for i in 0 .. n - 1:
+      x1 = rand(1000)
+      y1 = rand(1000)
+      x2 = x1 + rand(100)
+      y2 = y1 + rand(100)
+      b = [(x1, x2), (y1, y2)]
+      let el: L[2, int, int] = (b, i)
+      let r = search(t, b)
+      let r2 = rseq_search(rs, el)
+      assert r.len == r2.len
+      assert r.sorted(system.cmp) == r2.sorted(system.cmp)
+
+test(1500)
+
+# 651 lines
diff --git a/tests/misc/tshadow_magic_type.nim b/tests/misc/tshadow_magic_type.nim
index 6f9716bb9..3176a4596 100644
--- a/tests/misc/tshadow_magic_type.nim
+++ b/tests/misc/tshadow_magic_type.nim
@@ -26,7 +26,6 @@ proc lrange*(key: string): TRedisList =
   foo.str = key
   result = @[foo]
 
-when isMainModule:
-  var p = lrange("mylist")
-  for i in items(p):
-    echo(i.str)
+var p = lrange("mylist")
+for i in items(p):
+  echo(i.str)
diff --git a/tests/objects/tobjconstr.nim b/tests/objects/tobjconstr.nim
index 7238d10c7..1e4d89d68 100644
--- a/tests/objects/tobjconstr.nim
+++ b/tests/objects/tobjconstr.nim
@@ -1,14 +1,15 @@
 discard """
-  output: '''(k: kindA, a: (x: "abc", z: [1, 1, 3]), method: ())
-(k: kindA, a: (x: "abc", z: [1, 2, 3]), method: ())
-(k: kindA, a: (x: "abc", z: [1, 3, 3]), method: ())
-(k: kindA, a: (x: "abc", z: [1, 4, 3]), method: ())
-(k: kindA, a: (x: "abc", z: [1, 5, 3]), method: ())
-(k: kindA, a: (x: "abc", z: [1, 6, 3]), method: ())
-(k: kindA, a: (x: "abc", z: [1, 7, 3]), method: ())
-(k: kindA, a: (x: "abc", z: [1, 8, 3]), method: ())
-(k: kindA, a: (x: "abc", z: [1, 9, 3]), method: ())
-(k: kindA, a: (x: "abc", z: [1, 10, 3]), method: ())
+  output: '''
+(k: kindA, a: (x: "abc", z: @[1, 1, 3]), method: ())
+(k: kindA, a: (x: "abc", z: @[1, 2, 3]), method: ())
+(k: kindA, a: (x: "abc", z: @[1, 3, 3]), method: ())
+(k: kindA, a: (x: "abc", z: @[1, 4, 3]), method: ())
+(k: kindA, a: (x: "abc", z: @[1, 5, 3]), method: ())
+(k: kindA, a: (x: "abc", z: @[1, 6, 3]), method: ())
+(k: kindA, a: (x: "abc", z: @[1, 7, 3]), method: ())
+(k: kindA, a: (x: "abc", z: @[1, 8, 3]), method: ())
+(k: kindA, a: (x: "abc", z: @[1, 9, 3]), method: ())
+(k: kindA, a: (x: "abc", z: @[1, 10, 3]), method: ())
 (y: 0, x: 123)
 (y: 678, x: 123)
 (z: 89, y: 0, x: 128)
@@ -16,7 +17,8 @@ discard """
 (y: 678, x: 123)
 (y: 0, x: 123)
 (y: 678, x: 123)
-(y: 123, x: 678)'''
+(y: 123, x: 678)
+'''
 """
 
 type
@@ -32,13 +34,6 @@ type
       a: TArg
       `method`: TEmpty # bug #1791
 
-proc `$`[T](s: seq[T]): string =
-  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]), `method`: TEmpty())
diff --git a/tests/overload/toverload_issues.nim b/tests/overload/toverload_issues.nim
index 7980f51a9..fe1603a44 100644
--- a/tests/overload/toverload_issues.nim
+++ b/tests/overload/toverload_issues.nim
@@ -119,28 +119,24 @@ template test(loopCount: int, testBody: untyped): typed =
     test(loopCount, 0, testBody)
     echo "done extraI passed 0"
 
-when isMainModule:
-  var
-    loops = 0
-
-  test 0, 0:
-    loops += 1
-  echo "test 0 complete, loops=", loops
-
-  test 1, 1.0:
-    loops += 1
-  echo "test 1.0 complete, loops=", loops
-
-  when true:
-    # when true we get the following compile time error:
-    #   b.nim(35, 6) Error: expression 'loops += 1' has no type (or is ambiguous)
-    loops = 0
-    test 2:
-      loops += 1
-    echo "test no extra complete, loops=", loops
+var
+  loops = 0
 
+test 0, 0:
+  loops += 1
+echo "test 0 complete, loops=", loops
 
+test 1, 1.0:
+  loops += 1
+echo "test 1.0 complete, loops=", loops
 
+when true:
+  # when true we get the following compile time error:
+  #   b.nim(35, 6) Error: expression 'loops += 1' has no type (or is ambiguous)
+  loops = 0
+  test 2:
+    loops += 1
+  echo "test no extra complete, loops=", loops
 
 # bug #2229
 type
diff --git a/tests/stdlib/tnativesockets.nim b/tests/stdlib/tnativesockets.nim
deleted file mode 100644
index c2738b8a5..000000000
--- a/tests/stdlib/tnativesockets.nim
+++ /dev/null
@@ -1,11 +0,0 @@
-discard """
-outputsub: ""
-"""
-
-import nativesockets, unittest
-
-suite "nativesockets":
-  test "getHostname":
-    let hostname = getHostname()
-    check hostname.len > 0
-    check hostname.len < 64
diff --git a/tests/typerel/texplicitcmp.nim b/tests/typerel/texplicitcmp.nim
index e91ac2ffe..b11aa2f4e 100644
--- a/tests/typerel/texplicitcmp.nim
+++ b/tests/typerel/texplicitcmp.nim
@@ -24,9 +24,8 @@ proc weird(json_params: Table) =
   sort(f, system.cmp[int])
   outp(f)
 
-when isMainModule:
-  var t = @[3, 2, 1]
-  sort(t, system.cmp[int])
-  outp(t)
-  works()
-  weird(initTable[string, JsonNode]())
+var t = @[3, 2, 1]
+sort(t, system.cmp[int])
+outp(t)
+works()
+weird(initTable[string, JsonNode]())