re-enable disabled tests after #17173 (#17228)

This commit is contained in:
Timothee Cour 2021-03-02 03:53:05 -08:00 • committed by GitHub
commit f1bf672ffc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,71 +5,35 @@ discard """
import std/[strbasics, sugar] import std/[strbasics, sugar]
template strip2(input: string, args: varargs[untyped]): untyped =
var a = input
when varargsLen(args) > 0:
strip(a, args)
else:
strip(a)
a
proc main() = proc main() =
when not defined(gcArc): # pending bug #17173
block: # strip block: # strip
block: # bug #17173
var a = " vhellov " var a = " vhellov "
strip(a) strip(a)
doAssert a == "vhellov" doAssert a == "vhellov"
a = " vhellov " doAssert strip2(" vhellov ") == "vhellov"
a.strip(leading = false) doAssert strip2(" vhellov ", leading = false) == " vhellov"
doAssert a == " vhellov" doAssert strip2(" vhellov ", trailing = false) == "vhellov "
doAssert strip2("vhellov", chars = {'v'}) == "hello"
a = " vhellov " doAssert strip2("vhellov", leading = false, chars = {'v'}) == "vhello"
a.strip(trailing = false) doAssert strip2("blaXbla", chars = {'b', 'a'}) == "laXbl"
doAssert a == "vhellov " doAssert strip2("blaXbla", chars = {'b', 'a', 'l'}) == "X"
doAssert strip2("xxxxxx", chars={'x'}) == ""
a.strip() doAssert strip2("x", chars={'x'}) == ""
a.strip(chars = {'v'}) doAssert strip2("x", chars={'1'}) == "x"
doAssert a == "hello" doAssert strip2("", chars={'x'}) == ""
doAssert strip2("xxx xxx", chars={'x'}) == " "
a = " vhellov " doAssert strip2("xxx wind", chars={'x'}) == " wind"
a.strip() doAssert strip2("xxx iii", chars={'i'}) == "xxx "
a.strip(leading = false, chars = {'v'})
doAssert a == "vhello"
var c = "blaXbla"
c.strip(chars = {'b', 'a'})
doAssert c == "laXbl"
c = "blaXbla"
c.strip(chars = {'b', 'a', 'l'})
doAssert c == "X"
block:
var a = "xxxxxx"
a.strip(chars={'x'})
doAssert a.len == 0
block:
var a = "x"
a.strip(chars={'x'})
doAssert a.len == 0
block:
var a = "x"
a.strip(chars={'1'})
doAssert a.len == 1
block:
var a = ""
a.strip(chars={'x'})
doAssert a.len == 0
block:
var a = "xxx xxx"
a.strip(chars={'x'})
doAssert a == " "
block:
var a = "xxx wind"
a.strip(chars={'x'})
doAssert a == " wind"
block:
var a = "xxx iii"
a.strip(chars={'i'})
doAssert a == "xxx "
block: block:
var a = "xxx iii" var a = "xxx iii"