summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorSimon Hafner <hafnersimon@gmail.com>2011-12-31 19:07:31 +0100
committerSimon Hafner <hafnersimon@gmail.com>2011-12-31 19:07:31 +0100
commitad0ea47f4304aee66d8a39ec61ac49aa83f97ecd (patch)
treed3cb55080825359c6833b012d6c07fae711ccc7b
parent9bd2be36c878cb635e1b6ae4d2725cc26e291d7c (diff)
downloadNim-ad0ea47f4304aee66d8a39ec61ac49aa83f97ecd.tar.gz
fixed the io tests so they run as intended
There is however a problem with the unittest. It does output
colors even if stdout isn't a tty, so the test still fails.
-rw-r--r--tests/specials.nim6
-rw-r--r--tests/system/helpers/readall_echo.nim3
-rw-r--r--tests/system/io.nim3
3 files changed, 5 insertions, 7 deletions
diff --git a/tests/specials.nim b/tests/specials.nim
index f5a6545d4..a45ca66c6 100644
--- a/tests/specials.nim
+++ b/tests/specials.nim
@@ -140,10 +140,9 @@ proc rejectThreadTests(r: var TResults, options: string) =
 
 # ------------------------- IO tests -----------------------------------
 
-proc compileIOTests(r: var TResults, options: string) =
-  compileSingleTest(r, "tests/system/helpers/readall_echo.nim", options)
-
 proc runIOTests(r: var TResults, options: string) =
+  # We need readall_echo to be compiled for this test to run.
+  compileSingleTest(r, "tests/system/helpers/readall_echo", options)
   runSingleTest(r, "tests/system/io", options)
 
 # ------------------------- register special tests here -----------------------
@@ -163,6 +162,5 @@ proc compileSpecialTests(r: var TResults, options: string) =
   compileSingleTest(r, "compiler/c2nim/c2nim.nim", options)
   compileSingleTest(r, "compiler/pas2nim/pas2nim.nim", options)
 
-  compileIOTests(r, options)
   compileDLLTests(r, options)
 
diff --git a/tests/system/helpers/readall_echo.nim b/tests/system/helpers/readall_echo.nim
index 2890217ef..79937bf6f 100644
--- a/tests/system/helpers/readall_echo.nim
+++ b/tests/system/helpers/readall_echo.nim
@@ -1 +1,2 @@
-echo(stdin.readAll)
+when isMainModule:
+  echo(stdin.readAll)
diff --git a/tests/system/io.nim b/tests/system/io.nim
index cc5f07080..849184074 100644
--- a/tests/system/io.nim
+++ b/tests/system/io.nim
@@ -1,11 +1,10 @@
 discard """output: '''[OK] stdin
 
 [OK] file'''
-disabled: true
 """
 
 import
-  unittest, osproc, streams, os, "helpers/readall_echo"
+  unittest, osproc, streams, os
 const STRING_DATA = """Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet."""
 const TEST_FILE = "tests/testdata/string"