summary refs log tree commit diff stats
path: root/tests/stdlib
diff options
context:
space:
mode:
authorMiran <narimiran@disroot.org>2020-11-02 16:52:54 +0100
committerGitHub <noreply@github.com>2020-11-02 16:52:54 +0100
commitc243639979b795d28a69f19ad988726225e22fcd (patch)
tree6da97b21f0d0d36b1189458cb25815227693de79 /tests/stdlib
parent235e4930ab2f5a9a4c94d6cc66d62701ee58550d (diff)
downloadNim-c243639979b795d28a69f19ad988726225e22fcd.tar.gz
`ioutils` are moved to `fusion` (#15822)
Diffstat (limited to 'tests/stdlib')
-rw-r--r--tests/stdlib/tioutils.nim49
1 files changed, 0 insertions, 49 deletions
diff --git a/tests/stdlib/tioutils.nim b/tests/stdlib/tioutils.nim
deleted file mode 100644
index 6854a7c1c..000000000
--- a/tests/stdlib/tioutils.nim
+++ /dev/null
@@ -1,49 +0,0 @@
-discard """
-  output: '''
-hello1
-hello1
-'''
-"""
-
-import std/ioutils
-import os
-from stdtest/specialpaths import buildDir
-
-block: # duplicate, duplicateTo
-  let tmpFileName = buildDir / "tioutils.txt"
-  template captureStdout(body) : untyped =
-    let stdoutFileno = stdout.getFileHandle()
-    # Duplicate stoudFileno
-    let stdout_dupfd = duplicate(stdoutFileno)
-    # Create a new file
-    # You can use append strategy if you'd like
-    let tmpFile: File = open(tmpFileName, fmWrite)
-    # Get the FileHandle (the file descriptor) of your file
-    let tmpFileFd: FileHandle = tmpFile.getFileHandle()
-    # dup2 tmpFileFd to stdoutFileno -> writing to stdoutFileno now writes to tmpFile
-    duplicateTo(tmpFileFd, stdoutFileno)
-    body
-    # Force flush
-    tmpFile.flushFile()
-    # Close tmp
-    tmpFile.close()
-    # Read tmp
-    let ret = readFile(tmpFileName)
-    # Restore stdout
-    duplicateTo(stdout_dupfd, stdoutFileno)
-    ret
-
-  proc duplicateStdout() =
-    var msg = "hello"
-    echo msg & "1"
-
-    let s = captureStdout:
-      echo msg & "2"
-
-    doAssert s == "hello2\n"
-
-  discard tryRemoveFile(tmpFileName)
-  duplicateStdout()
-  # Check it works twice
-  duplicateStdout()
-  doAssert tryRemoveFile(tmpFileName)