Deprecate TaintedString (#15423)
Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> Co-authored-by: Dominik Picheta <dominikpicheta@googlemail.com>
This commit is contained in:
parent
7b632f9ccb
commit
78a99587a4
36 changed files with 184 additions and 229 deletions
|
|
@ -5,7 +5,7 @@ disabled: "appveyor"
|
|||
|
||||
import memfiles
|
||||
var inp = memfiles.open("tests/stdlib/tmemlinesBuf.nim")
|
||||
var buffer: TaintedString = ""
|
||||
var buffer: string = ""
|
||||
var lineCount = 0
|
||||
for line in lines(inp, buffer):
|
||||
lineCount += 1
|
||||
|
|
|
|||
|
|
@ -195,15 +195,15 @@ else: # main driver
|
|||
# bugfix: windows stdin.close was a noop and led to blocking reads
|
||||
proc startProcessTest(command: string, options: set[ProcessOption] = {
|
||||
poStdErrToStdOut, poUsePath}, input = ""): tuple[
|
||||
output: TaintedString,
|
||||
output: string,
|
||||
exitCode: int] {.tags:
|
||||
[ExecIOEffect, ReadIOEffect, RootEffect], gcsafe.} =
|
||||
var p = startProcess(command, options = options + {poEvalCommand})
|
||||
var outp = outputStream(p)
|
||||
if input.len > 0: inputStream(p).write(input)
|
||||
close inputStream(p)
|
||||
result = (TaintedString"", -1)
|
||||
var line = newStringOfCap(120).TaintedString
|
||||
result = ("", -1)
|
||||
var line = newStringOfCap(120)
|
||||
while true:
|
||||
if outp.readLine(line):
|
||||
result[0].string.add(line.string)
|
||||
|
|
@ -223,7 +223,7 @@ else: # main driver
|
|||
p.inputStream.flush()
|
||||
var line = ""
|
||||
var s: seq[string]
|
||||
while p.outputStream.readLine(line.TaintedString):
|
||||
while p.outputStream.readLine(line):
|
||||
s.add line
|
||||
doAssert s == @["10"]
|
||||
|
||||
|
|
@ -235,15 +235,15 @@ else: # main driver
|
|||
deferScoped: p.close()
|
||||
do:
|
||||
var sout: seq[string]
|
||||
while p.outputStream.readLine(x.TaintedString): sout.add x
|
||||
while p.outputStream.readLine(x): sout.add x
|
||||
doAssert sout == @["start ta_out", "to stdout", "to stdout", "to stderr", "to stderr", "to stdout", "to stdout", "end ta_out"]
|
||||
block: # startProcess stderr (replaces old test `tstderr` + `ta_out`)
|
||||
var p = startProcess(output, dir, options={})
|
||||
deferScoped: p.close()
|
||||
do:
|
||||
var serr, sout: seq[string]
|
||||
while p.errorStream.readLine(x.TaintedString): serr.add x
|
||||
while p.outputStream.readLine(x.TaintedString): sout.add x
|
||||
while p.errorStream.readLine(x): serr.add x
|
||||
while p.outputStream.readLine(x): sout.add x
|
||||
doAssert serr == @["to stderr", "to stderr"]
|
||||
doAssert sout == @["start ta_out", "to stdout", "to stdout", "to stdout", "to stdout", "end ta_out"]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue