summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorArne Döring <arne.doering@gmx.net>2018-12-05 19:03:01 +0100
committerAraq <rumpf_a@web.de>2018-12-11 21:23:22 +0100
commita5ecbf823f178c2800d40bcff562bc4eca0f2030 (patch)
tree50c3812eaa7a1100c30623755263d4ef35dd1c3b
parentc0c35839cc65717283edda72ce34579b992563ca (diff)
downloadNim-a5ecbf823f178c2800d40bcff562bc4eca0f2030.tar.gz
lots of small changes
-rw-r--r--.gitignore3
-rw-r--r--testament/categories.nim73
-rw-r--r--testament/specs.nim5
-rw-r--r--testament/tester.nim3
-rw-r--r--tests/async/t7192.nim2
-rw-r--r--tests/async/tasyncexceptions.nim2
-rw-r--r--tests/async/tasyncrecursion.nim2
-rw-r--r--tests/bind/tdatabind.nim2
-rw-r--r--tests/ccgbugs/t8616.nim2
-rw-r--r--tests/ccgbugs/t8781.nim2
-rw-r--r--tests/ccgbugs/tgeneric_closure.nim2
-rw-r--r--tests/ccgbugs/tgeneric_smallobj_asgn_opt.nim5
-rw-r--r--tests/ccgbugs/tmarkerproc_regression.nim4
-rw-r--r--tests/ccgbugs/tmissingbracket.nim7
-rw-r--r--tests/collections/ttables.nim4
-rw-r--r--tests/deps/jester-#head/jester/patterns.nim2
-rw-r--r--tests/deps/jester-#head/jester/private/utils.nim2
-rw-r--r--tests/deps/zip-0.2.1/zip/zipfiles.nim2
-rw-r--r--tests/destructor/tmove_objconstr.nim2
-rw-r--r--tests/destructor/turn_destroy_into_finalizer.nim7
-rw-r--r--tests/discard/tdiscardable.nim3
-rw-r--r--tests/distinct/tdistinct.nim6
-rw-r--r--tests/errmsgs/t6483.nim2
-rw-r--r--tests/errmsgs/tproper_stacktrace.nim2
-rw-r--r--tests/errmsgs/treportunused.nim1
-rw-r--r--tests/generics/tbintree.nim2
-rw-r--r--tests/generics/toverloading_typedesc.nim2
-rw-r--r--tests/generics/tthread_generic.nim2
-rw-r--r--tests/generics/twrong_floatlit_type.nim2
-rw-r--r--tests/implicit/timplicit.nim5
-rw-r--r--tests/iter/titer10.nim2
-rw-r--r--tests/js/tvarargs.nim2
-rw-r--r--tests/macros/tmacro4.nim2
-rw-r--r--tests/manyloc/argument_parser/argument_parser.nim2
-rw-r--r--tests/manyloc/argument_parser/ex_wget.nim2
-rw-r--r--tests/manyloc/keineschweine/dependencies/genpacket/genpacket.nim2
-rw-r--r--tests/manyloc/keineschweine/dependencies/genpacket/genpacket_enet.nim2
-rw-r--r--tests/manyloc/keineschweine/dependencies/genpacket/macro_dsl.nim2
-rw-r--r--tests/manyloc/keineschweine/dependencies/genpacket/streams_enh.nim2
-rw-r--r--tests/manyloc/keineschweine/dependencies/nake/nake.nim2
-rw-r--r--tests/manyloc/keineschweine/enet_server/enet_server.nim2
-rw-r--r--tests/manyloc/keineschweine/keineschweine.nim2
-rw-r--r--tests/manyloc/keineschweine/lib/estreams.nim2
-rw-r--r--tests/manyloc/keineschweine/lib/map_filter.nim2
-rw-r--r--tests/manyloc/keineschweine/lib/sg_packets.nim2
-rw-r--r--tests/manyloc/keineschweine/lib/zlib_helpers.nim2
-rw-r--r--tests/manyloc/keineschweine/server/old_dirserver.nim2
-rw-r--r--tests/manyloc/keineschweine/server/old_sg_server.nim2
-rw-r--r--tests/manyloc/nake/nake.nim2
-rw-r--r--tests/misc/thallo.nim4
-rw-r--r--tests/misc/tradix.nim3
-rw-r--r--tests/misc/tsortdev.nim5
-rw-r--r--tests/niminaction/Chapter3/ChatApp/src/protocol.nim2
-rw-r--r--tests/niminaction/Chapter3/ChatApp/src/server.nim2
-rw-r--r--tests/niminaction/Chapter6/WikipediaStats/concurrency.nim2
-rw-r--r--tests/niminaction/Chapter6/WikipediaStats/concurrency_regex.nim2
-rw-r--r--tests/niminaction/Chapter6/WikipediaStats/naive.nim2
-rw-r--r--tests/niminaction/Chapter6/WikipediaStats/parallel_counts.nim2
-rw-r--r--tests/niminaction/Chapter6/WikipediaStats/sequential_counts.nim2
-rw-r--r--tests/niminaction/Chapter7/Tweeter/src/views/user.nim2
-rw-r--r--tests/niminaction/Chapter7/Tweeter/tests/database_test.nim2
-rw-r--r--tests/osproc/ta_out.nim6
-rw-r--r--tests/osproc/texecps.nim7
-rw-r--r--tests/osproc/tstderr.nim7
-rw-r--r--tests/parallel/tarray_of_channels.nim2
-rw-r--r--tests/parallel/tgc_unsafe.nim2
-rw-r--r--tests/parallel/tgc_unsafe2.nim2
-rw-r--r--tests/parallel/tmissing_deepcopy.nim2
-rw-r--r--tests/parallel/tsimple_array_checks.nim2
-rw-r--r--tests/parallel/twrong_refcounts.nim2
-rw-r--r--tests/statictypes/t9255.nim2
-rw-r--r--tests/stdlib/tjsonmacro.nim2
-rw-r--r--tests/system/helpers/readall_echo.nim2
-rw-r--r--tests/template/annotate.nim2
-rw-r--r--tests/template/t_otemplates.nim2
-rw-r--r--tests/template/template_issues.nim2
-rw-r--r--tests/template/tgensymregression.nim2
-rw-r--r--tests/template/thygienictempl.nim2
-rw-r--r--tests/template/twrongopensymchoice.nim2
-rw-r--r--tests/threads/t8535.nim2
-rw-r--r--tests/tuples/ttuples_various.nim2
-rw-r--r--tests/typerel/t2plus.nim2
-rw-r--r--tests/types/tillegaltyperecursion.nim2
-rw-r--r--tests/untestable/tssl.nim2
-rw-r--r--tests/vm/tforwardproc.nim2
85 files changed, 180 insertions, 110 deletions
diff --git a/.gitignore b/.gitignore
index 8cd092639..d736cdf8d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -66,3 +66,6 @@ testresults/
 test.txt
 /test.ini
 
+tweeter.db
+tweeter_test.db
+megatest.nim
diff --git a/testament/categories.nim b/testament/categories.nim
index 48aa5844c..d9089e941 100644
--- a/testament/categories.nim
+++ b/testament/categories.nim
@@ -579,7 +579,8 @@ const specialCategories = [
   "niminaction",
   "rodfiles",
   "threads",
-  "untestable"
+  "untestable",
+  "stdlib",
 ]
 
 
@@ -598,9 +599,18 @@ const specialDisabedTests = [
   "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
+  "tests/generics/trtree.nim",       # very very ugly test
+  "tests/array/tarray.nim",          #
+  "tests/osproc/texecps.nim",        # uses getAppFileName() to start itself with arguments
+  "tests/destructor/turn_destroy_into_finalizer.nim", # fails when imported
+  "tests/osproc/texitsignal.nim",    # uses getAppFileName() to start itself with arguments
 ]
 
 proc isJoinableSpec(spec: TSpec): bool =
+
+  if spec.sortoutput:
+    return false
+
   if spec.action != actionRun:
     return false
 
@@ -678,24 +688,63 @@ proc runJoinedTest(): bool =
   else:
     echo "nimout FAIL"
 
-  (buf, exitCode) = execCmdEx2("./megatest", [], {}, "")
+  (buf, exitCode) = execCmdEx2("./megatest", [], {poStdErrToStdOut}, "")
   if exitCode != 0:
     quit("megatest execution failed")
 
   echo "run ok"
 
-  var outputOK = true
-  for runSpec in specs:
+
+  writeFile("outputGotten.txt", buf)
+  var outputExpected = ""
+
+  var outputErrorCount = 0
+  var currentPos = 0
+
+  var lastLine = ""
+
+  # when a lot of output is skipped, this can be the cause why a later test fails.
+  var warnings = ""
+
+  for i, runSpec in specs:
+    outputExpected.add runSpec.output
+    if outputExpected[^1] != '\n':
+       outputExpected.add '\n'
+
     for line in runSpec.output.splitLines:
-      if buf.find(line) < 0:
-        echo "could not find: ", line
-        echo runSpec.file
-        outputOK = false
-  if outputOK:
+      if line != "":
+        #if line == "2":
+        #  echo "found the test: ", runSpec.file
+        let newPos = buf.find(line, currentPos)
+        if newPos < 0:
+          if outputErrorCount < 5:
+            echo "could not find:      ", line
+            echo "it could be, because the test failed, or too much output is discarded by a previous search in the output."
+            echo warnings
+            warnings.setLen 0
+
+            # don't spam too much of this
+            if outputErrorCount == 0:
+              echo "############"
+              echo buf[currentPos-200 ..< currentPos]
+              echo "| (", current_pos, ")"
+              echo buf[currentPos ..< min(currentPos+200, buf.len)]
+              echo "############"
+
+          inc outputErrorCount
+        else:
+          if currentPos + lastLine.len * 2 < newPos:
+            warnings.addLine "Warning long skip in search for: ", line
+            warnings.addLine "in test: ", runSpec.file
+          currentPos = newPos + line.len
+
+        lastLine = line
+  if outputErrorCount == 0:
     echo "output OK"
   else:
-    echo "output FAIL"
+    echo "output FAIL (", outputErrorCount, " errors)"
 
-  removeFile("megatest.nim")
+  writeFile("outputExpected.txt", outputExpected)
 
-  return nimoutOK and outputOK
+  # removeFile("megatest.nim")
+  return nimoutOK and outputErrorCount == 0
diff --git a/testament/specs.nim b/testament/specs.nim
index e3ad3a4ff..9cbf2a9f6 100644
--- a/testament/specs.nim
+++ b/testament/specs.nim
@@ -109,12 +109,11 @@ proc parseTargets*(value: string): set[TTarget] =
     of "js": result.incl(targetJS)
     else: echo "target ignored: " & v
 
-
-proc addLine(self: var string; a: string) =
+proc addLine*(self: var string; a: string) =
   self.add a
   self.add "\n"
 
-proc addLine(self: var string; a,b: string) =
+proc addLine*(self: var string; a,b: string) =
   self.add a
   self.add b
   self.add "\n"
diff --git a/testament/tester.nim b/testament/tester.nim
index 11489e7a6..d82d5ec0c 100644
--- a/testament/tester.nim
+++ b/testament/tester.nim
@@ -497,6 +497,9 @@ else:
     # array of modules disabled from compilation test of stdlib.
     disabledFiles = ["-"]
 
+
+
+
 include categories
 
 # proc runCaasTests(r: var TResults) =
diff --git a/tests/async/t7192.nim b/tests/async/t7192.nim
index c380f93e1..9ac0e07c0 100644
--- a/tests/async/t7192.nim
+++ b/tests/async/t7192.nim
@@ -9,6 +9,6 @@ import asyncdispatch
 proc testCallback() =
   echo "testCallback()"
 
-when isMainModule:
+when true:
   callSoon(testCallback)
   poll()
diff --git a/tests/async/tasyncexceptions.nim b/tests/async/tasyncexceptions.nim
index 3a34478ca..de61c099d 100644
--- a/tests/async/tasyncexceptions.nim
+++ b/tests/async/tasyncexceptions.nim
@@ -27,7 +27,7 @@ proc serve() {.async.} =
     var fut = await accept()
     await processClient(fut)
 
-when isMainModule:
+when true:
   proc main =
     var fut = serve()
     fut.callback =
diff --git a/tests/async/tasyncrecursion.nim b/tests/async/tasyncrecursion.nim
index c038be640..7c12dbb0e 100644
--- a/tests/async/tasyncrecursion.nim
+++ b/tests/async/tasyncrecursion.nim
@@ -15,7 +15,7 @@ proc asyncRecursionTest*(): Future[int] {.async.} =
     inc(result, await asyncRecursionCycle(i))
     inc(i)
 
-when isMainModule:
+when true:
   setGlobalDispatcher(newDispatcher())
   var i = waitFor asyncRecursionTest()
   echo i
diff --git a/tests/bind/tdatabind.nim b/tests/bind/tdatabind.nim
index 124faee6f..f6455749c 100644
--- a/tests/bind/tdatabind.nim
+++ b/tests/bind/tdatabind.nim
@@ -74,7 +74,7 @@ proc propertyBind*[T](p1: var TProperty[T], p2: var TProperty[T]) =
 proc `->`[T](p1: var TProperty[T], p2: var TProperty[T]) =
   propertyBind(p2,p1)
 
-when isMainModule:
+when true:
   # Initial value testing
   var myProp = newProperty(5)
 
diff --git a/tests/ccgbugs/t8616.nim b/tests/ccgbugs/t8616.nim
index 54068652a..5fd940d3b 100644
--- a/tests/ccgbugs/t8616.nim
+++ b/tests/ccgbugs/t8616.nim
@@ -1,4 +1,4 @@
 import pkg8616 / scheduler
 
-when isMainModule:
+when true:
   init()
diff --git a/tests/ccgbugs/t8781.nim b/tests/ccgbugs/t8781.nim
index 1fa8ec8a5..884c6962a 100644
--- a/tests/ccgbugs/t8781.nim
+++ b/tests/ccgbugs/t8781.nim
@@ -18,7 +18,7 @@ type
     of false:
         region: float
 
-when isMainModule:
+when true:
   let r = 1.5
   let a = TypeOne(animatedU: true,
                   animated: false,
diff --git a/tests/ccgbugs/tgeneric_closure.nim b/tests/ccgbugs/tgeneric_closure.nim
index bb3b924b9..9f3c5b446 100644
--- a/tests/ccgbugs/tgeneric_closure.nim
+++ b/tests/ccgbugs/tgeneric_closure.nim
@@ -15,7 +15,7 @@ type
 proc mult(x:int, y:var int) =
   y = 2 * x
 
-when isMainModule:
+when true:
 
   var input = 1
   var output = 0
diff --git a/tests/ccgbugs/tgeneric_smallobj_asgn_opt.nim b/tests/ccgbugs/tgeneric_smallobj_asgn_opt.nim
index 919dc3fc1..3788b9985 100644
--- a/tests/ccgbugs/tgeneric_smallobj_asgn_opt.nim
+++ b/tests/ccgbugs/tgeneric_smallobj_asgn_opt.nim
@@ -1,5 +1,5 @@
 discard """
-  output: '''false'''
+  output: "done generic smallobj asgn opt"
 """
 
 # bug #5402
@@ -23,4 +23,5 @@ proc newListOfContainers[T](): ListOfContainers[T] =
   result.list = initDoublyLinkedList[Container[T]]()
 
 let q = newListOfContainers[int64]()
-echo q.contains(123)
+if not q.contains(123):
+  echo "done generic smallobj asgn opt"
diff --git a/tests/ccgbugs/tmarkerproc_regression.nim b/tests/ccgbugs/tmarkerproc_regression.nim
index 99b38e3ec..3b606b834 100644
--- a/tests/ccgbugs/tmarkerproc_regression.nim
+++ b/tests/ccgbugs/tmarkerproc_regression.nim
@@ -1,5 +1,5 @@
 discard """
-  output: "done"
+  output: "done markerproc regression"
 """
 
 type
@@ -42,6 +42,6 @@ proc main =
     let expected = $i & "some longer text here " & $i
     if a[i].ver.string != expected:
       quit "bug!"
-  echo "done"
+  echo "done markerproc regression"
 
 main()
diff --git a/tests/ccgbugs/tmissingbracket.nim b/tests/ccgbugs/tmissingbracket.nim
index d54983860..468e13366 100644
--- a/tests/ccgbugs/tmissingbracket.nim
+++ b/tests/ccgbugs/tmissingbracket.nim
@@ -1,6 +1,8 @@
 discard """
-  output: '''Subobject test called
-5'''
+output: '''
+Subobject test called
+5
+'''
 """
 
 type
@@ -49,4 +51,3 @@ var a: SubObject
 
 a.test()
 echo a.t
-
diff --git a/tests/collections/ttables.nim b/tests/collections/ttables.nim
index f1355e747..b22b2b237 100644
--- a/tests/collections/ttables.nim
+++ b/tests/collections/ttables.nim
@@ -1,6 +1,6 @@
 discard """
 output: '''
-done
+done tableadds
 And we get here
 1
 2
@@ -17,7 +17,7 @@ block tableadds:
       tab.add "key", "value " & $i
 
   main()
-  echo "done"
+  echo "done tableadds"
 
 
 block tcounttable:
diff --git a/tests/deps/jester-#head/jester/patterns.nim b/tests/deps/jester-#head/jester/patterns.nim
index 52b0d3a15..c827fbc7f 100644
--- a/tests/deps/jester-#head/jester/patterns.nim
+++ b/tests/deps/jester-#head/jester/patterns.nim
@@ -120,7 +120,7 @@ proc match*(pattern: Pattern, s: string):
   if s.len != i:
     result.matched = false
 
-when isMainModule:
+when true:
   let f = parsePattern("/show/@id/test/@show?/?")
   doAssert match(f, "/show/12/test/hallo/").matched
   doAssert match(f, "/show/2131726/test/jjjuuwąąss").matched
diff --git a/tests/deps/jester-#head/jester/private/utils.nim b/tests/deps/jester-#head/jester/private/utils.nim
index 66f0b37a6..0ddc5945b 100644
--- a/tests/deps/jester-#head/jester/private/utils.nim
+++ b/tests/deps/jester-#head/jester/private/utils.nim
@@ -188,7 +188,7 @@ when not declared(normalizePath) and not declared(normalizedPath):
     result = path
     normalizePath(result)
 
-when isMainModule:
+when true:
   var r = {:}.newStringTable
   parseUrlQuery("FirstName=Mickey", r)
   echo r
diff --git a/tests/deps/zip-0.2.1/zip/zipfiles.nim b/tests/deps/zip-0.2.1/zip/zipfiles.nim
index ca1979488..274587df9 100644
--- a/tests/deps/zip-0.2.1/zip/zipfiles.nim
+++ b/tests/deps/zip-0.2.1/zip/zipfiles.nim
@@ -186,7 +186,7 @@ proc extractAll*(z: var ZipArchive, dest: string) =
       createDir(dest / file[0..file.rfind("/")])
     extractFile(z, file, dest / file)
 
-when not defined(testing) and isMainModule:
+when not defined(testing) and true:
   var zip: ZipArchive
   if not zip.open("nim-0.11.0.zip"):
     raise newException(IOError, "opening zip failed")
diff --git a/tests/destructor/tmove_objconstr.nim b/tests/destructor/tmove_objconstr.nim
index 51aba1592..875f78283 100644
--- a/tests/destructor/tmove_objconstr.nim
+++ b/tests/destructor/tmove_objconstr.nim
@@ -36,7 +36,7 @@ proc pointlessWrapper(s: string): Data =
 proc main =
   var x = pointlessWrapper"test"
 
-when isMainModule:
+when true:
   main()
 
 # bug #985
diff --git a/tests/destructor/turn_destroy_into_finalizer.nim b/tests/destructor/turn_destroy_into_finalizer.nim
index f5b705593..b3f34003e 100644
--- a/tests/destructor/turn_destroy_into_finalizer.nim
+++ b/tests/destructor/turn_destroy_into_finalizer.nim
@@ -1,5 +1,5 @@
 discard """
-  output: '''true'''
+  output: "turn_destroy_into_finalizer works"
 """
 
 type
@@ -17,6 +17,9 @@ proc main =
   for i in 1..50_000:
     new(r)
     r.id = i
-  echo destroyed > 30_000
+  if destroyed > 30_000:
+    echo "turn_destroy_into_finalizer works"
+  else:
+    echo "turn_destroy_into_finalizer failed: ", destroyed
 
 main()
diff --git a/tests/discard/tdiscardable.nim b/tests/discard/tdiscardable.nim
index a3dd966a0..81e17866a 100644
--- a/tests/discard/tdiscardable.nim
+++ b/tests/discard/tdiscardable.nim
@@ -1,10 +1,13 @@
 discard """
 output: '''
+tdiscardable
 1
 1
 '''
 """
 
+echo "tdiscardable"
+
 # Test the discardable pragma
 
 proc p(x, y: int): int {.discardable.} =
diff --git a/tests/distinct/tdistinct.nim b/tests/distinct/tdistinct.nim
index 52728fc2b..70e586ded 100644
--- a/tests/distinct/tdistinct.nim
+++ b/tests/distinct/tdistinct.nim
@@ -1,9 +1,11 @@
 discard """
   output: '''
+tdistinct
 25
 '''
 """
 
+echo "tdistinct"
 
 block tborrowdot:
   type
@@ -18,8 +20,6 @@ block tborrowdot:
   bb.a = 90
   bb.s = "abc"
 
-
-
 block tcurrncy:
   template Additive(typ: untyped) =
     proc `+`(x, y: typ): typ {.borrow.}
@@ -53,8 +53,6 @@ block tcurrncy:
   DefineCurrency(TEuro, int)
   echo($( 12.TDollar + 13.TDollar )) #OUT 25
 
-
-
 block tconsts:
   # bug #2641
 
diff --git a/tests/errmsgs/t6483.nim b/tests/errmsgs/t6483.nim
index 59ea6d7e2..0e977b36d 100644
--- a/tests/errmsgs/t6483.nim
+++ b/tests/errmsgs/t6483.nim
@@ -16,7 +16,7 @@ type
     variables: seq[VarItem]
     children: seq[VarScope]
 
-when isMainModule:
+when true:
   var scope1 = VarScope(
     variables: newSeq[VarItem](),
     children: newSeq[VarScope]()
diff --git a/tests/errmsgs/tproper_stacktrace.nim b/tests/errmsgs/tproper_stacktrace.nim
index 134946651..c0090a595 100644
--- a/tests/errmsgs/tproper_stacktrace.nim
+++ b/tests/errmsgs/tproper_stacktrace.nim
@@ -66,7 +66,7 @@ template verifyStackTrace*(expectedStackTrace: string, body: untyped) =
 
 
 
-when isMainModule:
+when true:
 # <-- Align with line 70 in the text editor
   block:
     proc bar() =
diff --git a/tests/errmsgs/treportunused.nim b/tests/errmsgs/treportunused.nim
index f83ad5633..c74fea46f 100644
--- a/tests/errmsgs/treportunused.nim
+++ b/tests/errmsgs/treportunused.nim
@@ -16,7 +16,6 @@ action: compile
 """
 
 # bug #9764
-
 iterator s1(a:string): int = discard
 iterator s2(): int = discard
 template s3(): untyped = 123
diff --git a/tests/generics/tbintree.nim b/tests/generics/tbintree.nim
index b4507e298..962d4f315 100644
--- a/tests/generics/tbintree.nim
+++ b/tests/generics/tbintree.nim
@@ -81,7 +81,7 @@ proc debug[T](a: PBinaryTree[T]) =
     echo a.data
     debug(a.ri)
 
-when isMainModule:
+when true:
   var
     root: PBinaryTree[string]
     x = newNode("hello")
diff --git a/tests/generics/toverloading_typedesc.nim b/tests/generics/toverloading_typedesc.nim
index 94f4d860d..5ab700828 100644
--- a/tests/generics/toverloading_typedesc.nim
+++ b/tests/generics/toverloading_typedesc.nim
@@ -10,7 +10,7 @@ type
   LBar = object
 
 
-when isMainModule:
+when true:
   doAssert FBar.new() == 3
 
   proc new(_: typedesc[LFoo]): int = 0
diff --git a/tests/generics/tthread_generic.nim b/tests/generics/tthread_generic.nim
index f2e9cafa9..2af5a7615 100644
--- a/tests/generics/tthread_generic.nim
+++ b/tests/generics/tthread_generic.nim
@@ -26,7 +26,7 @@ proc `@||->`*[T](fn: proc(): T {.thread.},
 proc `||->`*[T](fn: proc(): T{.thread.}, callback: proc(val: T){.thread.}) =
   discard fn @||-> callback
 
-when isMainModule:
+when true:
   import os
   proc testFunc(): int {.thread.} =
     return 1
diff --git a/tests/generics/twrong_floatlit_type.nim b/tests/generics/twrong_floatlit_type.nim
index c1830cd5a..04bacc0d9 100644
--- a/tests/generics/twrong_floatlit_type.nim
+++ b/tests/generics/twrong_floatlit_type.nim
@@ -108,7 +108,7 @@ proc `/`*[S](a, b: Vector2D[S]): Vector2D[S] =
 proc vec[S](x, y: S): Vector2D[S] =
   Vector2D[S](x: x, y: y)
 
-if isMainModule:
+if true:
   # Comment out this let, and the program will fail to
   # compile with a type mismatch, as expected.
 
diff --git a/tests/implicit/timplicit.nim b/tests/implicit/timplicit.nim
index 70f14db53..bb701249c 100644
--- a/tests/implicit/timplicit.nim
+++ b/tests/implicit/timplicit.nim
@@ -6,6 +6,7 @@ discard """
 4
 2
 88
+timplicit done
 '''
 """
 
@@ -43,4 +44,6 @@ block:
   var indirect = p
   x.indirect(44)
 
-  echo x[]
\ No newline at end of file
+  echo x[]
+
+  echo "timplicit done"
diff --git a/tests/iter/titer10.nim b/tests/iter/titer10.nim
index 6a6afc780..9c76b62e1 100644
--- a/tests/iter/titer10.nim
+++ b/tests/iter/titer10.nim
@@ -23,7 +23,7 @@ when true:
       for val in sortable:
           yield val
 
-  when isMainModule:
+  when true:
     proc main =
       for val in byDistance([2, 3, 5, 1], 3):
           echo val
diff --git a/tests/js/tvarargs.nim b/tests/js/tvarargs.nim
index b8c532767..8d57af58d 100644
--- a/tests/js/tvarargs.nim
+++ b/tests/js/tvarargs.nim
@@ -11,5 +11,5 @@ type
 
 var console* {.importc.}: Console
 
-when isMainModule:
+when true:
   console.log "Hello, world"
diff --git a/tests/macros/tmacro4.nim b/tests/macros/tmacro4.nim
index 164afaeb7..7c2839aba 100644
--- a/tests/macros/tmacro4.nim
+++ b/tests/macros/tmacro4.nim
@@ -11,7 +11,7 @@ macro test_macro*(s: string, n: untyped): untyped =
   add(ass, newIdentNode("str"))
   add(ass, newStrLitNode("after"))
   add(result, ass)
-when isMainModule:
+when true:
   var str: string = "before"
   test_macro(str):
     var i : integer = 123
diff --git a/tests/manyloc/argument_parser/argument_parser.nim b/tests/manyloc/argument_parser/argument_parser.nim
index d42842f93..9a37ef8c9 100644
--- a/tests/manyloc/argument_parser/argument_parser.nim
+++ b/tests/manyloc/argument_parser/argument_parser.nim
@@ -486,7 +486,7 @@ proc echo_help*(expected: seq[Tparameter_specification] = @[],
     echo line
 
 
-when isMainModule:
+when true:
   # Simply tests code embedded in docs.
   let
     parsed_param1 = new_parsed_parameter(PK_FLOAT, 3.41)
diff --git a/tests/manyloc/argument_parser/ex_wget.nim b/tests/manyloc/argument_parser/ex_wget.nim
index 625a6f595..ebbf1933f 100644
--- a/tests/manyloc/argument_parser/ex_wget.nim
+++ b/tests/manyloc/argument_parser/ex_wget.nim
@@ -81,7 +81,7 @@ proc process_commandline(): Tcommandline_results =
     echo "Will use progress type $1" % [result.options[PARAM_PROGRESS[0]].str_val]
 
 
-when isMainModule:
+when true:
   let args = process_commandline()
   for param in args.positional_parameters:
     echo "Downloading $1" % param.str_val
diff --git a/tests/manyloc/keineschweine/dependencies/genpacket/genpacket.nim b/tests/manyloc/keineschweine/dependencies/genpacket/genpacket.nim
index 3026cc4b9..fe9909750 100644
--- a/tests/manyloc/keineschweine/dependencies/genpacket/genpacket.nim
+++ b/tests/manyloc/keineschweine/dependencies/genpacket/genpacket.nim
@@ -252,7 +252,7 @@ template forwardPacketT*(typeName: expr): stmt {.dirty, immediate.} =
   proc `pack typeName`*(p: var typeName; s: PStream) =
     writeData(s, addr p, sizeof(p))
 
-when isMainModule:
+when true:
   type
     SomeEnum = enum
       A = 0'i8,
diff --git a/tests/manyloc/keineschweine/dependencies/genpacket/genpacket_enet.nim b/tests/manyloc/keineschweine/dependencies/genpacket/genpacket_enet.nim
index dccbe61ba..5d844cff9 100644
--- a/tests/manyloc/keineschweine/dependencies/genpacket/genpacket_enet.nim
+++ b/tests/manyloc/keineschweine/dependencies/genpacket/genpacket_enet.nim
@@ -244,7 +244,7 @@ template forwardPacketT*(typeName: untyped; underlyingType: untyped) {.dirty.} =
     #writeData(s, addr p, sizeof(p))
     buffer.write(underlyingType(ord))
 
-when isMainModule:
+when true:
   type
     SomeEnum = enum
       A = 0'i8,
diff --git a/tests/manyloc/keineschweine/dependencies/genpacket/macro_dsl.nim b/tests/manyloc/keineschweine/dependencies/genpacket/macro_dsl.nim
index 33d2a7177..a9e1e4dbb 100644
--- a/tests/manyloc/keineschweine/dependencies/genpacket/macro_dsl.nim
+++ b/tests/manyloc/keineschweine/dependencies/genpacket/macro_dsl.nim
@@ -50,7 +50,7 @@ macro `?`(a: untyped): untyped =
   result = ($a[1].ident)[0].lit
 ## echo(?F,?a,?t,?t,?y)
 
-when isMainModule:
+when true:
   macro foo(x: untyped) =
     result = newNimNode(nnkStmtList)
     result.add(newNimNode(nnkCall).und(!!"echo", "Hello thar".lit))
diff --git a/tests/manyloc/keineschweine/dependencies/genpacket/streams_enh.nim b/tests/manyloc/keineschweine/dependencies/genpacket/streams_enh.nim
index 5a1dffc93..ad0d20f1c 100644
--- a/tests/manyloc/keineschweine/dependencies/genpacket/streams_enh.nim
+++ b/tests/manyloc/keineschweine/dependencies/genpacket/streams_enh.nim
@@ -24,7 +24,7 @@ proc writeLEStr*(s: PStream, str: string) =
   s.write(str.len.int16)
   s.write(str)
 
-when isMainModule:
+when true:
   var testStream = newStringStream()
 
   testStream.writeLEStr("Hello")
diff --git a/tests/manyloc/keineschweine/dependencies/nake/nake.nim b/tests/manyloc/keineschweine/dependencies/nake/nake.nim
index 5341c1079..83569e30e 100644
--- a/tests/manyloc/keineschweine/dependencies/nake/nake.nim
+++ b/tests/manyloc/keineschweine/dependencies/nake/nake.nim
@@ -50,7 +50,7 @@ template withDir*(dir: string; body: stmt): stmt =
   body
   cd(curDir)
 
-when isMainModule:
+when true:
   if not existsFile("nakefile.nim"):
     echo "No nakefile.nim found. Current working dir is ", getCurrentDir()
     quit 1
diff --git a/tests/manyloc/keineschweine/enet_server/enet_server.nim b/tests/manyloc/keineschweine/enet_server/enet_server.nim
index eae7c034e..3bb259386 100644
--- a/tests/manyloc/keineschweine/enet_server/enet_server.nim
+++ b/tests/manyloc/keineschweine/enet_server/enet_server.nim
@@ -102,7 +102,7 @@ handlers[HZoneJoinReq] = proc(client: PClient; buffer: PBuffer) =
 
 
 
-when isMainModule:
+when true:
   import parseopt, matchers, os, json
 
 
diff --git a/tests/manyloc/keineschweine/keineschweine.nim b/tests/manyloc/keineschweine/keineschweine.nim
index 04fec2788..b6fd3cc19 100644
--- a/tests/manyloc/keineschweine/keineschweine.nim
+++ b/tests/manyloc/keineschweine/keineschweine.nim
@@ -663,7 +663,7 @@ proc mainRender() =
 proc readyMainState() =
   specInputClient.setActive()
 
-when isMainModule:
+when true:
   import parseopt
 
   localPlayer = newPlayer()
diff --git a/tests/manyloc/keineschweine/lib/estreams.nim b/tests/manyloc/keineschweine/lib/estreams.nim
index 00a55c626..43a6d7004 100644
--- a/tests/manyloc/keineschweine/lib/estreams.nim
+++ b/tests/manyloc/keineschweine/lib/estreams.nim
@@ -106,7 +106,7 @@ proc readChar*(buffer: PBuffer): char {.inline.} = return readInt8(buffer).char
 proc readBool*(buffer: PBuffer): bool {.inline.} = return readInt8(buffer).bool
 
 
-when isMainModule:
+when true:
   var b = newBuffer(100)
   var str = "hello there"
   b.write str
diff --git a/tests/manyloc/keineschweine/lib/map_filter.nim b/tests/manyloc/keineschweine/lib/map_filter.nim
index f3f1df190..e12930066 100644
--- a/tests/manyloc/keineschweine/lib/map_filter.nim
+++ b/tests/manyloc/keineschweine/lib/map_filter.nim
@@ -17,7 +17,7 @@ template unless*(condition: untyped; body: untyped) {.dirty.} =
   if not condition:
     body
 
-when isMainModule:
+when true:
   proc dumpSeq[T](x: seq[T]) =
     for index, item in x.pairs:
       echo index, " ", item
diff --git a/tests/manyloc/keineschweine/lib/sg_packets.nim b/tests/manyloc/keineschweine/lib/sg_packets.nim
index f3a0e8925..9a5aa5496 100644
--- a/tests/manyloc/keineschweine/lib/sg_packets.nim
+++ b/tests/manyloc/keineschweine/lib/sg_packets.nim
@@ -92,7 +92,7 @@ defPacket(DsMsg, tuple[msg: string])
 let HVerifyClient* = 'v'
 defPacket(SdVerifyClient, tuple[session: ScLogin])
 
-when isMainModule:
+when true:
 
   var buf = newBuffer(100)
   var m = toMd5("hello there")
diff --git a/tests/manyloc/keineschweine/lib/zlib_helpers.nim b/tests/manyloc/keineschweine/lib/zlib_helpers.nim
index 076475964..895f41759 100644
--- a/tests/manyloc/keineschweine/lib/zlib_helpers.nim
+++ b/tests/manyloc/keineschweine/lib/zlib_helpers.nim
@@ -20,7 +20,7 @@ proc uncompress*(source: string, destLen: var int): string =
     echo "Error occurred: ", res
 
 
-when isMainModule:
+when true:
   import strutils
   var r = compress("Hello")
   echo repr(r)
diff --git a/tests/manyloc/keineschweine/server/old_dirserver.nim b/tests/manyloc/keineschweine/server/old_dirserver.nim
index 202dc6fe7..cfb0b0377 100644
--- a/tests/manyloc/keineschweine/server/old_dirserver.nim
+++ b/tests/manyloc/keineschweine/server/old_dirserver.nim
@@ -156,7 +156,7 @@ proc poll*(timeout: int = 250) =
       echo("Write ", c, " result: ", res, " data: ", repr(c.outputBuf.data))
       c.outputBuf.flush()
 
-when isMainModule:
+when true:
   import parseopt, matchers, strutils
   var cfgFile = "dirserver_settings.json"
   for kind, key, val in getOpt():
diff --git a/tests/manyloc/keineschweine/server/old_sg_server.nim b/tests/manyloc/keineschweine/server/old_sg_server.nim
index bddc74c6d..d046df9dd 100644
--- a/tests/manyloc/keineschweine/server/old_sg_server.nim
+++ b/tests/manyloc/keineschweine/server/old_sg_server.nim
@@ -141,7 +141,7 @@ proc poll*(timeout: int = 250) =
       echo("Write ", c, " result: ", res, " data: ", c.outputBuf.data)
       c.outputBuf.flush()
 
-when isMainModule:
+when true:
   import parseopt, matchers, strutils
   var zoneCfgFile = "./server_settings.json"
   for kind, key, val in getOpt():
diff --git a/tests/manyloc/nake/nake.nim b/tests/manyloc/nake/nake.nim
index ff3c10a17..ebcf21d19 100644
--- a/tests/manyloc/nake/nake.nim
+++ b/tests/manyloc/nake/nake.nim
@@ -50,7 +50,7 @@ template withDir*(dir: string; body: untyped) =
   body
   cd(curDir)
 
-when isMainModule:
+when true:
   if not existsFile("nakefile.nim"):
     echo "No nakefile.nim found. Current working dir is ", getCurrentDir()
     quit 1
diff --git a/tests/misc/thallo.nim b/tests/misc/thallo.nim
index 6f9d49121..7172a6b46 100644
--- a/tests/misc/thallo.nim
+++ b/tests/misc/thallo.nim
@@ -11,7 +11,7 @@ type
   TMyEnum = enum
     meA, meB, meC, meD
 
-when isMainModule:
+when true:
   {.hint: "this is the main file".}
 
 proc fac[T](x: T): T =
@@ -84,5 +84,5 @@ for i in 2..6:
   for j in countdown(i+4, 2):
     echo(fac(i * j))
 
-when isMainModule:
+when true:
   {.hint: "this is the main file".}
diff --git a/tests/misc/tradix.nim b/tests/misc/tradix.nim
index e6dde73f6..5be89530f 100644
--- a/tests/misc/tradix.nim
+++ b/tests/misc/tradix.nim
@@ -1,5 +1,6 @@
 discard """
 output: '''
+start tradix.nim
 false
 false
 false
@@ -29,6 +30,8 @@ false
 ## We use a radix tree with node compression.
 ## There are two node kinds:
 
+echo "start tradix.nim"
+
 const BitsPerUnit = 8*sizeof(int)
 
 type
diff --git a/tests/misc/tsortdev.nim b/tests/misc/tsortdev.nim
index f360d9646..0b2a4f3e8 100644
--- a/tests/misc/tsortdev.nim
+++ b/tests/misc/tsortdev.nim
@@ -1,5 +1,5 @@
 discard """
-  output: "done"
+  output: "done tsortdev"
 """
 
 import algorithm, strutils
@@ -55,5 +55,4 @@ proc main() =
 for i in 0..1_000:
   main()
 
-echo "done"
-
+echo "done tsortdev"
diff --git a/tests/niminaction/Chapter3/ChatApp/src/protocol.nim b/tests/niminaction/Chapter3/ChatApp/src/protocol.nim
index af515861c..4c122d4cc 100644
--- a/tests/niminaction/Chapter3/ChatApp/src/protocol.nim
+++ b/tests/niminaction/Chapter3/ChatApp/src/protocol.nim
@@ -37,7 +37,7 @@ proc createMessage*(username, message: string): string =
     "message": %message
   }) & "\c\l"
 
-when isMainModule:
+when true:
   block:
     let data = """{"username": "dom", "message": "hello"}"""
     let parsed = parseMessage(data)
diff --git a/tests/niminaction/Chapter3/ChatApp/src/server.nim b/tests/niminaction/Chapter3/ChatApp/src/server.nim
index 31da74d16..fbf0e5110 100644
--- a/tests/niminaction/Chapter3/ChatApp/src/server.nim
+++ b/tests/niminaction/Chapter3/ChatApp/src/server.nim
@@ -79,7 +79,7 @@ proc loop(server: Server, port = 7687) {.async.} =
 
 # Check whether this module has been imported as a dependency to another
 # module, or whether this module is the main module.
-when isMainModule:
+when true:
   # Initialise a new server.
   var server = newServer()
   echo("Server initialised!")
diff --git a/tests/niminaction/Chapter6/WikipediaStats/concurrency.nim b/tests/niminaction/Chapter6/WikipediaStats/concurrency.nim
index f20e21f4d..766f07fa5 100644
--- a/tests/niminaction/Chapter6/WikipediaStats/concurrency.nim
+++ b/tests/niminaction/Chapter6/WikipediaStats/concurrency.nim
@@ -79,5 +79,5 @@ proc readChunks(filename: string, chunksize = 1000000): Stats =
   file.close()
 
 
-when isMainModule:
+when true:
   echo readChunks(filename)
diff --git a/tests/niminaction/Chapter6/WikipediaStats/concurrency_regex.nim b/tests/niminaction/Chapter6/WikipediaStats/concurrency_regex.nim
index dbd635634..19b157926 100644
--- a/tests/niminaction/Chapter6/WikipediaStats/concurrency_regex.nim
+++ b/tests/niminaction/Chapter6/WikipediaStats/concurrency_regex.nim
@@ -64,5 +64,5 @@ proc readChunks(filename: string, chunksize = 1000000): Stats =
   file.close()
 
 
-when isMainModule:
+when true:
   echo readChunks(filename)
diff --git a/tests/niminaction/Chapter6/WikipediaStats/naive.nim b/tests/niminaction/Chapter6/WikipediaStats/naive.nim
index ce995efaf..687177f74 100644
--- a/tests/niminaction/Chapter6/WikipediaStats/naive.nim
+++ b/tests/niminaction/Chapter6/WikipediaStats/naive.nim
@@ -29,5 +29,5 @@ proc parse(filename: string): tuple[projectName, pageTitle: string,
 
   file.close()
 
-when isMainModule:
+when true:
   echo parse(filename)
diff --git a/tests/niminaction/Chapter6/WikipediaStats/parallel_counts.nim b/tests/niminaction/Chapter6/WikipediaStats/parallel_counts.nim
index 74857367a..2c4a59d83 100644
--- a/tests/niminaction/Chapter6/WikipediaStats/parallel_counts.nim
+++ b/tests/niminaction/Chapter6/WikipediaStats/parallel_counts.nim
@@ -70,7 +70,7 @@ proc readPageCounts(filename: string, chunkSize = 1_000_000) =
 
   echo("Most popular is: ", mostPopular)
 
-when isMainModule:
+when true:
   const file = "pagecounts-20160101-050000"
   let filename = getCurrentDir() / file
   readPageCounts(filename)
diff --git a/tests/niminaction/Chapter6/WikipediaStats/sequential_counts.nim b/tests/niminaction/Chapter6/WikipediaStats/sequential_counts.nim
index 102dd15d3..f4bae3df5 100644
--- a/tests/niminaction/Chapter6/WikipediaStats/sequential_counts.nim
+++ b/tests/niminaction/Chapter6/WikipediaStats/sequential_counts.nim
@@ -32,7 +32,7 @@ proc readPageCounts(filename: string) =
 
   echo("Most popular is: ", mostPopular)
 
-when isMainModule:
+when true:
   const file = "pagecounts-20160101-050000"
   let filename = getCurrentDir() / file
   readPageCounts(filename)
diff --git a/tests/niminaction/Chapter7/Tweeter/src/views/user.nim b/tests/niminaction/Chapter7/Tweeter/src/views/user.nim
index f3791b493..18f3713b3 100644
--- a/tests/niminaction/Chapter7/Tweeter/src/views/user.nim
+++ b/tests/niminaction/Chapter7/Tweeter/src/views/user.nim
@@ -40,7 +40,7 @@
 </div>
 #end proc
 #
-#when isMainModule:
+#when true:
 #  echo renderUser(User(username: "d0m96<>", following: @[]))
 #  echo renderMessages(@[
 #    Message(username: "d0m96", time: getTime(), msg: "Hello World!"),
diff --git a/tests/niminaction/Chapter7/Tweeter/tests/database_test.nim b/tests/niminaction/Chapter7/Tweeter/tests/database_test.nim
index da69a004c..a3cab4cba 100644
--- a/tests/niminaction/Chapter7/Tweeter/tests/database_test.nim
+++ b/tests/niminaction/Chapter7/Tweeter/tests/database_test.nim
@@ -4,7 +4,7 @@ outputsub: "All tests finished successfully!"
 
 import database, os, times
 
-when isMainModule:
+when true:
   removeFile("tweeter_test.db")
   var db = newDatabase("tweeter_test.db")
   db.setup()
diff --git a/tests/osproc/ta_out.nim b/tests/osproc/ta_out.nim
index 318a27d59..01b78eb11 100644
--- a/tests/osproc/ta_out.nim
+++ b/tests/osproc/ta_out.nim
@@ -1,14 +1,18 @@
 discard """
 output: '''
+start ta_out
 to stdout
 to stdout
 to stderr
 to stderr
 to stdout
 to stdout
+end ta_out
 '''
 """
 
+echo "start ta_out"
+
 # This file is prefixed with an "a", because other tests
 # depend on it and it must be compiled first.
 stdout.writeLine("to stdout")
@@ -25,3 +29,5 @@ stdout.writeLine("to stdout")
 stdout.flushFile()
 stdout.writeLine("to stdout")
 stdout.flushFile()
+
+echo "end ta_out"
diff --git a/tests/osproc/texecps.nim b/tests/osproc/texecps.nim
index 780adb7ce..10715fa0f 100644
--- a/tests/osproc/texecps.nim
+++ b/tests/osproc/texecps.nim
@@ -1,7 +1,3 @@
-discard """
-  output: ""
-"""
-
 import osproc, streams, strutils, os
 
 const NumberOfProcesses = 13
@@ -13,8 +9,7 @@ proc execCb(idx: int, p: Process) =
   if exitCode < len(gResults):
     gResults[exitCode] = p.outputStream.readAll.strip
 
-when isMainModule:
-
+when true:
   if paramCount() == 0:
     gResults = newSeq[string](NumberOfProcesses)
     var checks = newSeq[string](NumberOfProcesses)
diff --git a/tests/osproc/tstderr.nim b/tests/osproc/tstderr.nim
index 7a39522a3..55b11eba5 100644
--- a/tests/osproc/tstderr.nim
+++ b/tests/osproc/tstderr.nim
@@ -1,10 +1,15 @@
 discard """
-  output: '''--------------------------------------
+  output: '''
+start tstderr
+--------------------------------------
 to stderr
 to stderr
 --------------------------------------
 '''
 """
+
+echo "start tstderr"
+
 import osproc, os, streams
 
 const filename = "ta_out".addFileExt(ExeExt)
diff --git a/tests/parallel/tarray_of_channels.nim b/tests/parallel/tarray_of_channels.nim
index e2a682bd5..5139920ea 100644
--- a/tests/parallel/tarray_of_channels.nim
+++ b/tests/parallel/tarray_of_channels.nim
@@ -34,5 +34,5 @@ proc main =
   sync()
   for ix in 1..3: channels[ix].close()
 
-when isMainModule:
+when true:
   main()
diff --git a/tests/parallel/tgc_unsafe.nim b/tests/parallel/tgc_unsafe.nim
index a4d96cd73..baf0dc24a 100644
--- a/tests/parallel/tgc_unsafe.nim
+++ b/tests/parallel/tgc_unsafe.nim
@@ -28,5 +28,5 @@ proc main =
   sync()
   for ix in 1..3: channels[ix].close()
 
-when isMainModule:
+when true:
   main()
diff --git a/tests/parallel/tgc_unsafe2.nim b/tests/parallel/tgc_unsafe2.nim
index 0a56a23aa..40af728fb 100644
--- a/tests/parallel/tgc_unsafe2.nim
+++ b/tests/parallel/tgc_unsafe2.nim
@@ -35,5 +35,5 @@ proc main =
   sync()
   for ix in 1..3: channels[ix].close()
 
-when isMainModule:
+when true:
   main()
diff --git a/tests/parallel/tmissing_deepcopy.nim b/tests/parallel/tmissing_deepcopy.nim
index 45fdf0f8f..694eb77db 100644
--- a/tests/parallel/tmissing_deepcopy.nim
+++ b/tests/parallel/tmissing_deepcopy.nim
@@ -36,6 +36,6 @@ proc update =
     for i in 0 .. people.high:
       spawn people[i].greet()
 
-when isMainModule:
+when true:
   setup()
   update()
diff --git a/tests/parallel/tsimple_array_checks.nim b/tests/parallel/tsimple_array_checks.nim
index ee9508074..5d6e87efe 100644
--- a/tests/parallel/tsimple_array_checks.nim
+++ b/tests/parallel/tsimple_array_checks.nim
@@ -59,5 +59,5 @@ proc maino =
 
 maino() # Doesn't work outside a proc
 
-when isMainModule:
+when true:
   main()
diff --git a/tests/parallel/twrong_refcounts.nim b/tests/parallel/twrong_refcounts.nim
index 57e0588a0..ac428762d 100644
--- a/tests/parallel/twrong_refcounts.nim
+++ b/tests/parallel/twrong_refcounts.nim
@@ -48,6 +48,6 @@ proc update =
 
 # ---
 
-when isMainModule:
+when true:
   setup()
   update()
diff --git a/tests/statictypes/t9255.nim b/tests/statictypes/t9255.nim
index bc8df6656..86bc8c7f1 100644
--- a/tests/statictypes/t9255.nim
+++ b/tests/statictypes/t9255.nim
@@ -8,6 +8,6 @@ type mismatch: got <static[proc (a0: int): string{.noSideEffect, gcsafe, locks:
 macro fun(a: static float): untyped =
   discard
 
-when isMainModule:
+when true:
   proc bar(a0: int): string = discard
   fun(bar)
diff --git a/tests/stdlib/tjsonmacro.nim b/tests/stdlib/tjsonmacro.nim
index 4ba0cdecc..33332447b 100644
--- a/tests/stdlib/tjsonmacro.nim
+++ b/tests/stdlib/tjsonmacro.nim
@@ -3,7 +3,7 @@ discard """
 """
 import json, strutils, options, tables
 
-when isMainModule:
+when true:
   # Tests inspired by own use case (with some additional tests).
   # This should succeed.
   type
diff --git a/tests/system/helpers/readall_echo.nim b/tests/system/helpers/readall_echo.nim
index 79937bf6f..2891ef3ae 100644
--- a/tests/system/helpers/readall_echo.nim
+++ b/tests/system/helpers/readall_echo.nim
@@ -1,2 +1,2 @@
-when isMainModule:
+when true:
   echo(stdin.readAll)
diff --git a/tests/template/annotate.nim b/tests/template/annotate.nim
index a7e2f8fdb..5db7e59ea 100644
--- a/tests/template/annotate.nim
+++ b/tests/template/annotate.nim
@@ -65,7 +65,7 @@ proc reindent*(value: string, preset_indent = 0): string =
 make([ html, xml, glsl, js, css, rst ])
 
 
-when isMainModule:
+when true:
     ## Test tags
 
     const script = js"""
diff --git a/tests/template/t_otemplates.nim b/tests/template/t_otemplates.nim
index 6597bd37a..8d2ac38a6 100644
--- a/tests/template/t_otemplates.nim
+++ b/tests/template/t_otemplates.nim
@@ -340,6 +340,6 @@ macro tmpl*(body: untyped): untyped =
 
 
 # Run tests
-when isMainModule:
+when true:
     include otests
     echo "Success"
diff --git a/tests/template/template_issues.nim b/tests/template/template_issues.nim
index 8599b161a..15d6ab2b1 100644
--- a/tests/template/template_issues.nim
+++ b/tests/template/template_issues.nim
@@ -43,7 +43,7 @@ block t2629:
 
   let rst_files = concat(glob_rst(), glob_rst("docs"))
 
-  when isMainModule: echo rst_files
+  when true: echo rst_files
 
 
 block t5417:
diff --git a/tests/template/tgensymregression.nim b/tests/template/tgensymregression.nim
index 4cc64a831..4194e3e88 100644
--- a/tests/template/tgensymregression.nim
+++ b/tests/template/tgensymregression.nim
@@ -15,7 +15,7 @@ template mathPerComponent(op: untyped): untyped =
 mathPerComponent(`***`)
 # bug #5285
 when true:
-  if isMainModule:
+  if true:
     var v1: array[3, float64]
     var v2: array[3, float64]
     echo repr(v1 *** v2)
diff --git a/tests/template/thygienictempl.nim b/tests/template/thygienictempl.nim
index 506f57148..9020c3e28 100644
--- a/tests/template/thygienictempl.nim
+++ b/tests/template/thygienictempl.nim
@@ -18,5 +18,5 @@ template test_in(a, b, c: untyped): bool {.dirty.} =
   var result {.gensym.}: bool = false
   false
 
-when isMainModule:
+when true:
   assert test_in(ret2, "test", str_val)
diff --git a/tests/template/twrongopensymchoice.nim b/tests/template/twrongopensymchoice.nim
index 360c92037..7a2bb48d3 100644
--- a/tests/template/twrongopensymchoice.nim
+++ b/tests/template/twrongopensymchoice.nim
@@ -20,5 +20,5 @@ proc main =
   var f = Foo.new()
   echo f.b
 
-when isMainModule:
+when true:
   main()
diff --git a/tests/threads/t8535.nim b/tests/threads/t8535.nim
index a8d69657b..e1b5a1369 100644
--- a/tests/threads/t8535.nim
+++ b/tests/threads/t8535.nim
@@ -12,5 +12,5 @@ type
 
 var foo {.threadvar.}: CircAlloc[1,Job]
 
-when isMainModule:
+when true:
   echo foo.index
diff --git a/tests/tuples/ttuples_various.nim b/tests/tuples/ttuples_various.nim
index 36171d5d7..010893ced 100644
--- a/tests/tuples/ttuples_various.nim
+++ b/tests/tuples/ttuples_various.nim
@@ -121,7 +121,7 @@ block tuple_with_seq:
   proc g(t: tuple[n:int, xs:seq[int]]) =
     discard
 
-  when isMainModule:
+  when true:
     f(@[]) # OK
     g((1,@[1])) # OK
     g((0,@[])) # NG
diff --git a/tests/typerel/t2plus.nim b/tests/typerel/t2plus.nim
index d099eeeb0..4b18b6221 100644
--- a/tests/typerel/t2plus.nim
+++ b/tests/typerel/t2plus.nim
@@ -16,7 +16,7 @@ proc foldRight[T,U](lst: seq[T], v: U, f: (T, U) -> U): U =
 proc mean[T: SomeNumber](xs: seq[T]): T =
   xs.foldRight(0.T, (xBAZ: auto, yBAZ: auto) => xBAZ + yBAZ) / T(xs.len)
 
-when isMainModule:
+when true:
   let x = mean(@[1.float, 2, 3])
   echo x
 
diff --git a/tests/types/tillegaltyperecursion.nim b/tests/types/tillegaltyperecursion.nim
index 6ead902b7..d8021c06f 100644
--- a/tests/types/tillegaltyperecursion.nim
+++ b/tests/types/tillegaltyperecursion.nim
@@ -59,7 +59,7 @@ proc Connect*(irc: var TIRC, nick: string, host: string, port: int = 6667) =
 
 
 
-when isMainModule:
+when true:
     var irc = initIRC()
     irc.Connect("AmryBot[Nim]","irc.freenode.net",6667)
     irc.sendRaw("JOIN #nim")
diff --git a/tests/untestable/tssl.nim b/tests/untestable/tssl.nim
index 664ad805c..fca6385f8 100644
--- a/tests/untestable/tssl.nim
+++ b/tests/untestable/tssl.nim
@@ -20,7 +20,7 @@ from strutils import contains, toHex
 
 from openssl import getOpenSSLVersion
 
-when isMainModule:
+when true:
   echo "version: 0x" & $getOpenSSLVersion().toHex()
 
   let client = newHttpClient()
diff --git a/tests/vm/tforwardproc.nim b/tests/vm/tforwardproc.nim
index 727ac6641..bcd929f0e 100644
--- a/tests/vm/tforwardproc.nim
+++ b/tests/vm/tforwardproc.nim
@@ -14,4 +14,4 @@ proc initArray(): array[10, int] =
   for f in 0..<10:
     result[f] = 3
 
-when isMainModule: echo repr(someTable)
+when true: echo repr(someTable)